Event driven Verilog simulations

  • Thread starter Thread starter lostinxlation
  • Start date Start date
  • Tags Tags
    Simulations
Click For Summary
SUMMARY

Event-driven Verilog simulations rely on the timing of events to determine the state of signals. In the provided example, the wire 'inv_s1' does not maintain a state between events; it reflects the current value of 'in' at the time of the event. When 'in' changes, 'inv_s1' updates accordingly, but it does not hold a value until the next event occurs. At the specified time of #25 in the simulation, 'inv_s1' will show the value corresponding to the last event affecting it, which is determined by the state of 'in' at that moment.

PREREQUISITES
  • Understanding of Verilog syntax and semantics
  • Knowledge of event-driven simulation concepts
  • Familiarity with signal types in Verilog (e.g., wire, reg)
  • Basic experience with simulation timing in Verilog
NEXT STEPS
  • Explore Verilog signal types in-depth, focusing on 'wire' and 'reg'
  • Learn about event scheduling and timing controls in Verilog simulations
  • Investigate the behavior of combinational vs. sequential logic in Verilog
  • Practice writing and simulating more complex Verilog modules to observe event-driven behavior
USEFUL FOR

Verilog developers, digital design engineers, and students learning about hardware description languages and event-driven simulation techniques.

lostinxlation
Messages
38
Reaction score
0
I know Veriog simulators are event-driven and what matters is the moment that event happens.

Suppose we have a code like,

module inv (in, out);
input in;
output out;

wire inv_s1;
reg out;
assign inv_s1 = ~in;
assign out = ~inv_s1;

endmodule

My question is does inv_s1 maintains any state between the events ?
Let's say in=0 initially, and it gets changed to in=1. It propagates through inv_s1 and changes the state of 'out'. 'out' is declared as reg so that it maintains some state all the time, but what happens to inv_s1 which is declared as wire once the event settles ?
Does it still maintain the value 0, or it has no value or state assigned till the next event happens ?

More specifically, what value am I supposed to see on inv_s1 if I poke inv_s1 at #25 in the following simulation ?

initial begin
#10 in = 0;
#10 in = 1;
#10 in = 0;
#10 $finish;
end
 
Engineering news on Phys.org
Verilog is a time-based simulation. Therefore, it must recognize state.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
2
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
1K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K