risc cpu @ systemc
轉貼自http://funningboy.blogspot.com/2010/09/risc-cpu-systemc.html?showComment=1317181463530#c126477895408032611
因為原來在systemc-2.2.0的example下的risc_cpu
Compile後,run simulation,會有錯誤發生
所以作者將它修正後,提供下載
hi all, If you are interest in the CPU architecture design,i think the '
rsic cpu' is a good choice.It is a sample package in
systemc example, but it contain some problems with multi-drive. What's the multi-drive, it means the multi inputs drive the same output. you can image the data in this point is unstable, it should be 1 or 0 or x.... ,so the compiler would confuse what's the data in it.Because in
systemc is no wire definition, in '
sc_signal' declare it like the register or buffer design, it would keep the current data until the next trigger to change it's data. we use a very sample way to avoid it, to create a new module and change the declare of '
sc_signal' to '
sc_in' and '
sc_out' . all new packages and version is release in
here please use this command to compile our package.
原作者修正問題後的Package下載點
https://sites.google.com/site/funningboy/c/2010_1003_risc_cpu.tar.gz?attredirects=0&d=1
使用以下指令去compile risc_cpu files
g++ *.cpp -I/usr/systemc/include -L/usr/systemc/lib-linux -o cpu -lsystemc
如果是64bits
g++ *.cpp -I/usr/systemc/include -L/usr/systemc/lib-linux64 -o cpu -lsystemc
修正的方法
1 fix lists 1. multi drive example Error: (E115) sc_signal cannot have more than one driver: signal `STALL_FETCH' (sc_signal) first driver `PAGING_BLOCK.port_13' (sc_out) second driver `BIOS_BLOCK.port_6' (sc_out) In file: ..\..\src\sysc\communication\sc_signal.cpp:126 2. data cache miss the environment of dcache is unconnected, we replace it by mem architecture,that can be work on "lw,sw" commands 3. branch && jump conditions not work fix the program counter to jump && branch condition
執行的方法
2. how to use
perl assembler.pl test2.asm -code > icache
perl assembler.pl test2.asm > view
./cpu