Created
February 25, 2017 10:35
-
-
Save sueki743/8ca41c9f11ff9f644dbd6fde6f376371 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 適当にディレクトリを作る | |
mkdir cpuex2016D | |
cd cpuex2016D | |
# コンパイラ | |
git clone https://github.com/cpuex2016D/min-caml.git | |
cd min-caml | |
make | |
ln -s rayracer/globals.ml ./ | |
./min-caml -inline 100 rayracer/minrt | |
# コンパイル開始後5秒ほどで、並列化する関数を選択するよう促される (please choose one function for parallelize...) ので、0、Enterを入力する | |
# 十数分待つ | |
# rayracer/minrt.sに親コアのコード、rayracer/minrtchild.sに子コアのコードが生成される | |
cat libmincaml.S >> rayracer/minrt.s | |
cat libmincaml.S >> rayracer/minrtchild.s | |
cd .. | |
# アセンブラ | |
git clone https://github.com/cpuex2016D/simulator.git | |
cd simulator/assembler/2nd | |
make | |
./ass ../../../min-caml/rayracer/minrt.s parent.n.s | |
# textに命令、dataにデータ、pcにプログラムカウンタの初期値、parent.n.sにはminrt.sの各命令にアドレスを付けたものが出力される | |
mv text parent.text | |
./ass ../../../min-caml/rayracer/minrtchild.s child.n.s | |
# warningが出るが問題ない | |
# textに命令、dataにデータ、child.n.sにはminrtchild.sの各命令にアドレスを付けたものが出力される | |
# (dataは先のものと同じ) | |
mv text child.text | |
# シミュレータ | |
cd ../../sim2/2nd | |
make | |
./sim ../../assembler/2nd/parent.text ../../assembler/2nd/child.text ../../assembler/2nd/data ../../assembler/2nd/pc ../../1st_parallel/contest.sld.bin > output | |
# 各種状態が表示され、コマンド入力待ちになる。コマンドの説明はreadme.txtにある。単純に実行する場合は、c、Enterを入力する | |
# 入力(contest.sld.bin)の終わりに達した状態でin, fin命令が呼ばれると、命令数の統計等を表示してコマンド入力待ちになる。control-cで終了する | |
# 出力の最初の0xaaを取り除く | |
tail -c +2 output > output.ppm | |
# シミュレータでの(仮想的な)コア数を変更するには、sim.hの最初の方にあるマクロ N_CORE の値を変更する | |
cd ../../.. | |
# コア | |
git clone https://github.com/cpuex2016D/computer.git | |
# acc命令の順序制御をしない7コアのバージョンがmasterブランチになっている | |
# 以下の操作により、バイナリの命令とデータをテキストに変換する (変換後のファイルは既に computer/2nd/ に含まれているので、この操作は不要) | |
# cd computer/2nd/program | |
# gcc -o convert_text convert_text.c | |
# gcc -o convert_data convert_data.c | |
# ./convert_text < ../../../simulator/assembler/2nd/parent.text > ../parent.text.hex | |
# ./convert_text < ../../../simulator/assembler/2nd/child.text > ../child.text.hex | |
# ./convert_text < ../../../simulator/assembler/2nd/data > ../data.hex | |
# ./convert_data < ../../../simulator/assembler/2nd/data > ../data.coe | |
vivado | |
# 以下、Vivado 2015.4.2 GUIでの操作手順 | |
# Create New Project | |
# Next | |
# Project nameを適当に設定し、Project locationに computer/2nd を選び、Create project subdirectoryのチェックを外し、Next | |
# RTL Projectを選び、Do not specify sources at this timeのチェックを外し、Next | |
# (Add Sources) Add Filesで、computer/2nd/ 直下にある、下の3つを除く全ての.sv, .vhファイルを選び、Next | |
# _data_mem.sv | |
# add_sub_tb.sv | |
# top_tb.sv | |
# (Add Existing IP) Add Directories で computer/2nd/computer.srcs/sources_1/ip を選び、Next | |
# (Add Constraints) Add Filesで computer/2nd/computer.xdc を選び、Next | |
# (Default Part) Boardsの Kintex-Ultrascale KCU105 Evaluation Platform を選び、Next | |
# Finish | |
# (プロジェクトが開く) | |
# Implementation SettingsのStrategyで Performance_Exploreを選び、OK | |
# 左上の窓の下のタブで IP Sources を選び、全てのIPを選択し、右クリックで Generate Output Products を選び、Out of context per IP で Generate | |
# なぜかエラーになるが、もう一度同じ操作をするとうまくいく | |
# (数分待つ) | |
# Generate Bitstream (おそらく1時間以上かかる) | |
# acc命令の順序制御をする6コアのバージョンを試す場合 | |
cd computer | |
git checkout 2nd/minrt_par_ord/6core_noring | |
# 再度 Generate Bitstream (30分程度かかる) | |
# 実行方法 | |
# オリジナルのcserverは/dev/ttyUSB0から使おうとするが、/dev/ttyUSB1を使ってほしいので、 | |
# com_linux.cの103行目 for (i = 0; i < 5; ++i) を for (i = 1; i < 5; ++i) に書き換える | |
./cserver -B 460800 contest.sld output.ppm | |
# 0xaaを待ち受けている状態で Program Device する (プログラムはROMに内蔵されているので、Program Deviceが完了次第動作する) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment