l3_combi_veri(1).pdf

(319 KB) Pobierz
No Slide Title
L3: Introduction to Verilog
Verilog
(Combinational Logic)
Acknowledgements :
Materials in this lecture are courtesy of the following sources and are used with
permission.
Rex Min
Verilog References:
Samir Palnitkar, Verilog HDL , Pearson Education (2nd edition).
Donald Thomas, Philip Moorby, The Verilog Hardware Description Language , Fifth
Edition, Kluwer Academic Publishers.
J. Bhasker, Verilog HDL Synthesis (A Practical Primer) , Star Galaxy Publishing
L3: 6.111 Spring 2006
Introductory Digital Systems Laboratory
L3: Introduction to
(Combinational Logic)
 
287138339.013.png 287138339.014.png 287138339.015.png
Synthesis and HDLs
HDLs
Hardware description language (HDL) is a convenient, device-
independent representation of digital logic
Verilog
input a,b;
output sum;
assign sum <= {1b’0, a} + {1b’0, b};
Compilation and
Synthesis
HDL description is compiled
into a netlist
Netlist
Synthesis optimizes the logic
g1 "and" n1 n2 n5
g2 "and" n3 n4 n6
g3 "or" n5 n6 n7
Mapping targets a specific
hardware platform
Mapping
FPGA
PAL
ASIC
(Custom ICs)
L3: 6.111 Spring 200
Introductory Digital Systems Laboratory
5
Synthesis and
287138339.001.png 287138339.002.png 287138339.003.png
The FPGA: A Conceptual View
An FPGA is like an electronic breadboard that is wired together
by an automated synthesis tool
Built-in components are called macros
32
32
+
SUM
DQ
32
sel
interconnect
counter
a
b
c
d
LUT
F(a,b,c,d)
G(a,b,c,d)
ADR
RAM
DATA
R/W
(for everything else)
L3: 6.111 Spring 2006
Introductory Digital Systems Laboratory
6
287138339.004.png 287138339.005.png 287138339.006.png
Synthesis and Mapping for FPGAs
FPGAs
Infer macros: choose the FPGA macros that efficiently
implement various parts of the HDL code
...
always @ (posedge clk)
begin
count <= count + 1;
“This section of code looks
like a counter. My FPGA has
some of those...”
counter
end
...
HDL Code
Inferred Macro
Place-and-route: with area and/or speed in mind, choose
the needed macros by location and route the interconnect
M
M
M
M
M
M
M
M
M
M
M
M
M
M
“This design only uses 10% of
the FPGA. Let’s use the macros
in one corner to minimize the
distance between blocks.”
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
M
L3: 6.111 Spring 2006
Introductory Digital Systems Laboratory
7
Synthesis and Mapping for
287138339.007.png 287138339.008.png 287138339.009.png
Verilog : The Module
: The Module
Verilog designs consist of
interconnected modules .
a
1
out
A module can be an element or
collection of lower level design blocks.
b
0
outbar
A simple module with combinational
logic might look like this:
sel
Out = sel a + sel b
2-to-1 multiplexer with inverted output
module mux_2_to_1(a, b, out,
Declare and name a module; list its
ports. Don’t forget that semicolon.
outbar, sel);
// This is 2:1 multiplexor
Comment starts with //
Verilog skips from // to end of the line
input a, b, sel;
Specify each port as input, output,
or inout
output out, outbar;
assign out = sel ? a : b;
Express the module’s behavior.
Each statement executes in
parallel; order does not matter.
assign outbar = ~out;
endmodule
Conclude the module code.
L3: 6.111 Spring 2006
Introductory Digital Systems Laboratory
8
Verilog
287138339.010.png 287138339.011.png 287138339.012.png
Zgłoś jeśli naruszono regulamin