hdl1 - TAMU Computer Science Faculty Pages

Download Report

Transcript hdl1 - TAMU Computer Science Faculty Pages

The Design Process
CPSC 321 Computer Architecture
Andreas Klappenecker
Administrative Issues



October 10, project deadline
October 17, midterm exam
Office hours



Klappenecker TW 2:00pm-3:00pm
Bhojwani M 10:00-11:00am, T 1:00-2:00pm
Goyal W 2:00-4:00pm
Levels of Abstraction


Specification
Architectural Description


Logic Design


Gates and Registers
Circuit Design



Verilog, VHDL, ELLA or other HDLs
Transistors sized for power and speed
Technology mapping
Layout
Levels of Abstraction
System
Module
Gate
Circuits
Device

+
G
S
n+
D
n+
MOS Transistors

PMOS transistor




like a switch
ON if gate is 1
OFF if gate is 0
Current Flow
Source (+)
Drain (-)
NMOS transistor


OFF if gate is 1
ON if gate is 0
Drain (+)
Source (-)
CMOS Circuits




Simple
Avoids difficulties
Resilient
Energy efficient

Current flow only during
switching time
Circuit Design
Layout
Layering and
Fabrication
Hardware Description Languages


Abstracting from circuits
Structural description


Behavioral description



Specify full adder by NAND and NOR gates
Specify full adder by functional behavior
Improves productivity
Natural for Computer Scientists
Verilog

Structural description



Gates, wires, input/output
Hierarchical description possible
(define full adder in terms of gates)
Behavioral description


Abstract formulation
Functional relationships
Structural Verilog Example
module mux(f, a,b,sel);
output f;
input a,b,sel;
wire f1, f2;
not(nsel,
sel);
and(f1, a,nsel);
and(f2, b, sel);
or (f, f1,
endmodule
f2);
b
a
sel
f
Behavioral Verilog Example
module mux2(f, a,b,sel);
output f;
input a,b,sel;
assign f = (a & ~sel) | (b & sel);
endmodule
Another Example
module mux2(f, a,b,sel);
output f;
input a,b,sel;
reg f;
always @(a or b or sel)
if (sel==1)
f = b;
else
f = a;
endmodule
Synthesis

Compilation


Optimization



Verilog code is translated into
a network of logic gates
Try to find a better solution by logic
optimization (limited success)
Technology mapping
Physical design
Logic Gates






and(y, a, b)
or(y, a, b)
not(y, a)
xor(y, a,b)
nand(y, a, b)
…
Modules
module mod_name (parameters);
input …
output …
reg …
……
endmodule
Full Adder
module fulladd(cin, x, y, s, cout)
input cin, x, y;
output s, cout;
assign s = x ^ y ^ cin;
assign cout = (x & y) | (cin & x) | (cin & y);
endmodule
Full Adder
module fulladd(cin, x,y,s, cout);
input cin, x, y;
output s, cout;
assign { cout, s } = x + y + cin;
Endmodule
The assign statement sets cout to MSB and s to LSB
Conclusions




Verilog will be the language for our next
projects
Verilog compilers are freely available
Programming in a HDL differs from
software programming
Higher level of abstraction allows to
develop large circuits