Verilog HDL Tutorial: Winter 2003
Verilog HDL Tutorial: Winter 2003
Winter 2003
University of Washington
ACME Lab
Brigette Huang
System Modeling:
describe the system in gate-level, data-flow, or
behavioral style…
endmodule
09/02/21 Brigette Huang - Autumn 2002 6
Basic Module Construction
// Compute the logical AND and OR of inputs A
and B.
AND_OR
A
andOut
TheAndGate
orOut
B
TheOrGate
D3 T3
D2 T2
Z
D1 T1
D0 T0
S0
S1
Z[0]
A
Z[1]
B Z[2]
EN Z[3]
Input A,B,EN;
output [0:3] Z;
wire Ab, Bb;
assign #1 Ab=~A;
assign #1 Bb=~B;
assign #2 Z[0]=~(Ab & Bb & EN);
assign #2 Z[1]=~(Ab & B & EN);
assign #2 Z[2]=~(A & Bb & EN);
assign #2 Z[3]=~(A & B & EN);
endmodule
09/02/21 Brigette Huang - Autumn 2002 15
Behavioral Modeling
• The behavior of a design is described
using procedural constructs. These are:
– Initial statement: This statement executes
only once.
– Always statement: this statement always
executes in a loop forever…..
• Only register data type can be assigned
a value in either of these statements.
• Special thanks to
Professor Peckol and Professor Hauck for
their support and the tutorial documents
they provided…..
09/02/21 Brigette Huang - Autumn 2002 21