Latches + Behavioural
Modelling Tutorial
Manan Nandha
Hrishant Bheda
SR Latch
D Latch
Verilog Modeling Styles
● Gate-level modeling: Describes circuits with logic gates (and, or, not).
● Dataflow modeling: Uses continuous assignments and operators (assign out
= a & b;).
● Behavioral modeling: Describes what the circuit should do, not how it’s built.
● Behavioral = closest to writing pseudo-code → compiler synthesizes hardware.
What is behavioural modelling?
This approach focuses on describing the behavior of the system rather than the
specific [Link] allows you to specify the logic of the system using higher-level
constructs like if, case, and loops. Structural Modeling describes the hardware by
specifying how different components (modules, gates, etc.) are connected. It mirrors
the actual physical circuit.
Structural - WHAT
Behavioural - HOW
Always Block
Defined using always @(sensitivity_list)
Executed whenever signals in sensitivity list change.
begin and end are like opening and closing parenthesis in a code.
In the given example y is updated to the value of a&b whenever input a or input b
changes.
Procedural Statements
wire in Structural vs reg in Behavioral
Structural Modeling Behavioral Modeling
● Outputs are driven by continuous ● Outputs are assigned inside an always
assignments (assign) or gate primitives. block.
● Hence, outputs are usually wire type. ● always requires storage → must be
declared reg.
Please refer to the shared verilog code to see the
behavioral implementation of SR latch and D latch.
For the next lab please prepare mux, decoder,
encoder and other modules covered in class.