SimMcのインストール
SimMcのコンパイル
SimMc はクリーンなC++で記述されています.
Linux, MacOSX, FreeBSD などの多くの環境で動作します.
v2.0現在,MacOSX, FreeBSDへの対応は準備中です.
実行ファイルを作成するためにはコンパイルが必要です.
まずは,
配布パッケージをダウンロード
してください.
パッケージのファイル名が SimMc-2.0.tar.gz であることを想定していますが,
ダウンロードする版によって異なる名前となることがあります.
シミュレータをコンパイルします.
$ tar xvfz SimMc-2.0.tar.gz
$ cd SimMc-2.0
Linux $ make
MacOSX $ make mac
FreeBSD $ make bsd
コンパイルに成功すると,sim ディレクトリの下に SimMc
という実行可能ファイルが生成されます.
simディレクトリにパスを通しておくと便利です.
SimMcの動作確認
--help引数を与えて実行することで,
使い方に関する次のメッセージが表示されます.
$ sim/SimMc --help
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## options: --help
usage: ./SimMc [options] binary1 binary2 ...
--x-rank num , -x[num]: number of columns
...(以下省略)
これがうまく表示されない場合には,なんらかの問題が生じています.
コンパイルが正しくおこなわれているか確認してください.
app/test ディレクトリ以下には,サンプルプログラムが格納されています.
次のコマンドでサンプルプログラムの一つである app/test/sample/
を実行します.
$ cd app/test/sample/
$ ../../../sim/SimMc test.out
実行すると以下の出力が得られます.
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## arguments: test.out
## Physical Size : 4x4
## Logical Size App 0: 4x4
## [a 1, 1 ][a 2, 1 ][a 3, 1 ][a 4, 1 ]
## [a 1, 2 ][a 2, 2 ][a 3, 2 ][a 4, 2 ]
## [a 1, 3 ][a 2, 3 ][a 3, 3 ][a 4, 3 ]
## [a 1, 4 ][a 2, 4 ][a 3, 4 ][a 4, 4 ]
## Multi-Core library MClib v1.0.0 2009-12-16
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
## Simulation time (s) : 1.027
## Simulation cycle : 14231
## Simulation speed (kc/s): 13.855
Buildrootのインストール
SimMc用のプログラムをコンパイルするためにBuildrootを導入します.
MIPS32のクロス開発環境の構築
を参考にビルドしてください.
Buildrootがビルド出来たら,SimMcを展開したディレクトリに戻って,
base.mkファイルを変更します.
base.mkファイルの6行目,BUILDROOTDIRに
Buildrootの設定 "Toolchain and header file location"
で指定したディレクトリを設定してください.
また,7行目のBASEDIRにSimMcを展開したディレクトリを設定してください.
$ head -n 7 base.mk | tail -n 2
BUILDROOTDIR = /your/buildroot/dir
BASEDIR = /your/base/dir
Buildrootの動作確認
実際にBuildrootを使ってテストアプリをコンパイルして,実行してみます.
テストアプリのコンパイル時にライブラリ MClib も自動的にコンパイルされます.
$ cd app/test/test10/
$ make
make -C /your/base/dir/lib
make[1]: ディレクトリ `/your/base/dir/lib' に入ります
/your/buildroot/dir/usr/bin/mipsel-linux-gcc -O2 -Wall -c MClib.c
make[1]: ディレクトリ `/your/base/dir/lib' から出ます
/your/buildroot/dir/usr/bin/mipsel-linux-gcc -Wall -O3 main.c -c -I/your/base/dir/lib
/your/buildroot/dir/usr/bin/mipsel-linux-gcc -static main.o /your/base/dir/lib/MClib.o -o test.out
$ make run
/your/base/dir/sim/SimMc test.out
## SimMc: Many-Core and NoC Simulator v2.0 2012-09-30
## arguments: test.out
## Physical Size : 4x4
## Logical Size App 0: 4x4
## [a 1, 1 ][a 2, 1 ][a 3, 1 ][a 4, 1 ]
## [a 1, 2 ][a 2, 2 ][a 3, 2 ][a 4, 2 ]
## [a 1, 3 ][a 2, 3 ][a 3, 3 ][a 4, 3 ]
## [a 1, 4 ][a 2, 4 ][a 3, 4 ][a 4, 4 ]
## Multi-Core library MClib v1.0.1 2012-09-30
$$ test10: I am core (2,1).
$$ test10: I am core (3,1).
$$ test10: I am core (4,1).
$$ test10: I am core (2,2).
$$ test10: I am core (3,2).
$$ test10: I am core (4,2).
$$ test10: I am core (2,3).
$$ test10: I am core (3,3).
$$ test10: I am core (4,3).
$$ test10: I am core (2,4).
$$ test10: I am core (3,4).
$$ test10: I am core (4,4).
$$ test10: I am core (1,2).
$$ test10: I am core (1,3).
$$ test10: I am core (1,4).
$$ test10: I am core (1,1).
## Simulation time (s) : 0.117
## Simulation cycle : 19410
## Simulation speed (kc/s): 165.862