Module #01 - Introduction To Verilog HDL
Module #01 - Introduction To Verilog HDL
• Verilog HDL is one of the two most common Hardware Description Languages (HDL) used by
integrated circuit (IC) designers. The other one is VHDL.
n c e
e
• Designs described in HDL are technology-independent, easy to design and debug, and are usually
c e l
more readable than schematics, particularly for large circuits.
l
• Verilog is used as an input for synthesis programs which will generate a gate-level description (a
x
netlist) for the circuit.
S I E
• The way the code is written will greatly effect the size and speed of the synthesized circuit
• Some Verilog constructs are not synthesizable. (eg. delay)
L
• Non-synthesizable constructs should be used only for test benches.
V
Note: “Verilog is NOT a Programming Language. It is a Hardware Description Language !!!”
n c e
e
1) Structural, which is a verbal wiring diagram without storage.
Example 1.1:
assign a=b & c | d;
c e l l
x
assign d = e & (~c);
logic.
S I E
2) Procedural, which is used for circuits with storage, or as a convenient way to write conditional
L
Example 1.2:
V
always @(posedge clk) // Execute the next statement on every rising clock edge.
count <= count+1;
• if and case statements are only allowed in procedural code. As a result, the synthesizers have been
constructed which can recognize certain styles of procedural code as actually combinational.
n c e
e
(i) Switch level (the switches are MOS transistors inside gates).
(ii) Gate level (interconnected AND, NOR etc.).
c e l l
(iii) Register transfer level/Data Flow Level (RTL uses registers connected by Boolean equations).
x
(iv) Algorithmic level/Behavioral Level (much like c code with if, case and loop statements).
S I E
V L
26-11-2022 VLSI Excellence - Gyan Chand Dhaka 3
Module #01 : Introduction to Verilog HDL
(i) Switch level (the switches are MOS transistors inside gates).
n c e
Example 1.3:
e l l e
c
module inverter (IN, OUT);
x
input IN;
output OUT;
supply0 VSS;
S I E
L
supply1 VDD;
V
pmos p(OUT, VDD, IN);
nmos n (OUT, VSS, IN);
endmodule
n c e
Example 1.4:
e l l eA
Y1
c
module myDesign(A, B, Y); B
input A;
input B;
I E x A
S
output Y; Y2
L
and A1(Y1, A,B); B
endmodule
V
nand NA1(Y2, A, B);
or O1(Y3, A,B); A
B
Y3
n c e
e l lA
e 0
c
Example 1.5:
x
module myDesign(A, B, SEL, mux_out); mux_out
input A, B, SEL;
output mux_out;
S I E
L
assign mux_out = (SEL` & A) + (SEL & B); B 1
V
endmodule
SEL
n c e
e
Design Behavior
l l
Example 1.6:
e
module myDesign(A, B, SEL, mux_out); Verilog Modeling
input A, B, SEL;
output mux_out;
E x c
reg mux_out;
L
always @(A, B, SEL)
S I if (SEL = 1) mux_out = B;
V
begin
else mux_out = A;
if(SEL)
mux_out = B;
else
mux_out = A;
end