- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can anyone explain why the simulator shows the following output for the below verilog code :
Output : run # 0x Thanks a ton in advance! ---------------------------- `timescale 10ns/ 1ns module toy ( a, sel, y ); input a,sel; output y; reg y; initial $monitor ( $time, y ); initial begin # 20 y = 1'b1; # 11.1 y = 1'b0 ; end endmoduleLink Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Can anyone explain why the simulator shows the following output for the below verilog code : Output : run # 0x Thanks a ton in advance! ---------------------------- `timescale 10ns/ 1ns module toy ( a, sel, y ); input a,sel; output y; reg y; initial $monitor ( $time, y ); initial begin #0 y = 1'b0; #20 y = 1'b1;# 11.1 y = 1'b0 ; end endmodule --- Quote End --- Hi, the signal y is not defined from 0 until 20ns. Thats why you got the 0x. Kind regards GPK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
run the simulation for 400ns.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply to both of you :)
Yea i find that if I issue "run 400" it shows the complete simulation result. That means that when we are issuing "run" command, the compiler executes only uptil a certain time instant .... And that's now a concern...how does the compiler decide this time for which simulation is done for a single "run" command. One observation is , if I change the timescale to : 'define timescale 1ns/1ns and then do : run I get the complete results at once....ie at least upto simulation time 31 ns.... run # 0 x # 20 1 # 31 0 So the question that bothers is how we know what is this timestep that "run" command executes for ? Thanks a lot again !- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well you are asking me to dig pretty deep into memory but I believe the "run" command alone will run a single timestep. In your case that is 10ns.
If you want to run the simulator to the end of the simulation you issue a "run all" command. However, you must define what the "end" of the simulation is. Typically the end is indicated by either a "$finish" or "$stop" directive in your testbench. If you don't have something to stop the simulation in the testbench, it will run indefinitely. Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jake for the reply.
But then in the second case when I have set timescale as 1ns/1ns , then since I have set the time-step as 1ns , issuing "run" once should have then shown the simulation results uptil 1 ns only, right ? But when I try this on Modelsim ( ie issue "run" once ) , it shows the complete simulation data ...ie upto 31 ns. Please correct me if am wrong somewhere. Many Thanks.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well I told you that you were asking me to dig deep. Have a look at the reference manual for Modelsim:
http://www.actel.com/documents/modelsim_cmd_ref_ug.pdf The run command syntax can be found on page 170. Now, I had to wipe my machine last week and re-install everything and I haven't reloaded ModelSim just yet. Otherwise I think I could answer your question precisely. But up in the toolbar is a little number spinner box that specifies the run length. I believe when you type run, it runs for the length of time specified in that box. It sounds like you can control this value from the modelsim.ini file. Is there any particular reason why you wouldn't just specify how long you want the simulation to run when you issue the run command? Jake- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jake very much for your replies. It was really helpful !
Now I understand that the value setting inside modelsim.ini controls the time step when we issue "run". Until before your last reply, I was thinking what is the thing that is controlling the time-step ! Now the mystery is resolved. Many thanks for your help and time! Best Regards!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page