Lec06 hdl1 4up
Lec06 hdl1 4up
Lec06 hdl1 4up
• Netlists
• Design flow
• What is a HDL?
EECS150 - Digital Design • Verilog
Lecture 6 - Hardware Description – history
– examples
Languages
February 6, 2003
John Wawrzynek
Spring 2003 EECS150 - Lec06-HDL Page 1 Spring 2003 EECS150 - Lec06-HDL Page 2
Spring 2003 EECS150 - Lec06-HDL Page 3 Spring 2003 EECS150 - Lec06-HDL Page 4
1
Design Flow Design Flow
Design • Circuit is described and Design • High-level Analysis is used to
Entry represented: Entry verify:
– Graphically (Schematics) – correct function
– Textually (HDL) – rough:
High-level • Result of circuit specification High-level • timing
Analysis (and compilation) is a netlist of: Analysis • power
– generic primitives - logic gates, • cost
flip-flops, or • Common tools used are:
– technology specific primitives - – simulator - check functional
Technology LUTs/CLBs, transistors, Technology correctness, and
discrete gates, or
Mapping Mapping – static timing analyzer
– higher level library elements -
• estimates circuit delays based
adders, ALUs, register files,
on timing model and delay
decoders, etc.
Low-level Low-level parameters for library elements
(or primitives).
Analysis Analysis
Spring 2003 EECS150 - Lec06-HDL Page 5 Spring 2003 EECS150 - Lec06-HDL Page 6
Spring 2003 EECS150 - Lec06-HDL Page 7 Spring 2003 EECS150 - Lec06-HDL Page 8
2
Design Entry HDLs
• Schematic entry/editing used to • Basic Idea: • “Structural” example:
– Language constructs describe Decoder(output x0,x1,x2,x3;
be the standard method in inputs a,b)
industry circuits with two basic forms: {
– Structural descriptions similar to wire abar, bbar;
• Used in EECS150 until last year hierarchical netlist. inv(bbar, b);
☺ Schematics are intuitive. They – Behavioral descriptions use higher- inv(abar, a);
nand(x0, abar, bbar);
match our use of gate-level or level constructs (similar to
nand(x1, abar, b );
block diagrams. conventional programming). nand(x2, a, bbar);
☺ Somewhat physical. They imply • Originally designed to help in nand(x3, a, b );
abstraction and simulation. }
a physical implementation.
– Now “logic synthesis” tools exist to • “Behavioral” example:
Require a special tool (editor). automatically convert from behavioral Decoder(output x0,x1,x2,x3;
inputs a,b)
Unless hierarchy is carefully descriptions to gate netlist. {
designed, schematics can be • Hardware Description Languages – Greatly improves designer case [a b]
(HDLs) are the new standard productivity. 00: [x0 x1 x2 x3] = 0x0;
confusing and difficult to follow. 01: [x0 x1 x2 x3] = 0x2;
– except for PC board design, – However, this may lead you to falsely 10: [x0 x1 x2 x3] = 0x4;
where schematics are still used. believe that hardware design can be 11: [x0 x1 x2 x3] = 0x8;
reduced to writing programs! endcase;
}
Spring 2003 EECS150 - Lec06-HDL Page 9 Spring 2003 EECS150 - Lec06-HDL Page 10
Spring 2003 EECS150 - Lec06-HDL Page 11 Spring 2003 EECS150 - Lec06-HDL Page 12
3
Announcements 2-to-1 mux behavioral description
// Behavioral model of 2-to-1
• Notes:
// multiplexor.
– behavioral descriptions use the
module mux2 (in0,in1,select,out);
keyword always followed by
input in0,in1,select; procedural assignments
output out; – Target output of procedural
// assignments must of of type reg
reg out; (not a real register)
always @ (in0 or in1 or select) – Unlike wire types where the
if (select) out=in1; target output of an assignment
else out=in0; may be continuously updated, a
reg type retains it value until a
endmodule // mux2
new value is assigned (the
assigning statement is executed).
Spring 2003 EECS150 - Lec06-HDL Page 13 Spring 2003 EECS150 - Lec06-HDL Page 14
Spring 2003 EECS150 - Lec06-HDL Page 15 Spring 2003 EECS150 - Lec06-HDL Page 16
4
Behavioral with Bit Vectors “Dataflow” Descriptions of Logic
//Behavioral model of 32-bit
// wide 2-to-1 multiplexor. • Notes: //Dataflow description of mux • Notes:
module mux32 (in0,in1,select,out);– inputs, outputs 32-bits wide module mux2 in0, in1, select, out); – dataflow modeling provides a way
input [31:0] in0,in1; input in0,in1,select; to describe combinational logic by
input select; its function rather than gate
output [31:0] out; output out;
structure (similar to Boolean
// assign out = (~select & in0)
expressions).
reg [31:0] out; | (select & in1);
always @ (in0 or in1 or select) – The assign keyword is used to
if (select) out=in1; endmodule // mux2 indicate a continuous assignment.
else out=in0; Whenever anything on the RHS
endmodule // Mux Alternative: changes the LHS is updated.
//Behavioral model of 32-bit adder.
module add32 (S,A,B); assign out = select ? in1 : in0;
input [31:0] A,B;
output [31:0] S;
reg [31:0] S;
//
always @ (A or B)
S = A + B;
endmodule // Add
Spring 2003 EECS150 - Lec06-HDL Page 17 Spring 2003 EECS150 - Lec06-HDL Page 18
5
Verilog does not turn hardware design into More Verilog Help
writing programs! • The lecture notes only cover the very basics of Verilog and
mostly just the conceptual issues.
• The fact that Verilog looks similar to programming • The Mano textbook covers Verilog with many examples.
languages fools some people into thinking that they can • The Bhasker book is a good tutorial.
design hardware by writing programs. Not so. On reserve in the Engineering
• Verilog is a hardware description language. The best way library (starting Friday).
to use it is to first figure out the circuit you want, then figure
out how to express it in Verilog.
• The behavioral constructs hide a lot of the circuit details
but you as the designer must still manage the structure,
data-communication, parallelism, and timing of your • The complete language specification from the IEEE is
design. Not doing so leads to very inefficient designs. available on the class website under “Refs/Links”
Spring 2003 EECS150 - Lec06-HDL Page 21 Spring 2003 EECS150 - Lec06-HDL Page 22