Ds First Latest
Ds First Latest
1
EE141
2 1
EE141
DESIGN HIERARCHY
3
EE141
4 3
EE141
5
EE141
6 5
EE141
Design views
Algorithm
Architectural synthesis
For i = 0 ; i = 15 sum = sum + data[I] i Data[0] Data[0] Data[15]
Architecture
Register level
Logic synthesis
MEM
Clear sum
Gate level
7
EE141
8 7
EE141
Simulation
Simulates behavior of designed circuit Input: Models (transistor, gates) Textual netlist (schematic, extracted layout, behavioral) User defined stimulus Output: Circuit response (waveforms, patterns) Transistor level simulation using analog simulator (SPICE) Time domain Frequency domain Noise Gate level simulation using digital simulator Logic functionality Normally Timing: Operating frequency, delay, setup & hold violations same Timing calculator needed to calculate delays from extracted simulator parameters Functional simulation
9
EE141
10 9
EE141
10
Postsynthesis validation Timing verification Cell placement and routing DRC and ERC Extract Parasitics Design Sign-Off
12
Tape-out
13
EE141
14 13
EE141
14
Front Front-End
Synthesis good? Floor-plan Place & Route good? Physical Verification DRC & LVS good? done 15
Back-End
Front-End 10 months
Back-End: Create a floor-plan and tweak the tools until a successful mask layout is created TOOLS: Design Compiler, Floor-planners, Placers,
Routers, Clock-tree generators, Physical Verification
16 15
EE141
EE141
16
IN
f sample
Nfsample Nfsample
CLK Logic Function F(IN) IN OUT IN0 X IN1 OUT0 IN2 OUT1 IN3 OUT2 IN4 IN5
Logic Function F(IN)
fsample
. . .
Tsample
OUT3 OU
Tcritical-path=Tsample/N
fsample
High fsample can be achieved by either using a faster technology or by reducing the delay of the functional block by some transformations.
OUT
OUT
17
EE141
18 17
EE141
18
Implementation approaches
Digital Circuit Implementation Approaches
fsample
fsample
Full Custom
SEL
Semi-custom
Nfsample
Tsample/N
OUT
Capacitance overhead
Cell-based
Array-based
IN0
IN1
INN-2
INN-1
INN
Pre-wired (FPGA's)
Tsample
X
EE141
OUT 0
19 19
EE141
20 20
10-100
Configurable/Parameterizable
Hardwired custom
1-10
0.1-1
None
Somewhat flexible
Fully flexible
EE141
22
Verilog HDL
Verilog Developed by Phil Moorby at Gateway Design Automation in 1984-85
Initailly Verilog was used for functional simulation using Verilog-XL Synopsys Design Compiler pushes HDL to the forefront of digital design In 1995, Verilog became an IEEE standard IEEE 1364-2001 is the latest standard
Verilog/VHDL
First real commercial HDL language from gateway automation (now Cadence) Default standard among chip designers for many years Initially proprietary language of Cadence. Now also an IEEE standard because of severe competition from VHDL. Result: multiple vendors
VHDL
Very High speed integrated circuit Description Language Initiated by American department of defense as a specification language. Standardized by IEEE
23 24 23
EE141
EE141
24
Design Methodologies
Top level
Block 2
Block 3
Block 4 BottomBottom-up
Behavioral or algorithmic level Dataflow level Gate level Switch level The RTL description uses a combination of behavioral and dataflow constructs that is acceptable to the synthesis tool.
26 25
EE141
Leaf cell
Leaf cell
Leaf cell
Leaf cell
Leaf cell
Leaf cell
Leaf cell
Leaf cell
26
module M (a,b,c,d); input c,d; output b; inout a; parameter x = 2; Dataflow statements (assign) always and initial blocks containing behavioral statements
28 27
EE141
28
II
module DFF (output reg q, input d, clk, reset);
29
EE141
30 29
EE141
30
Hierarchical Names
module SR(Q, Qbar, Sbar, Rbar); output Q, Qbar; input Sbar, Rbar; nand n1(Q, Sbar, Qbar); nand n2(Qbar, Rbar, Q); endmodule module stimulus; wire q, qbar; reg set, reset; SR uut(.Q(q), .Qbar(qbar), .Sbar(~set), .Rbar(~reset)); ---------endmodule Hierarchical names : stimulus.q, stimulus.qbar, stimulus.set, stimulus.reset stimulus.uut.Q, stimulus.uut.Qbar, stimulus.uut.Sbar, stimulus.uut.Rbar,stimulus.uut.n1, stimulus.uut.n2
By name
module Top; reg [3:0] A,B; reg C_IN; wire [3:0] SUM; wire C_OUT; fulladd4 fa_name(.c_out(C_OUT), .sum(SUM), .a(A), .b(B), .c_in(C_IN)); stimulus endmodule module fulladd4(sum,c_out, a, b, c_in); output [3:0] sum; output c_out; input [3:0] a, b; input c_in; module internals endmodule 31 31
32
EE141
32
Design Hierarchy
Stimulus (Root level)
Hierarchical names :
uut (SR)
n1 (nand)
n2 (nand)
Instantiation without instance name: and (OUT, IN1, IN2); Instantiation with more than two inputs: nand n1(OUT, IN1, IN2, IN3);
33
EE141
34 34
Buf/Not gates
One scalar input and one or more scalar outputs. The last terminal in the port list is connected to the input.
35
EE141
36 35
EE141
36
Bufif/notif
Additional control on buf and not gates
in ctrl bufif1 in ctrl bufif0 out in ctrl notif0 out in ctrl notif1 out out
module stimulus; reg[3:0] A, B; reg C_IN; wire [3:0] SUM; wire C_OUT; fulladd4 FA1(SUM, C_OUT, A, B, C_IN); initial begin $monitor($time, SUM= %b, SUM);end Initial begin A=0; B=0, C_IN=0; #10 A=3; B=4, C_IN=0; #5 $finish; end endmodule
37 38 37
EE141
EE141
38
Gate Delays
There are three types of gates from the inputs to the output of a primitive gate: Rise Delay (w.r.t. the output) Fall Delay Turn-off delay (output transition to the high impedance state from another value) For each type of delay, three different values (min., typ., max.) can also be specified
and #(delay_time) a1 (out, i1, i2); and #(rise_time, fall_time) a1(out, i1, i2); and #(rise_time, fall_time, turnoff_val) a1 (out, i1, i2); bufif0 #(1,2,1) br (out, in, control);
39
EE141
40 39
EE141
40
Delay example
module X(out, a, b, c); output out; input a, b, c; wire e; and #(5) a1(e, a, b); or #(4) o1(out, e, c); endmodule
Dataflow Modeling
Circuit is defined in terms of Dataflow between registers (in terms of expressions rather than gate connectivity)
Continuous assignments is the basic statement in dataflow modeling. It is used to drive a value onto a net.
syntax : assign [delay] = expression; LHS must be a scalar or vector net or their concatenation Continuous assignments are always active RHS operands can be registers or nets or function calls. Delay values can be specified on operands.
assign out = i1 & i2; assign addr[15:0] = addr1[15:0] ^addr2[15:0]; assign {c_out, sum[3:0]} = a[3:0] + b[3:0] +c_in;
(Concatenation)
41
EE141
41
EE141
Implicit continuous assignment: wire out = in1 & in2; Only 42 one declaration assignment per net. 42
Delay incorporation
assign #delay out = i1 & i2; The output out will change after delay in response to the input signals rather than instantaneously. The expression is recomputed after delay for proper assignment.
43
EE141
44 43
EE141
44
Operator types
1. Arithmetic: *, /, +, -, %(modulus),**(exponent) 2. Logical: !, &&, || 3. Relational: >, <, >=, <= 4. Equality: ==, !=, ===(case equality including x and z) , !== 5. Bitwise operators: ~, &, |, ^, ^~ or ~^ 6. Reduction: &, ~&, |, ~|, ^, ^~ or ~^ 7. Shift: >>, <<, >>> (Arithmetic right shift), <<< 8. Concatenation: { } 9. Replication: { { } } 10. Conditional: ?:
Dataflow adder
module fulladd4(sum, cout, a ,b, cin); output [3:0]sum; output cout; input [3:0] a, b; input cin; assign {c_out, sum } = a + b + c_in; endmodule
45
EE141
46 45
EE141
46
47
EE141
48 47
EE141
48
Behavioral Modeling
Decisions early in the project w.r.t. the architecture for a given
algorithm. Design functionality can be described in an algorithmic manner (behavior) always and initial are the two structured procedure statements. All other behavioral statements can appear only inside these statements. always and initial are concurrent statements but the statements inside these two are sequential. Verilog is a concurrent language unlike C always and initial statements cannot be nested. Each statement starts at simulation time 0 and represents an activity flow.
49
EE141
Initial statement
All statements inside an initial statement constitute an initial block. An initial block starts at time 0, executes exactly once during a simulation and then does not execute again. All initial blocks start executing concurrently at time 0. Each block finishes execution independent of other blocks. Multiple behavioral statements must be grouped using the keywords begin and end Initial blocks are used for initialisation, monitoring, waveform generation that must be executed only once during the simulation.
50 50
49
EE141
Example
module stimulus; reg x, y, a, b, m; initial m = 1b0; initial begin #5 a = 1b1 ; #25 b = 1b0 ; end initial begin #10 x = 1b0; #25 y = 1b1; end initial #50 $finish; endmodule
EE141
always statement
All behavioral statements inside an always statement constitute an always block. Starts at time 0 and executes the statements in the always block continuously in a looping fashion. Models a block of activity that is repeated continuously in a digital circuit.
Clock generator: module clock1(clock); output clock; reg clock; initial clock = 0; always #10 clock = ~clock; initial #1000 $finish; endmodule
51 51
EE141
Combined Variable declaration and Initialisation: reg clock; initial clock = 0; Or reg clock = 0;
52 52
53
EE141
54 53
EE141
54
Assignments
Continuous assignments assign values to nets (vector and scalar) They are triggered whenever simulation causes the value of the right-hand side to change Keyword assign e.g. assign out = in1 & in2; Procedural assignments drive values onto registers (vector and scalar)
They Occur within procedures such as always and initial They are triggered when the flow of execution reaches them (like in C) Blocking and Non-Blocking procedural assignments
55
EE141
56 55
EE141
56
Procedural Assignments
For updating values of reg, integer, real, time variables The value placed on a variable will remain unchanged until another procedural assignment updates it to a different value. variable = [delay] expression LHS can be reg, integer, real, time variables RHS can be an expression that evaluated to a value.
Assignments (cont.)
Procedural Assignments
Blocking assignment statement (= operator) acts much like in traditional programming languages. The whole statement is done before control passes on to the next statement Nonblocking assignment statement (<= operator) evaluates all the right-hand sides for the current time unit and assigns the left-hand sides at the end of the time unit
57
EE141
58 57
EE141
58
Assignments (cont.)
Assignments Example: reg [7:0] A, B; Initial
Ouput: begin Blocking: A=4 B=5 A = 3; #1 A = A + 1; Non-blocking: A=4 B=4 B = A + 1; $display(Blocking: A=%d B=%d:, A, B); A = 3; #1 A <= A + 1; B <= A + 1; end #1 $display(Non-blocking: A=%d B=%d, A, B);
endmodule
59
EE141
60 59
EE141
60
More Examples
reg x, y, z; reg [15:0] reg_a, reg_b; integer count; Initial
begin x=0; y=1; z =1; count = 0; reg_a = 16b0; reg_b = reg_a; #15 reg_a[2] = 1b1; or reg_a[2] <= #15 1b1; #10 reg_b[15:13] = {x, y, z} ; or reg_b[15:13] <= #10 {x, y, z} ; count = count +1; end
Timing Control
Verilog is a discrete event time simulator. If there is no timing control, simulation time does not advance. Simulated time can only progress by one of the following:
a delay control, introduced by the # symbol. an event control, introduced by the @ symbol. the wait statement.
The order of execution of events in the same clock time may not be predictable.
endmodule
61
EE141
62 61
EE141
62
For example:
Inter-Statement Delay
#10 A = A + 1;
Intra-Statement Delay
A = #10 A + 1;
EE141
Regular event control Named event control Event OR control Level-sensitive timing control (wait statement)
64
EE141
64
negedge sig:
Change of sig from any value to 0 or from 1 to any value
66
67
EE141
68 67
EE141
68
Conditional statements
1. if(expression) true_statement; 2. if(expression) true_statement; else false_statement; 3. if(expression1) true_statement1; else if(expression2) true_statement2; else if(expression3) true_statement3; else default_statement;
70 69
EE141
70
71
EE141
72 71
EE141
72
Shift Register
73
EE141
74 73
EE141
74
75
EE141
76 75
EE141
76
Multiway branching
case (expression) alternative1: statement1; alternative2: statement2; default: default_statement; endcase
always @ (s1 or s0 or i0 or i1 or i2 or i3) case ({s1,s0}) 2d0 : out = i0; 2d1 : out = i1; 2d2 : out = i2; 2d3 : out = i3; default: $display(invalid); endcase
EE141
77 77
EE141
78 78
79
EE141
80 79
EE141
80
81
EE141
82 81
EE141
82
Loops
There are four types of looping constructs: 1. While while (count < 8) count = count + 1; 2. For for (count = 0; count < 8; count = count + 1; 3. Repeat repeat (8) count = count + 1; 4. Forever (infinite loop) forever #10 clock = ~clock;
8b 1111_0011
83
EE141
84 83
EE141
84
85
EE141
86 85
EE141
86
8b 1111_0011
87
EE141
88 87
EE141
88
89
EE141
90 89
EE141
90
Find_first_one
91
EE141
92 91
EE141
92
94 93
EE141
94
initial begin: init1 reg p; comp(1, 0, p); // invocation of task with 3 arguments $display("p= %b", p); end
95
EE141
endmodule
96 96
initial begin: init1 reg p; p = comp(1, 0); // invocation of function with 2 arguments $display("p= %b", p); end
97
EE141
endmodule
97
EE141
98 98
99
EE141
99
EE141
100 100
EE141
101 101
EE141
102 102
EE141
103 103
104 104
105 105
106 106
Important points:
107 107
EE141
108 108
EE141
109 109
EE141
110 110
Register files are not used for mass storage because they occupy significantly more Si area than Compiled memory
EE141
111 111
EE141
112 112
Design verification
Traditional method:
Simulation is predominant verification method
Gate level or register transfer level (RTL)
Test cases
UP-DOWN COUNTER
Steps involved:
1. Partition the chip into functional units and generate bit-true test vectors to specify the behavior of each unit 2. Verify the RTL level through simulation 3. Verify the gate level netlist through simulation 4. Verify the post layout gate level (physical) netlist through simulation
EE141
113 113
EE141
114 114
Analysis
The design is analysed to check the following items: 1. Data received equal to the expected data 2. Correct data according to the interface protocol Data correctness is checked by viewing the waveform or log files that contain traces of simulation and compare it with the standard output. This method is tedious and time consuming for large design. Test environment is made self checking by using Data and Protocol checkers.
Coverage
Coverage helps the designer to determine when the verification is complete. Types of coverage:
1. Structural 2. Functional
Structural:
1. Code coverage (Unexercised code bears bugs) 2. Toggle coverage (If a bit is not toggling, it has not been verified) 3. Branch coverage (If all possible branches in a control flow are taken)
EE141
115 115
EE141
116 116
Coverage Contd.
Functional Coverage It ensures that all possible legal values of input stimuli are exercised in all possible combinations at all possible times. It may be enhanced by inserting assertions in the RTL code.
EE141
117 117
EE141
118 118
Assertion Checking
Traditional verification assumes the Design under test as a black box i.e. verifies only the input-output functionality. Assertion checking is a white box verification approach. It requires knowledge of internal structure of the design. Assertions are statements about a designs intended behaviour. 1. Temporal assertions: Describe timing relationships between signals. (Request and acknowledge signals) 2. Static assertions: Describe a property of a signal that is always true or false.(Full and empty flags cant be 1 simultaneously)
EE141
Design Flow
Behavioral view
Logic synthesis Equivalence
119 119
EE141
120 120
Equivalence Checking
It ensures that the gate level netlist or the physical netlist has the same functionality as the RTL that was simulated. Equivalence checkers build a logical model of both the RTL and gate level representations of the design and mathematically prove that they are functionally equivalent. Thus functional verification can focus entirely on RTL and there is little need of gate level simulation.
EE141
121 121
EE141
122 122
Contd.
EE141
123 123
EE141
124 124