L5 - Combinational Logic Design With Verilog
L5 - Combinational Logic Design With Verilog
Reading Assignment
Brown and Vranesic
2 Introduction to Logic Circuits
2.10 Introduction to Verilog
2.10.1 Structural Specification of Logic Circuits 2.10.2 Behavioral Specification of Logic Circuits 2.10.3 How Not to Write Verilog Code
July 8, 2009
Reading Assignment
Brown and Vranesic (cont) 1st edition only!
4 Optimized Implementation of Logic Functions
4.12 CAD Tools
4.12.1 Logic Synthesis and Optimization 4.12.2 Physical Design 4.12.3 Timing Simulation 4.12.4 Summary of Design Flow 4.12.5 Examples of Circuits Synthesized from Verilog Code
July 8, 2009
Programmable Logic
Provides low cost and flexibility in a design
Replace multiple discrete gates with single device Logical design can be changed by reprogramming the device
No change in board design
Logical design can be changed even after the part has been soldered onto the circuit board in modern, In-system programmable device Inventory can focus on one part
Multiple uses of same device
July 8, 2009 ECE 152A - Digital Design Principles 4
Programmable Logic
Evolution of Programmable Logic
Both in time and complexity ROMs and RAMs
Not strictly programmable logic, but useful in implementing combinational logic and state machines
PALs
PALs Programmable Array Logic PLAs Programmable Logic Array GALs Generic Logic Array
July 8, 2009
Programmable Logic
PLDs
Programmable Logic Device
PLDs are (in general) advanced PALs
CPLDs
Complex Programmable Logic Device
Multiple PLDs on a single chip
FPGAs
Field Programmable Gate Array
July 8, 2009
Design Entry
In previous examples, design entry is schematic based
TTL implementation using standard, discrete integrated circuits PLD implementation using library of primitive elements
Code based design entry uses a hardware description language (HDL) for design entry
Code is synthesized and implemented on a PLD
July 8, 2009
Verilog Design
Structural Verilog
Looks like the gate level implementation
Specify gates and interconnection
July 8, 2009
Verilog Design
RTL (Register Transfer Level) Verilog
Allows for top down design No gate structure or interconnection specified Synthesizable code (by definition)
Emphasis on synthesis, not simulation
vs. high level behavioral code and test benches
July 8, 2009
July 8, 2009
10
Verilog Syntax
Modules are the basic unit of Verilog models
Functional Description
Unambiguously describes modules operation
Functional, i.e., without timing information
Input, Output and Bidirectional ports for interfaces May include instantiations of other modules
Allows building of hierarchy
July 8, 2009
11
Verilog Syntax
Module declaration
module ADD_HALF (s,c,x,y);
Parameter list is I/O Ports
Port declaration
Can be input, output or inout (bidirectional)
output s,c; input x,y;
July 8, 2009
12
Verilog Syntax
Declare nodes as wires or reg
Wires assigned to declaratively Reg assigned to procedurally
More on this later
In a combinational circuit, all nodes can, but dont have to be, declared wires
Depends on how code is written
July 8, 2009
13
Verilog Syntax
Gates and interconnection
xor G1(s,x,y); and G2(c,x,y);
Verilog gate level primitive
Gate name
Parameter list
Output port, input port, input port
July 8, 2009
14
Gate Instantiation
Verilog Gates
Note: notif and bufif are tri-state gates
July 8, 2009
15
Verilog Syntax
Close the module definition with
endmodule
July 8, 2009
16
Output
00
01
01
10
July 8, 2009
18
July 8, 2009
19
July 8, 2009
20
10
Output
00
01
01
10
01
10
10
11
July 8, 2009
22
11
Verilog Operators
The Verilog language includes a large number of logical and arithmetic operators
Bit length column indicates width of result
July 8, 2009
23
July 8, 2009
24
12
July 8, 2009
25
July 8, 2009
26
13
July 8, 2009
27
July 8, 2009
28
14
July 8, 2009
29
July 8, 2009
30
15
Testbench
Provides stimulus to DUT
Like test equipment on a bench
July 8, 2009
32
16
July 8, 2009
33
17