digital ic design flow: a quick look
DESCRIPTION
Digital IC Design Flow: A quick look. Pre-layout Simulation. Design Entry. Logical design (front-end CAD). Logic Synthesis. Post-layout Simulation. Physical design (back-end CAD). Floorplanning. Placement. Circuit Extraction. Routing. Design Methodology. VLSI Design Styles. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/1.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
1
Digital IC Design Flow: A quick look
Design Entry
Logic Synthesis
Floorplanning
Placement
Routing
Pre-layoutSimulation
Post-layoutSimulation
CircuitExtraction
Logical design (front-end CAD)
Physical design (back-end CAD)
![Page 2: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/2.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
2
Design Methodology
![Page 3: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/3.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
3
VLSI Design Styles
• Programmable Logic Devices• Standard Cell Based Design• Full Custom Design
![Page 4: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/4.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
4
Programmable Logic Devices
![Page 5: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/5.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
5
Programmable Logic Device Families
Source: Dataquest Logic
StandardLogic ASIC
ProgrammableLogic Devices(PLDs)
GateArrays
Cell-BasedICs
Full CustomICs
CPLDsSPLDs(PALs) FPGAs
AcronymsSPLD = Simple Prog. Logic Device PAL = Prog. Array of LogicCPLD = Complex PLDFPGA = Field Prog. Gate Array
Common ResourcesConfigurable Logic Blocks (CLB)
– Memory Look-Up Table– AND-OR planes– Simple gates
Input / Output Blocks (IOB)– Bidirectional, latches, inverters,
pullup/pulldownsInterconnect or Routing
– Local, internal feedback, and global
![Page 6: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/6.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
6
What is FPGA?
• Field Programmable Gate Arrays.• Array of logic cells connected via routing
channels.• Special I/O cells.• Logic cells are mainly lookup tables (LUT)
with associated registers.• Interconnection on SRAM basis or antifuse
elements.
![Page 7: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/7.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
7
Technology and Architecture Tradeoffs
• Antifuse elements• High density• Non volatile• Not reprogrammable
![Page 8: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/8.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
8
Contd.
• SRAM cells• Uses more space• Reconfigurable• Volatile, requires PROM
![Page 9: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/9.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
9
CPLDs and FPGAs
CPLD FPGA
Architecture PAL/22V10-like Gate array-likeMore Combinational More Registers + RAM
Density Low-to-medium Medium-to-high 0.5-10K logic gates 1K to 500K system gates
Performance Predictable timing Application dependent Up to 200 MHz today Up to 135MHz today
Complex Programmable Logic Device Field-Programmable Gate Array
![Page 10: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/10.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
10
Xilinx FPGA Routing
• 1) Fast Direct Interconnect - CLB to CLB• 2) General Purpose Interconnect - Uses switch matrix
CLB
CLB
CLB
CLB
SwitchMatrix
SwitchMatrix
![Page 11: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/11.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
11
Design Flow
XC4000XC4000XC4000
3
Design Entry in schematic, ABEL, VHDL, and/or Verilog. Vendors include Synopsys, Aldec (Xilinx Foundation), Mentor, Cadence, Viewlogic, and 35 others.
Implementation includes Placement & Routing and bitstream generation using Xilinx’s M1 Technology. Also, analyze timing, view layout, and more.
Download directly to the Xilinxhardware device(s) with
unlimited reconfigurations* !!
1
2
*XC9500 has 10,000 write/erase cycles
M1 Technology
![Page 12: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/12.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
12
Altera FPGA Family
• Altera Flex10K/10KE– LEs (Logic elements) have 4-input LUTS (look-up tables)
+1 FF.– Fast Carry Chain between LE’s, cascade chain for logic
operations.– Large blocks of SRAM available as well.
• Altera Max7000/Max7000A– EEPROM based, very fast (Tpd = 7.5 ns).– Basically a PLD architecture with programmable
interconnects.
![Page 13: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/13.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
13
Gate Array
![Page 14: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/14.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
14
Standard Cell Based Design
![Page 15: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/15.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
15
Introduction
• One of the most prevalent custom design styles.– Also called semi-custom design style.– Requires development of a full custom mask set.
• Basic idea:– All of the commonly used logic cells are developed,
characterized, and stored in a standard cell library. – A typical library may contain a few hundred cells
including inverters, NAND gates, NOR gates, complex AOI, OAI gates, D-latches, and flip-flops.
![Page 16: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/16.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
16
Contd.
– Each gate type can have multiple implementations to provide adequate driving capability for different fanouts.
• For instance, the inverter can have – standard size transistors, – double size transistors, and – quadruple size transistors
• The chip designer can choose the proper size to achieve high circuit speed and layout density.
![Page 17: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/17.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
17
Characteristic of the Cells
• Each cell is designed with a fixed height.– To enable automated placement of the cells, and – Routing of inter-cell connections.– A number of cells can be abutted side-by-side to form rows.
• The power and ground rails typically run parallel to the upper and lower boundaries of the cell.– Neighboring cells share a common power and ground bus. – nMOS transistors are located closer to the ground rail while
the pMOS transistors are placed closer to the power rail.• The input and output pins are located on the upper and
lower boundaries of the cell.
![Page 18: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/18.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
18
Layout of a Typical Standard Cell
![Page 19: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/19.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
19
Floorplan for Standard Cell Design
• Inside the I/O frame which is reserved for I/O cells, the chip area contains rows or columns of standard cells. – Between cell rows are channels for dedicated inter-
cell routing. – Over-the-cell routing is also possible.
• The physical design and layout of logic cells ensure that – When placed into rows, their heights match.– Neighboring cells can be abutted side-by-side, which
provides natural connections for power and ground lines in each row.
![Page 20: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/20.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
20
Contd.
![Page 21: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/21.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
21
Contd.
• After chip logic design is done using standard cells in the library:– The most challenging task is to place individual cells
into rows.– Interconnect them in a way that meets stringent
design goals in • circuit speed, • chip area, and • power consumption.
– Many advanced CAD tools for place-and-route have been developed and used to achieve the above goals.
![Page 22: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/22.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
22
Full Custom Design
![Page 23: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/23.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
23
Introduction
• The standard-cells based design is often called semi custom design.– The cells are pre-designed for general use and the
same cells are utilized in many different chip designs.
• In the full custom design, the entire mask design is done anew without use of any library. – The development cost of such a design style is
prohibitively high. – The concept of design reuse is becoming popular in
order to reduce design cycle time and cost.
![Page 24: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/24.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
24
Contd.
• The most rigorous full custom design can be the design of a memory cell.– Static or dynamic. – Since the same layout design is replicated, there
would not be any alternative to high density memory chip design.
• For logic chip design, a good compromise can be achieved by using a combination of different design styles on the same chip.– Standard cells, data-path cells and PLAs.
![Page 25: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/25.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
25
Contd.• In real full-custom layout in which the
geometry, orientation and placement of every transistor is done individually by the designer,– Design productivity is usually very low.
• Typically 10 to 20 transistors per day, per designer.
• In digital CMOS VLSI, full-custom design is rarely used due to the high labor cost. – Exceptions to this include the design of high-volume
products such as memory chips, high-performance microprocessors and FPGA masters.
• Next slide shows the full layout of the Intel 486 P chip. – Good example of a hybrid full-custom design.
![Page 26: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/26.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
26
![Page 27: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/27.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
27
Comparison Among Various Design Styles Design Style
FPGA Gate array Standard cell
Full custom
Cell size Fixed Fixed Fixed height
Variable
Cell type Programmable
Fixed Variable Variable
Cell placement Fixed Fixed In row Variable
Interconnections Programmable
Variable Variable Variable
Design time Very fast Fast Medium Slow
![Page 28: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/28.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
28
A Laboratory Flow for Standard Cell Based Design
Verilog-XL (Cadence)
SimVision (Cadence)
Design Compiler (Synopsys)
Silicon Ensemble (Cadence)
Hercules (Avant)
HDL
Logic Simulation
Synthesis
Physical Design
Physical Verification
![Page 29: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/29.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
29
Introduction To
Verilog-HDL
![Page 30: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/30.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
30
How it started!
• Gateway Design Automation• Cadence purchased Gateway in 1989.• Verilog was placed in the public domain.• Open Verilog International (OVI) was created
to develop the Verilog Language as IEEE standard.
![Page 31: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/31.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
31
The Verilog Language
• Originally a modeling language for a very efficient event-driven digital logic simulator
• Later pushed into use as a specification language for logic synthesis• Now, one of the two most commonly-used languages in digital
hardware design (VHDL is the other)• Virtually every chip (FPGA, ASIC, etc.) is designed in part using one
of these two languages
• Combines structural and behavioral modeling styles
![Page 32: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/32.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
32
Multiplexer Built From Primitives
module mux(f, a, b, sel);output f;input a, b, sel;
andg1(f1, a, nsel),g2(f2, b, sel);
or g3(f, f1, f2);not g4(nsel, sel);
endmodule
a
bsel
f
nsel f1
f2
g1
g2
g3g4
Verilog programs built from modules
Each module has an interface
Module may contain structure: instances of primitives and other modules
![Page 33: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/33.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
33
Multiplexer Built From Primitives
module mux(f, a, b, sel);output f;input a, b, sel;
andg1(f1, a, nsel),g2(f2, b, sel);
or g3(f, f1, f2);not g4(nsel, sel);
endmodule
a
bsel
f
nsel f1
f2
g1
g2
g3g4
Identifiers not explicitly defined default to wires
![Page 34: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/34.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
34
Multiplexer Built With Always
module mux(f, a, b, sel);output f;input a, b, sel;reg f;
always @(a or b or sel) if (sel) f = b; else f = a;
endmodule
a
bsel
f
Modules may contain one or more always blocks
Sensitivity list contains signals whose change triggers the execution of the block
![Page 35: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/35.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
35
Multiplexer Built With Always
module mux(f, a, b, sel);output f;input a, b, sel;reg f;
always @(a or b or sel) if (sel) f = b; else f = a;
endmodule
a
bsel
f
A reg behaves like memory: holds its value until imperatively assigned otherwise
Body of an always block contains traditional imperative code
![Page 36: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/36.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
36
Mux with Continuous Assignment
module mux(f, a, b, sel);output f;input a, b, sel;
assign f = sel ? b :a;
endmodule
a
bsel
f
LHS is always set to the value on the RHS
Any change on the right causes re-evaluation
![Page 37: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/37.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
37
Identifiers in Verilog
• Any Sequence of letter, digits, dollar sign, underscore.
• First character must be a letter or underscore.• It cannot be a dollar sign.• Cannot use characters such as hyphen,
brackets, or # in verilog names
![Page 38: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/38.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
38
Verilog Logic Values
• Predefined logic value system or value set : ‘0’, ‘1’ ,’x’ and ‘z’;
• ‘x’ means uninitialized or unknown logic value
• ‘z’ means high impedance value.
![Page 39: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/39.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
39
Verilog Data Types
• Nets: wire, supply1, supply0• Registers.• Wire: i) Analogous to a wire in an ASIC.ii) Cannot store or hold a value.• Integer
![Page 40: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/40.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
40
The Register Data Type
• Register Data Type: Comparable to a variable in a programming language.
• Default initial value: ‘x’
• module reg_ex1; reg Q; wire D; always @(posedge clk) Q=D;
• A reg is not always equivalent to a hardware register, flipflop or latch.
• module reg_ex2; // purely combinational reg c; always @(a or b) c=a|b; endmodule
![Page 41: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/41.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
41
Numbers
• Format of integer constants: Width’ radix value;• Verilog keeps track of the sign if it is assigned to
an integer or assigned to a parameter.• Once verilog looses sign the designer has to be
careful.
![Page 42: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/42.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
42
Hierarchy
• Module interface provides the means to interconnect two verilog modules.
• Note that a reg cannot be an input/ inout port.
• A module may instantiate other modules.
![Page 43: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/43.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
43
Instantiating a Module
• Instances of
module mymod(y, a, b);
• Lets instantiate the module,mymod mm1(y1, a1, b1); // Connect-by-position
mymod mm2(.a(a2), .b(b2), .y(c2)); // Connect-by-name
![Page 44: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/44.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
44
Sequential Blocks
• Sequential block is a group of statements between a begin and an end.
• A sequential block, in an always statement executes repeatedly.
• Inside an initial statement, it operates only once.
![Page 45: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/45.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
45
Procedures
• A Procedure is an always or initial statement or a function.
• Procedural statements within a sequential block executes concurrently with other procedures.
![Page 46: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/46.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
46
Assignments• module assignments // continuous assignments always // beginning of a procedure begin //beginning of a sequential block //….Procedural assignments end endmodule
• A Continuous assignment assigns a value to a wire like a real gate driving a wire.
module holiday_1(sat, sun, weekend); input sat, sun; output weekend;// Continuous assignment assign weekend = sat | sun; endmodule
module holiday_2(sat, sun, weekend); input sat, sun; output weekend; reg weekend; always @(sat or sun) weekend = sat | sun; // Procedural endmodule // assignment
![Page 47: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/47.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
47
Blocking and Nonblocking Assignments
• Blocking procedural assignments must be executed before the procedural flow can pass to the subsequent statement.
• A Non-blocking procedural assignment is scheduled to occur without blocking the procedural flow to subsequent statements.
![Page 48: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/48.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
48
Nonblocking Statements are odd!
a = 1;
b = a;
c = b;
Blocking assignment:
a = b = c = 1
a <= 1;
b <= a;
c <= b;
Nonblocking assignment:
a = 1
b = old value of a
c = old value of b
![Page 49: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/49.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
49
Nonblocking Looks Like Latches
• RHS of nonblocking taken from latches• RHS of blocking taken from wires
a = 1;
b = a;
c = b;
a <= 1;
b <= a;
c <= b;
1a b c
“”
a
b
c
1
“”
![Page 50: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/50.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
50
Examples
• Non-blocking: always @(A1 or B1 or C1 or M1) begin M1=#3(A1 & B1); Y1= #1(M1|C1); end • Blocking: always @(A2 or B2 or C2 or M2) begin M2<=#3(A2 & B2); Y2<=#1(M1 | C1); end
Statement executed at time t+3 causing Y1 to be assigned at time t+4
Statement executed at time t causing Y2 to be assigned at time t+1. Uses old values.
Statement executed at time t causing M1 to be assigned at t+3
Statement executed at time t causing M2 to be assigned at t+3
![Page 51: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/51.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
51
Parameterized Design
• module vector_and(z, a, b); parameter cardinality = 1; input [cardinality-1:0] a, b; output [cardinality-1:0] z; wire [cardinality-1:0] z = a & b; endmodule
• We override these parameters when we instantiate the module as: module Four_and_gates(OutBus, InBusA, InBusB); input [3:0] InBusA, InBusB; output[3:0] OutBus; Vector_And #(4) My_And(OutBus, InBusA, InBusB); endmodule
![Page 52: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/52.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
52
Functions (cont’d)
• Function Declaration and Invocation– Declaration syntax:
function <range_or_type> <func_name>;<input declaration(s)><variable_declaration(s)>begin // if more than one statement needed <statements>end // if begin used
endfunction
![Page 53: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/53.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
53
Function ExamplesControllable Shifter
module shifter;`define LEFT_SHIFT 1'b0`define RIGHT_SHIFT 1'b1reg [31:0] addr, left_addr,
right_addr;reg control;
initialbegin
…endalways @(addr)begin left_addr =shift(addr,
`LEFT_SHIFT); right_addr =shift(addr,`RIGHT_SHIFT);end
function [31:0]shift;input [31:0] address;input control;begin shift = (control==`LEFT_SHIFT) ?
(address<<1) : (address>>1);endendfunction
endmodule
![Page 54: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/54.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
54
How Are Simulators Used?
• Testbench generates stimulus and checks response• Coupled to model of the system• Pair is run simultaneously
Testbench System Model
Stimulus
ResponseResult checker
![Page 55: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/55.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
55
Looking back at our multiplexer
• “Dataflow” Descriptions of Logic//Dataflow description of muxmodule mux2 (in0, in1, select, out);
input in0,in1,select;output out;assign out = (~select & in0)
| (select & in1);endmodule // mux2
Alternative:
assign out = select ? in1 : in0;
![Page 56: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/56.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
56
TestBench of the Multiplexer
• Testbench module testmux; reg a, b, s;
wire f;reg expected;
mux2 myMux (.select(s), .in0(a), .in1(b), .out(f));
initialbegin s=0; a=0; b=1; expected=0;
#10 a=1; b=0; expected=1; #10 s=1; a=0; b=1; expected=1; end initial $monitor( "select=%b in0=%b in1=%b out=%b, expected out=%b time=%d", s, a, b, f, expected, $time); endmodule // testmux
![Page 57: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/57.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
57
A Car Speed Controller
SLOW
FASTSTOP
MEDIUM
Accelerate
BrakeAccelerate
BrakeAccelerate
Brake~Brake
(~Accelerate) & (~ Brake)(~Accelerate) & (~ Brake)
![Page 58: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/58.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
58
Car Controller Coding
module fsm_car_speed_1(clk, keys, brake, accelerate, speed); input clk, keys, brake, accelerate; output [1:0] speed; reg [1:0] speed; parameter stop = 2'b00, slow = 2'b01, mdium = 2'b10, fast = 2'b11;
![Page 59: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/59.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
59
Car Controller (contd.)
always @(posedge clk or negedge keys)
begin if(!keys) speed = stop; else if(accelerate) case(speed) stop: speed = slow;
slow: speed = mdium; mdium: speed = fast; fast: speed = fast; endcase
else if(brake) case(speed) stop: speed = stop;
slow: speed = stop; mdium: speed = slow; fast: speed = mdium; endcase else speed = speed; end
endmodule
![Page 60: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/60.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
60
A Better Way!
• We keep a separate control part where the next state is calculated.
• The other part generates the output from the next state.
• We follow this architecture in the coding of any finite state machines, like ALU, etc. ( to be discussed later)
![Page 61: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/61.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
61
module fsm_car_speed_2(clk, keys, brake, accelerate, speed);
input clk, keys, brake, accelerate; output [1:0] speed; reg [1:0] speed; reg [1:0] newspeed; parameter stop = 2'b00, slow = 2'b01, mdium = 2'b10, fast = 2'b11;
always @(keys or brake or accelerate or speed)
begin case(speed) stop: if(accelerate) newspeed = slow;
else newspeed = stop;
slow: if(brake) newspeed = stop; else if(accelerate) newspeed = mdium; else newspeed = slow; mdium: if(brake) newspeed = slow; else if(accelerate) newspeed = fast; else newspeed = mdium; fast: if(brake) newspeed = mdium; else newspeed = fast; default: newspeed = stop; endcase end
always @(posedge clk or negedge keys)
begin if(!keys) speed = stop; else speed = newspeed; end
endmodule
![Page 62: Digital IC Design Flow: A quick look](https://reader035.vdocuments.site/reader035/viewer/2022081505/5681684b550346895dde43e0/html5/thumbnails/62.jpg)
April 22, 2023 Department of Computer Science & EnggIIT Kharagpur
62
Conclusion : Write codes which can be translated into hardware !
The following cannot be translated into hardware( non - synthesizable):• Initial blocks
– Used to set up initial state or describe finite testbench stimuli– Don’t have obvious hardware component
• Delays– May be in the Verilog source, but are simply ignored
• In short, write codes with a hardware in your mind. In other words do not depend too much upon the tool to decide upon the resultant hardware.
• Finally, remember that you are a better designer than the tool.