R8051_simulation

1 下载

git clone https://github.com/risclite/R8051.git

 

2 编辑文件

mkdir work && mv sim tb 

 

flist

../rtl/r8051.v
../tb/tb.v

  

makefile:

com:
        irun -f flist -incdir ../rtl -timescale 1ns/1ns

  

 

3  仿真

make com 

LCALL_FUNC
RET_FUNC
RETI_FUNC
AJMP_FUNC
SJMP_FUNC
JMP_FUNC
JZ_FUNC
JNZ_FUNC
CJNE_A_DI_REL
CJNE_A_DA_REL
CJNE_RN_DA_REL
CJNE_RI_DA_REL
DJNZ_RN_REL
DJNZ_DI_REL
Test success!
Test finished!
Test over, simulation is OK!
Simulation stopped via $stop(1) at time 1525335 NS + 0
../tb/tb.v:101          $stop(1);

  

 

4 说明

代码中将stdio.h里的printf重构,printf其实是往SFR_99这个地址写字符串,然后通过tb监测sfr_99的写入值,并$write出来。

109 always @ ( posedge clk )                                                                                            
110 if ( ram_wr_en_sfr & ( ram_wr_addr[7:0]==8'h99 ) )
111     $write("%s",ram_wr_byte);
112 else;

  

  

上一篇:聊聊 rel=noopener


下一篇:装饰器作业