How to simulate a dut including parameters overall?

21 views
Skip to first unread message

Sand Glass

unread,
Aug 5, 2016, 9:30:37 AM8/5/16
to ModelSim PE Student Edition
First Given a case:
test.v 
module test( 
a,b 
); 
parameter AA = 1; 
input a; 
output b; 
assign b = AA==1'b1 ? a : 0; 
endmodule 

tb.v 
module tb(); 
parameter PAR_A = 0; 
//int width; 
//scanf(width); 
//if(width == 10)PAR_A=0; 
//else if(width == 20)PAR_A=1; 

test #(.AA(PAR_A)) test_dut( 
  .a(1'b1), 
  .b() 
); 
endmodule 

When I simulating the test.v, I need to simulate variable cases, like 
PAR_A = 1, PAR_A=0, PAR_A = other value. 
How can I do it automatically(like the upper commented code block)? 
The environment(modelsim SE) support systemveilog, but tb.v cannot be changed to tb.sv

Reply all
Reply to author
Forward
0 new messages