Logic Synthesis
Page 1
Introduction to Digital VLSI
Logic Synthesis Page 1 Introduction to Digital VLSI Logic - - PowerPoint PPT Presentation
Introduction to Digital VLSI Logic Synthesis Logic Synthesis Page 1 Introduction to Digital VLSI Logic Synthesis Course Outline Design Compiler Overview Some Words about Physical Compiler Coding Styles Partitioning
Logic Synthesis
Page 1
Introduction to Digital VLSI
Logic Synthesis
Page 2
Introduction to Digital VLSI
Logic Synthesis
Page 3
Introduction to Digital VLSI
Design Compiler
Cell Libraries Constraints Mapped Netlist HDL Code (RTL) (xxx.lib -> xxx.db) (timing and function) (timing, area ...)
Logic Synthesis
Page 4
Introduction to Digital VLSI
Physical Compiler
Cell Libraries Constraints Placed Netlist HDL Code (RTL) Physical Libraries (cells and technology) (xxx.lib -> xxx.db) (xxx.plib -> xxx.pdb) (timing and function) Floorplan (timing & physical)
Logic Synthesis
Page 5
Introduction to Digital VLSI
Speed Area
Large Small Fast Slow
constraints
Logic Synthesis
Page 6
Introduction to Digital VLSI
your speed goals is NOT a credible methodology”
Logic Synthesis
Page 7
Introduction to Digital VLSI
Analyze and Elaborate RTL code Apply Constraints Synthesize Constraints Met? End Identify Problem Re-code RTL Floorplan Create Custom Wireload
General Synopsys Synthesis Flow
No Yes
Synthesis tricks
Logic Synthesis
Page 8
Introduction to Digital VLSI
Analyze and Elaborate RTL code Apply Constraints compile_physical Constraints Met? End Identify Problem Re-code RTL “Floorplan”
General Synopsys Physical Synthesis Flow (mpc)
No Yes
including sime floorplan requirements
Create Floorplan
Synthesis tricks
Logic Synthesis
Page 9
Introduction to Digital VLSI
Analyze and Elaborate RTL code Apply Constraints compile_physical Constraints Met? End Identify Problem Re-code RTL Update floorplan
General Synopsys Physical Synthesis Flow (flooplan based)
No Yes
including sime floorplan requirements Synthesis tricks
(can be based
Resize up/down, relocate pins etc. mpc run results
Logic Synthesis
Page 10
Introduction to Digital VLSI
Integrate Blocks Design End Top-Level Compile
Integration with Structures and other Blocks
Rule Problems?
Yes No
Logic Synthesis
Page 11
Introduction to Digital VLSI
Logic Synthesis
Page 12
Introduction to Digital VLSI
Reset, Async Set, Sync Reset, Sync Set and Sync Toggle. Example: Inference Report for D Flipflop with Async Reset:
Latch Latch w/ Async Latch w/Dual Async Latch w/ Sync DFF DFF w/ Async DFF w/Dual Async DFF w/ Sync Muxed DFF JKFF MS latch + + + + + + + + + + + Register Name Type Width Bus AR AS SR SS ST Q1_reg Flip-Flop 1
N N N N
Logic Synthesis
Page 13
Introduction to Digital VLSI
module dffs (clk, in1, in2, cond, rst_b, out1, out2); input clk, in1, in2, cond, rst_b;
reg out1, out2; always @(posedge clk) begin
end always @(posedge clk or negedge rst_b) begin if (!rst_b)
else
end endmodule Always use non-blocking assignments for flip-flops. module dffs ( clk, in1, in2, cond, rst_b, out1, out2); input clk, in1, in2, cond, rst_b;
dffrpc out2_reg ( .C(clk), .D(in2), .RB(rst_b), .Q(out2) ); dffpc out1_reg ( .C(clk), .D(in1), .Q(out1) ); endmodule
Logic Synthesis
Page 14
Introduction to Digital VLSI
module latches ( clk, in1, in2, rst_b, out1, out2); input clk, in1, in2, rst_b;
reg out1, out2; always @(in1 or clk) begin if (clk)
end always @(in2 or rst_b or clk) begin if (!rst_b)
else if (clk)
end endmodule Use non-blocking assignments for latches as well
Logic Synthesis
Page 15
Introduction to Digital VLSI
Inferred memory devices in process in routine latches line 7 in file kuku =============================================================================== | Register Name | Type | Width | Bus | MB | AR | AS | SR | SS | ST | =============================================================================== | out1_reg | Latch | 1 | - | - | N | N | - | - | - | =============================================================================== Inferred memory devices in process in routine latches line 12 in file kuku =============================================================================== | Register Name | Type | Width | Bus | MB | AR | AS | SR | SS | ST | =============================================================================== | out2_reg | Latch | 1 | - | - | Y | N | - | - | - | ===============================================================================
Logic Synthesis
Page 16
Introduction to Digital VLSI
module latches ( clk, in1, in2, rst_b, out1, out2 ); input clk, in1, in2, rst_b;
itlrpc out2_reg ( .C(clk), .D(in2), .RB(rst_b), .Q(out2) ); itlpc out1_reg ( .C(clk), .D(in1), .Q(out1) ); endmodule
reg names.
Logic Synthesis
Page 17
Introduction to Digital VLSI
setup time with regard to the clock. As a result there is a possibility for false select.
Checking hold time violations requires best case libraries.
generator block.
multiple-clock flip-flops and for transparent latches.
instatiation of gatded clcoks as well as automatic tool inference. User gated clocks in RTL source should be INTENTIONAL and include a latch and and AND function (glithless design). They should be used ONLY where Power Compiler has no ability to detect the shared clocking condition (e.g: stop/idle for global power saving).
Logic Synthesis
Page 18
Introduction to Digital VLSI
module gated_clock (clk1, clk2, in1, in2, cond, rst_b, out1, out2, out3); input clk1, clk2, in1, in2, cond, rst_b;
reg out1, out2, out3; wire clk; /* conditional flip-flop - no problem */ always @(posedge clk1 or negedge rst_b) begin if (!rst_b)
else if (cond)
end /* conditional latch - refrain from using it */ always @(clk1 or rst_b or in1 or cond) begin if (!rst_b)
else if (cond & clk1)
end /* multiple clocks flip-flop - refrain from using it */ assign clk = clk1 || clk2; always @(posedge clk or negedge rst_b) begin if (!rst_b)
else
end endmodule
Logic Synthesis
Page 19
Introduction to Digital VLSI
module gated_clock ( clk1, clk2, in1, in2, cond, rst_b, out1, out2, out3 ); input clk1, clk2, in1, in2, cond, rst_b;
wire clk, n56, n164; mux21b z52 ( .A(out1), .B(in2), .S0(cond), .OUT(n164) ); dffrpb out1_reg ( .C(clk1), .D(n164), .RB(rst_b), .Q(out1) ); iand2b z51 ( .INPUT1(clk1), .INPUT2(cond), .OUTPUT1(n56) ); itlrpc out2_reg ( .C(n56), .D(in1), .RB(rst_b), .Q(out2) ); ior2b z50 ( .INPUT1(clk1), .INPUT2(clk2), .OUTPUT1(clk) ); dffrpc out3_reg ( .C(clk), .D(in2), .RB(rst_b), .Q(out3) ); endmodule
Logic Synthesis
Page 20
Introduction to Digital VLSI
C D Q
TL
in1
clk && cond C D Q
TL
in1
C Q D
TL
clk_b clk 2->1 MUX cond
Design2 the timing and area of the alternative implementation is only slightly worse than of the original
also possible if multiple latches shared one condition (power saving issue)
Logic Synthesis
Page 21
Introduction to Digital VLSI
// in the “clock generator”
reg cond_latched; always @(clk or cond) if (~clk) cond_latched <= cond; assign clk_gated = (cond_latched | scan_enable) & clk; . . . // In the module input clk_gated; reg out; always @(posedge clk_gated or negedge rst_b) begin if (!rst_b)
else
end . . .
c_b d q
TL
clk cond scan_enable clk_gated
Logic Synthesis
Page 22
Introduction to Digital VLSI
module ff_3state (data1, data2, clk, three_state, out1, out2); input data1, data2, clk, three_state;
reg out1; reg out2_data; always @ (posedge clk) begin if (three_state)
else
end always @ (posedge clk)
assign out2 = three_state ? 1’bz : out2_data; endmodule
Logic Synthesis
Page 23
Introduction to Digital VLSI
module ff_3state ( data1, data2, clk, three_state, out1, out2 ); input data1, data2, clk, three_state;
wire n98, n99, n100, n101; trinvc out2_tri ( .INPUT1(n98), .INPUT2(n99), .OUTPUT1(out2) ); iinve U21 ( .INPUT1(three_state), .OUTPUT1(n99) ); trinvc out1_tri ( .INPUT1(n100), .INPUT2(n101), .OUTPUT1(out1) ); dffpb out1_reg ( .C(clk), .D(data1), .QB(n100) ); dffpb out1_tri_enable_reg ( .C(clk), .D(three_state), .QB(n101) ); dffpb out2_data_reg ( .C(clk), .D(data2), .QB(n98) ); endmodule Inferred THREE-STATE control devices in process in routine ff_3state line 11 in file kuku. ============================================================================ | Three-state Device Name | Type | MB | ============================================================================ | out1_tri | Three-state Buffer | N | | out1_tri_enable_reg | Flip-flop (width 1) | N | ============================================================================
Logic Synthesis
Page 24
Introduction to Digital VLSI
Use combinational logic for:
Logic Synthesis
Page 25
Introduction to Digital VLSI
wire yy = (A & C | (B != ‘GO)) ? D : (D & !A); wire start_count = start & (count < 17); reg y; always @(posedge clk) if (start_count) y <= yy; reg y; always @(posedge clk) if (start & (count < 17)) begin if (A & C | (B != ‘GO)) y <= D; else y <= D & !A; end reg yy; // not a real register always @(A or B or C or D) begin if (A & C | (B != ‘GO)) yy = D; else yy = D & !A; end reg y; always @(posedge clk) if (start & (count < 17)) y <= yy;
Logic Synthesis
Page 26
Introduction to Digital VLSI
HDL Compiler understands some operators and automatically generates the logic to implement them:
reg [7:0] a, b; reg [7:0] y; always @(posedge clk) if (a > b) y <= a + b;
comparator adder
Logic Synthesis
Page 27
Introduction to Digital VLSI
always @(SEL or A or B or C or D) begin case (SEL) 2’b00 : OUTC = A; 2’b01 : OUTC = B; 2’b10 : OUTC = C; default : OUTC = D; endcase end OUTC A B C D SEL 2 00 01 10 11 Note: Actual gates synthesized might not be a 4->1 MUX
Logic Synthesis
Page 28
Introduction to Digital VLSI
Statistics for case statements in always block at line 8 in file kuku =============================================== | Line | full/ parallel | =============================================== | 11 | auto/auto | =============================================== Current design is now {"try1"}
Logic Synthesis
Page 29
Introduction to Digital VLSI
Compiler will synthesize a latch.
synthesizes hardware that includes a priority encoder.
Logic Synthesis
Page 30
Introduction to Digital VLSI
are specified.
possible branches of a case statement. Use // synopsys full_case directive immediately after the case expression if
always @(sel or a or b or c) begin case (sel) 2'b00 : outc <= a; 2'b01 : outc <= b; 2'b10 : outc <= c; endcase end A case statement that is Parallel but not Full And what is wrong here ?
Logic Synthesis
Page 31
Introduction to Digital VLSI
Synopsys statistics WITHOUT // synopsys full_case directive Statistics for case statements in always block at line 8 in file kuku =============================================== | Line | full/ parallel | =============================================== | 11 | no/auto | =============================================== Inferred memory devices in process in routine try2 line 8 in file kuku =============================================================================== | Register Name | Type | Width | Bus | MB | AR | AS | SR | SS | ST | =============================================================================== | outc_reg | Latch | 1 | - | - | N | N | - | - | - | =============================================================================== Current design is now try2
Logic Synthesis
Page 32
Introduction to Digital VLSI
always @(sel or a or b or c) begin case (sel) // synopsys full_case 2'b00 : outc = a; 2'b01 : outc = b; 2'b10 : outc = c; endcase end Synopsys statistics WITH // synopsys full_case directive Warning: You are using the full_case directive with a case statement in which not all cases are covered. (HDL-370) Statistics for case statements in always block at line 8 in file kuku =============================================== | Line | full/ parallel | =============================================== | 11 | user/auto | =============================================== Current design is now try2
Note: This is not a recomended style !
Blocking assignment
Prefer full description of the case.
Logic Synthesis
Page 33
Introduction to Digital VLSI
determine that no cases overlap.
parallel_case directive is used.
always @(w or x) begin case (1'b1) w : b = 0; x : b = 1; endcase end A case statement that is Not Full or Parallel
Logic Synthesis
Page 34
Introduction to Digital VLSI
Synopsys statistics WITHOUT // synopsys parallel_case full_case directive Statistics for case statements in always block at line 7 in file kuku =============================================== | Line | full/ parallel | =============================================== | 10 | no/no | =============================================== Inferred memory devices in process in routine try3 line 7 in file kuku =============================================================================== | Register Name | Type | Width | Bus | MB | AR | AS | SR | SS | ST | =============================================================================== | b_reg | Latch | 1 | - | - | N | N | - | - | - | ===============================================================================
Logic Synthesis
Page 35
Introduction to Digital VLSI
Synopsys statistics WITH // synopsys parallel_case full_case directive Warning: You are using the full_case directive with a case statement in which not all cases are covered. (HDL-370) Warning: You are using the parallel_case directive with a case statement in which some case-items may overlap. (HDL-371) Statistics for case statements in always block at line 7 in file kuku =============================================== | Line | full/ parallel | =============================================== | 10 | user/user | =============================================== Current design is now try3
Logic Synthesis
Page 36
Introduction to Digital VLSI
always @(SEL or A or B or C or D) begin if (SEL == 2’b00) OUTC = A; else if (SEL == 2’b01) OUTC = B; else if (SEL == 2’b10) OUTC = C; else OUTC = D; end D C 1 SEL == 2’b10 SEL 1 B 1 SEL == 2’b01 SEL == 2’b00 A OUTC Note: Actual gates synthesized might not match those shown above.
Logic Synthesis
Page 37
Introduction to Digital VLSI
always @(. . .) begin if (. .) . . . ; else if (. .) . . . ; else if (. .) . . . ; else . . . ; end top priority always @(. . .) begin if (. .) . . . ; if (. .) . . . ; if (. .) . . . ; end always @(. . .) begin case (. .) A: . . . ; B: . . . ; C: . . . ; endcase end top priority top priority
Logic Synthesis
Page 38
Introduction to Digital VLSI
Sensitivity Lists
Use complete sensitivity lists for combinational always statements. Otherwise, pre-synthesis (high-level) simula- tion might not match post-synthesis (gate-level) simulation results. Elaboration will detect incomplete sensitivity lists and generate a warning.
A
always @(A) begin C = A || B; end
B C A B C
High-Level Simulation Synthesized Netlist
A B C
Gate-Level Simulation
Logic Synthesis
Page 39
Introduction to Digital VLSI
case and if Statements (part 1)
statement.
always @(D) begin case (D) 2’b00: Z <= 1’b1; 2’b01: Z <= 1’b0; 2’b10: Z <= 1’b1; S <= 1’b1; endcase end Missing Clause S Output What’s wrong with this code? non-blocking
Logic Synthesis
Page 40
Introduction to Digital VLSI
case and if Statements (part 2)
than an if statement).
always @(SEL or INNER) case (SEL) 2’b00: Z = 2’b00; 2’b01: case (INNER) 2’b00: Z = 2’b11; 2’b01: Z = 2’b01; default: Z = 2’b00; endcase 2’b10: Z = 2’b11; default: Z = 2’b10; endcase case within a case
Logic Synthesis
Page 41
Introduction to Digital VLSI
Bad Style
case (STATE) IDLE: if (LATE == 1’b1) ADDR_BUS = ADDR_MAIN; else ADDR_BUS = ADDR_CNTL; INTERRUPT: if (LATE == 1’b1) ADDR_BUS = ADDR_MAIN; else ADDR_BUS = ADDR_INT; endcase if (LATE == 1’b1) ADDR_BUS = ADDR_MAIN; else case (STATE) IDLE: ADDR_BUS = ADDR_CNTL; INTERRUPT: ADDR_BUS = ADDR_INT; endcase
Good Style
COMBO LATE ADDR_MAIN ADDR_BUS COMBO LATE ADDR_MAIN ADDR_BUS
Logic Synthesis
Page 42
Introduction to Digital VLSI
Logic Synthesis
Page 43
Introduction to Digital VLSI
module ADR_BLK (. . . DEC U1 (ADR, CLK, INST); OK U2 (ADR, CLK, AS, OK); endmodule;
CLK AS ADR INST OK DEC OK
ADR_BLK
Logic Synthesis
Page 44
Introduction to Digital VLSI
Design Compiler.
group ungroup
Logic Synthesis
Page 45
Introduction to Digital VLSI
U1
the new block.
U2 U3 U4 U5 U6 U7 U8 U9 U10 group -logic -design DECODE
U10 DECODE DEC1 U5
Logic Synthesis
Page 46
Introduction to Digital VLSI
important command.
DEC/U2 DEC/U3 DEC/U4 DEC/U5 U6 U7 U8 U9 U10 ungroup {DEC1} U6 U7 U8 U9 U10 DECODE DEC1 DEC/U1
Logic Synthesis
Page 47
Introduction to Digital VLSI
Logic Synthesis
Page 48
Introduction to Digital VLSI
structures.
Logic Synthesis
Page 49
Introduction to Digital VLSI
Bad Example
REG COMB LOGIC A
sharing of common terms.
COMB LOGIC B COMB LOGIC C REG
Logic Synthesis
Page 50
Introduction to Digital VLSI
Better Example
REG COMB LOGIC
REG A & B & C
Logic Synthesis
Page 51
Introduction to Digital VLSI
Best Example
REG COMB LOGIC
REG A & B & C
Logic Synthesis
Page 52
Introduction to Digital VLSI
Bad Example
REG CLK COMBO LOGIC A A REG CLK C COMBO LOGIC C A C TOP
Logic Synthesis
Page 53
Introduction to Digital VLSI
Good Example
REG CLK COMBO LOGIC A A REG CLK C A C TOP
GLUE + COMBO LOGIC C
Logic Synthesis
Page 54
Introduction to Digital VLSI
Bad Example
REG CLK CRITICAL PATHS A REG CLK C TOP
block and optimize them solely for area or for speed.
NO CRITICAL LOGIC
Logic Synthesis
Page 55
Introduction to Digital VLSI
Good Example
REG CLK CRITICAL PATHS A REG CLK C
NO CRITICAL LOGIC
Logic Synthesis
Page 56
Introduction to Digital VLSI
Bad Example
10 gates
with artificial boundaries.
40,000 gates 10,000 gates 30,000 gates