EE-410 FPGA Based System Design: Hardware Description Language
EE-410 FPGA Based System Design: Hardware Description Language
EE-410
FPGA Based System Design
VERILOG PROGRAMMING
1
3/25/2020
History of Verilog
In 1980s, originally developed by Gateway Design Automation.
Verilog Usage
Verilog may be used to model circuits and behaviors at
various levels of abstraction:
2
3/25/2020
3
3/25/2020
wire g,h,i; b
F = AB + B'C
and (g,a,b);
h i
not (h,b);
c
and (i,h,c);
or (f,g,i);
// Data Flow Modeling
endmodule
module ex1 (a,b,c,f);
input a,b,c;
output f;
assign f = (a&b) | (~b&c);
endmodule
7 Wednesday, March 25, 2020
4
3/25/2020
Basic Gates
Verilog supports basic logic gates as predefined primitives.
There are two classes of basic gates: and/or gates and buf/not gates.
And/or gates have one scalar output and multiple scalar inputs
The first terminal in the list of gate terminals is an output and the
other terminals are inputs.
Example 1: Gate Instantiation of And/Or Gates
wire OUT, IN1, IN2;
and a1(OUT, IN1, IN2);
xnor (OUT, IN1, IN2);
// More than two inputs;
// 3 input nand gate
nand (OUT, IN1, IN2, IN3);
5
3/25/2020
Buf/Not Gates
Buf/not gates have one scalar input and one or more scalar outputs
The last terminal in the port list is connected to the input. Other
terminals are connected to the outputs
Basic buf/not gate primitives in verilog are buf not
Buf/not gates with additional
control signal are
bufif1, notif1, bufif0, notif0
buf not
0 0 0 1
1 1 1 0
x x x x
z x z x
has 1 or z value. x z x x x x z x x x
as a transition to x.
Ctrl Ctrl
Examples bufif0 notif0
0 1 x z 0 1 x z
//Instantiation of bufif gates.
0 0 z L L 0 1 z H H
bufif1 b1 (out, in, ctrl);
1 1 z H H 1 0 z L L
bufif0 b0 (out, in, ctrl); in in
x x z x x x x z x x
//Instantiation of notif gates
z x z x x z x z x x
notif1 n1 (out, in, ctrl);
notif0 n0 (out, in, ctrl); x={0,1,z} L={0,z} H={1,z}
12 Wednesday, March 25, 2020