Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

OVP : Dual Cortex-A9デモ、その2



各コアで動くプログラム(multicore2.c)ですが、
impProcessorId関数でCPUのidを獲得して、
プロセッサ0の時はwriter関数をプロセッサ1の時はreader関数を実行します。
各CPUが協調して動くことになります。
impProcessorId関数を使うために、simulatorIntercepts.hファイルをインクルードしています。
#include "simulatorIntercepts.h"

int main(int argc, char **argv) {

    int id = impProcessorId();
    printf("CPU %d starting...\n", id);

   switch(id) {
        case 0:
            writer(id, NUM_VALUES);
            break;
        case 1:
           reader(id);
            break;
        case 2:
            break;
    }
    return 1;
}
プログラムの実行結果の最後のレポートを見ると、2コアで動いています。
各CPUが2倍(200MIPS)の速度で動いています。
Info ---------------------------------------------------
Info CPU '/cpu1' STATISTICS
Info   Type                  : arm (Cortex-A9UP)
Info   Nominal MIPS          : 100
Info   Final program counter : 0x640
Info   Simulated instructions: 384,021,793
Info   Simulated MIPS        : 200.8
Info ---------------------------------------------------
Info
Info ---------------------------------------------------
Info CPU '/cpu0' STATISTICS
Info   Type                  : arm (Cortex-A9UP)
Info   Nominal MIPS          : 100
Info   Final program counter : 0x640
Info   Simulated instructions: 384,000,087
Info   Simulated MIPS        : 200.8
Info ---------------------------------------------------
Info
Info ---------------------------------------------------
Info TOTAL
Info   Simulated instructions: 768,021,880
Info   Simulated MIPS        : 401.7
Info ---------------------------------------------------
Info
Info ---------------------------------------------------
Info SIMULATION TIME STATISTICS
Info   Simulated time        : 3.84 seconds
Info   User time             : 1.83 seconds
Info   System time           : 0.00 seconds
Info   Elapsed time          : 1.91 seconds
Info   Real Time Ratio       : 2.01 X faster
Info ---------------------------------------------------

検証、Verification、OVP