mirror of
https://github.com/ljgibbslf/SM3_core.git
synced 2024-08-18 19:54:12 +08:00
add EpicSim support(trial run)
This commit is contained in:
parent
8adbabbb19
commit
7856acdda2
@ -70,4 +70,16 @@
|
||||
//显式例化 CSA 加法器 在 SM3_CMPRSS_DIRECT_ADD 未定义时有效
|
||||
`ifndef SM3_CMPRSS_DIRECT_ADD
|
||||
`define SM3_CMPRSS_CSA_ADD
|
||||
`endif
|
||||
`endif
|
||||
|
||||
//定义仿真器 define simulator
|
||||
// Modelsim_10_5(windows), default
|
||||
// EpicSim (Linux)
|
||||
//`define EPICSIM
|
||||
`ifndef EPICSIM
|
||||
`define MODELSIM_10_5
|
||||
`endif
|
||||
|
||||
//定义是否使用 C 语言参考模型(DPI)
|
||||
//define using C reference model or not
|
||||
//`define C_MODEL_ENABLE
|
5
sim/script/epicsim_sm3_core_top_tb.sh
Normal file
5
sim/script/epicsim_sm3_core_top_tb.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#epicsim_sm3_core_top_tb.sh
|
||||
#@ljgibbs / lf_gibbs@163.com
|
||||
#usage: script for running tb_sm3_core_top.sv with EpicSim, a opensource simulator
|
||||
|
||||
epicsim -g2005-sv ../tb/tb_sm3_core_top.sv -I ../../rtl/inc/ -L ../../rtl/
|
@ -14,6 +14,7 @@
|
||||
// Revision 0.01 - File Created
|
||||
// Revision 0.02 - Pass random test with c model
|
||||
// Revision 0.03 - Pass random test with c model (64bit)
|
||||
// Revision 0.03 - Add more macro control
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
module tb_sm3_core_top (
|
||||
);
|
||||
@ -26,8 +27,10 @@ module tb_sm3_core_top (
|
||||
bit [63:0] urand_num;
|
||||
`endif
|
||||
|
||||
`ifdef C_MODEL_ENABLE
|
||||
//import c reference function
|
||||
import "DPI-C" function void sm3_c(input int len,input bit[7:0] data[],output bit[31:0] res[]);
|
||||
`endif
|
||||
|
||||
int i;
|
||||
bit [7:0] data[1050];//TODO buff length limit the inpt data length
|
||||
@ -70,7 +73,11 @@ initial begin
|
||||
`endif
|
||||
|
||||
@(posedge sm3if.clk);
|
||||
task_rndm_inpt_cmpr_cmodel(sm3_inpt_byte_num);
|
||||
`ifdef C_MODEL_ENABLE
|
||||
task_rndm_inpt_cmpr_cmodel(sm3_inpt_byte_num);
|
||||
`else
|
||||
task_pad_inpt_gntr_exmpl0_32();
|
||||
`endif
|
||||
@(posedge sm3if.clk);
|
||||
end
|
||||
|
||||
@ -79,6 +86,7 @@ end
|
||||
|
||||
always #5 sm3if.clk = ~sm3if.clk;
|
||||
|
||||
`ifdef C_MODEL_ENABLE
|
||||
//产生填充模块输入,随机输入,并与 c 语言参考模型比较
|
||||
task automatic task_rndm_inpt_cmpr_cmodel(
|
||||
input bit [60:0] byte_num
|
||||
@ -189,7 +197,7 @@ task automatic task_rndm_inpt_cmpr_cmodel(
|
||||
foreach(res[i])
|
||||
$display("C model output %d:%x", i,res[i]);
|
||||
endtask //automatic
|
||||
|
||||
`endif
|
||||
|
||||
//产生填充模块输入,采用示例输入 'abc' 32bit 输入
|
||||
task automatic task_pad_inpt_gntr_exmpl0_32();
|
||||
|
Loading…
x
Reference in New Issue
Block a user