Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Winter - 2000
Introduction
Objectives
Review the course objectives Review the course schedule How to get help
Introduction
Course Objectives
This course introduces the new user to the Synplify Pro FPGA synthesis product. The topics covered will include:
Design flow and Synthesis Concepts Project Management SCOPE Windows - Graphical Constraints Entry Synthesis Optimization and User Control
Synplify Pro Tool Compiler optimizations Synplify Pro Tool Compiler directives Synplify Pro Tool Mapper optimizations Timing constraints and Attributes to control synthesis
Introduction
Course Schedule
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
Introduction
4
Getting Help
Online Help
Select Help->Help, or [F1] function key from Synplify Pro Software
Synplicity Support
Synplify Online Support[SOS] and Synplify Newsgroup
http://www.synplicity.com/support/logon_news/log_news.html news://news.synplicity.com/Synplicity.Synplify
Send email to support@synplicity.com Call the Technical Support Hotline at (408) 215-6000
Introduction
5
constraints
Synthesis
timing analysis mapped netlist
FPGA Vendor
timing verification
Compile
User Constraint File[.sdc] Technology independent RTL View netlist[.srs]
Technology Map
[Based on Device options] Technology view netlist[.srm] Post-synthesis simulation netlist [.vhm/.vm]
Design Flow and Synthesis Concepts
Forward annotated timing constraints[.acf,.ncf,.lp etc.] Technology-specific netlist[.edf, .xnf, .vqm, .edn etc.]
9
Constraint file
Define timing constraints such as clocks, input/output delays, timing exceptions User attributes to control synthesis
10
Finite State Machine(FSM) extraction and optimizations Resource sharing of arithmetic operators RTL optimizations
11
12
13
Project Management
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
Project Management
14
How to specify project options in the the Synplify Pro s/w interface
Create a new project Add source files Select Target technology and specify device options Specify timing constraints through the SCOPE editor Select compiler and mapper options Specify result file options
Viewing Results
Log File Log Watch Window Tcl Window
Project Management
15
Project Management
16
Project Management
18
Synplify Pro UI
Allows block commenting of HDL lines of code Allows selecting and editing of columns Other standard features such as Find, Replace, Line numbers etc.
Project Management
21
Project Management
23
Project Management
24
Project Management
25
Global frequency
Project Management
Result format
26
Project Management
27
Project Management
29
Project Management
30
Project Information
Source files compiled Top level module
Design Information
HDL syntax check & synthesis check Warnings on unused inputs Removal of redundant logic Latch inference warnings FSM extraction Inferred RAMs/ROMs Black box instantiations
Project Management
31
Design Information
Flattening( automatic dissolve )of the design Extraction of counters FSM Implementation Explicit and inferred clock nets Buffered nets Replication of logic Optimization of flip flops
Project Management
32
Project Management
33
Project Management
34
Can be configured to show results for multiple implementations Select View -> Log Watch Window from Synplify Pro Tool
Project Management
36
Log parameters
Project Management
Implementation name
37
Project Management
39
TCL window
Project Management
40
Technology view
Technology dependent schematic of the design View of the critical path with timing and slack information
Project Management
41
42
RTL View
Project Management
43
Project Management
44
Technology View
Project Management
45
Technology View
Project Management
46
Lab 1[Completion]
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
Lab 1
47
SCOPE Editor
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
The SCOPE Editor
48
49
SCOPE Editor
Creating a new constraints file
50
Tab selected
51
Clocks in the design filled in automatically in the Clock column Value specified in MHz or ns Duty cycle also specified Enabled tab used to select /deselect constraints
The SCOPE Editor
52
Inputs and Outputs of the design automatically filled in the Port column Value specified in ns Enabled column used to select or deselect constraints Comment column
The SCOPE Editor
53
Specify Multi-cycle paths in the design Types of Multi-cycle paths include -from, -to and through Applied on registers[-from, -to] or nets[-through] Value specified in cycles Enabled column used to select or deselect constraints Comment column
The SCOPE Editor
54
Selecting an object filters the Attributes pull-down menu to allowable attributes only Selecting an attribute filters the Objects pull-down menu to allowable objects only Value column lists allowed values for an attribute Enabled column used to select or deselect attributes Comment column
The SCOPE Editor
55
56
Compiler Overview
B.E.S.T.[Behavior Extraction Synthesis Technology] Algorithms Supported Verilog and VHDL constructs in the Synplify Pro tools Recommended coding styles
Flip-flops RAM ROM FSM
Synthesis issues
Synthesis Optimizations in the Compiler
58
59
Conservation of Abstraction
High-level structure is preserved throughout optimization and mapping to get best results
Design Abstraction Behavior RTL Gates
Language Compilation Logic Optimization Technology Mapping
S Y N T H E S I S
Synthesis Optimizations in the Compiler
60
Behavioral statements
if-else-if, case, casex, casez, for, repeat, while, forever, begin, end, fork, join
Procedural assignments
=, <= [Note: '<=' cannot be mixed with '=' for the same register]
Compiler directives
`define, `ifdef, `else, `endif, `include
61
62
63
Arithmetic
+, -,*, **, /, rem, mod
Relational
>, <, =, >=, /=, <=
Shift Operators
Shift_Left, Shift_right, Rotate_Left, Rotate_right,SHL, SHR, SHL, SHR
Behavioral statements
if-else-if, case, if-generate, for-loop, for-generate, when
Assignments
<=[for signals], :=[for variables]
64
65
Mixed Verilog/VHDL
Synplify Pro tool 6.1 supports mixed HDL design Can add both Verilog and VHDL files to project The top module/entity name has to be specified in the UI If a Verilog file instantiates a VHDL design, the Verilog language rules apply. Similarly if a VHDL file instantiates a Verilog design, the VHDL language rules apply Current limitations
Generics or parameters cannot be passed across language boundaries VHDL User defined types for ports cannot be used across language boundaries
66
67
RTL View
Always probe synchronous signals inside rising edge/falling clock edge condition check. Do not list the enable condition in the event expression of the always block, because it should not trigger the always block to execute upon changing.
68
RTL View
Always probe synchronous signals inside rising edge/falling clock edge condition check. Do not list the enable condition in the event expression of the always block, because it should not trigger the always block to execute upon changing. Do not include the reset signal in the event expression for a synchronous reset flip-flop
Synthesis Optimizations in the Compiler
69
The write process has to be synchronous for the RAM to be inferred by the compiler The read process can either be synchronous or asynchronous Resets on the memory are not yet supported The address must be at least 2 bits wide for the compiler to infer a RAM
70
RTL View
The write process has to be synchronous for the RAM to be inferred by the compiler The read process can either be synchronous or asynchronous Resets on the memory are not yet supported The address must be at least 2 bits wide for the compiler to infer a RAM
Synthesis Optimizations in the Compiler
71
RTL View
The ROM must be at least half full for it to be inferred. The address must be at least 2 bits wide for the compiler to infer a ROM
Synthesis Optimizations in the Compiler
72
Assign default values to outputs derived from the FSM before the case statement
Easier to read - less clutter from signals that are assigned rarely Avoids unwanted latches
73
reg data_out, state0, state1, state2; reg [1:0] state, next_state; always @(posedge clk or negedge rst) if (!rst) state <= idle; else state <= next_state;
always @(state or enable or data_in) begin state0 <= 1'b0; Default values for state1 <= 1'b0; state2 <= 1'b0; outputs of FSM data_out <= 1'b0; case (state)
74
FSM Viewer
Transition Table
75
76
77
VHDL
signal current_state : std_logic_vector(7 downto 0); attribute syn_state_machine : boolean; attribute syn_state_machine of current_state : signal is true;
78
Over-ride default encoding of FSM Compiler with syn_encoding Applied on an individual register Example:
Verilog
reg [7:0] current_state /* synthesis syn_encoding = sequential */;
VHDL
signal current_state : std_logic_vector(7 downto 0); attribute syn_encoding : string; attribute syn_encoding of current_state : signal is sequential;
79
80
81
82
module res_share (a, b, c, d, e, f, c1, c2, y); input a, b, c, d, e, f; input c1, c2; output y; reg y; always@(a or b or c or d or e or f or c1 or c2) begin if (c1) y = a + b; else if (c2) y = c + d; else y = e + f; end endmodule
83
VHDL
architecture rtl of top is attribute syn_sharing : string; attribute syn_sharing of rtl : architecture is off;
Synthesis Optimizations in the Compiler
84
always @(select or a or b or c or d) begin casez (select) /* synthesis full_case */ 2'b00: out = a; 2'b01: out = b; 2'b10: out = c; endcase end
86
Example:
Verilog
module OBUF(O, I) /* synthesis syn_black_box */;
VHDL
component OBUF port( O : out std_logic; I : in std_logic); end component; attribute syn_black_box : boolean; attribute syn_black_box of OBUF : component is true; Synthesis Optimizations in the Compiler
88
Applied to wires in Verilog and signals in VHDL Nets can be preserved to:
Probe their value during simulation Prevent certain optimizations, such as clock enable optimization
Example
VHDL
signal q_tmp : std_logic; attribute syn_keep : boolean; attribute syn_keep of q_tmp : signal is true;
89
module clken(d, en1, en2, clk, rst, q); input d; input clk, rst, en1, en2; output q; reg q; wire q_tmp /* synthesis syn_keep = 1 */; assign q_tmp = en2 ? d : q; always @(posedge clk or posedge rst) if (rst) q <= 0; else if(en1) q <= q_tmp; endmodule
Asynchronous Loads
always @(posedge clk or posedge load ) begin if (load) q = d0; else q = d; end
91
Asynchronous Loads
To avoid simulation mismatches, change the RTL code as shown below
wire tmp_set = load & d0; wire tmp_rst = load & ~d0; always @(posedge clk or posedge tmp_rst or posedge tmp_set ) begin if (tmp_rst) q = 0; else if (tmp_set) q = 1; else q = d; end
92
Latch generation
module newmux (out, a, b, c, select); input a, b, c; output out; input[1:0] select; reg out; always@(a or b or c or select) begin if (select ==2'b10) out = a; else if (select == 2'b01) out = b; else if (select == 2'b11) out = c; end endmodule Latch generated because of missing if condition, select = 2b00
93
94
module if_else(a, b, c, d, e, clk); output b; input a, b, c, d, e, clk; reg b; always @(posedge clk) begin if (a) b = c; else if (d) b = e; else b = bx; end endmodule
b gets e only when d=1b1 and a != 1b1. This is the implicit priority of an if-then-else construct
95
module case_parallel(a, b, c, d, e, clk); input a, c, d, e, clk; output b; reg b; always @(posedge clk) begin casez({d, a}) /* synthesis parallel_case */ 2'b?1: b = c; 2'b1?: b = e; default: b = 'bx; endcase end endmodule
96
A Y B
A 0 1 1 0
B 0 1 0 1
Y1 1 0 0 1
Y2 1 0 1 1
module nand2(A,B,Y2); input A,B; output Y2; reg Y2; always @(A or B) begin Y2 = !(A & B); end endmodule
97
98
99
Unused Inputs
Inputs driving logic that do not drive outputs directly or indirectly are flagged as unused
module dff(q1, data1, data2, clk); output q1; input data1, data2, clk; reg q1, q2; always @(posedge clk) begin q1 = data1; end always @(posedge clk) begin q2 = data2; end endmodule
100
Registers q1, q2, q3, and q4 are identical. Hence, the compiler optimizes 3 of the 4 registers away.
Lab 2
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
Lab 2
102
Mapper Overview
How the Mapper works Timing Constraints Attributes to control synthesis
104
Goal
To fit the design into the smallest programmable device AND to operate the device at the fastest frequency
In order to achieve optimal results, the mapper uses the following components:
B.E.S.T Algorithms
Integrated Module Generation and Mapping
Hierarchy Optimization
Hierarchy Flattening and Reconstructing
B.E.S.T. Algorithms
Integrated Module Generation & Mapping
Maintains inferred components(adders, multipliers, memory) at an abstract level Automatically combines these extracted components with associated logic
Benefit
Takes maximum advantage of the resources available in the target technology
Adder Module Control Logic
Synplify Pros Integrated Module Generation Data path & Control Integrated into one logic block
106
Logic Block
Synthesis Optimizations in the Mapper
F G
clb
F G
z[3]
a[2] b[2] cond
F
carry
z[3]
z[2]
G
clb
z[2]
F G
clb
F G
z[1]
a[0] b[0] cond
F
carry
z[1]
z[0]
G
clb
z[0]
107
Hierarchy Optimization
Mapper starts with the original hierarchy Performs global analysis and optimizes hierarchy by creating new structures, if needed Rebuilds hierarchy by keeping existing boundaries or creating new ones Provides timing budget for each hierarchical block Converges on the timing goal by making an area/time tradeoff
108
Hierarchy Optimization
Logic implemented in one lookup table with hierarchical boundary optimization
module and2_x(a, b, c); input a, b; output c; assign c = a & b; endmodule module top(a0, a1, b, c); input a0, a1, b; output c; and2_x an1(a0, a1, an1_out); and2_x an2(an1_out, b, c); endmodule
109
Mux Decomposition
Constant Propagation
110
Timing constraints
User Specified Controls levels of logic between two registers
111
LUT LUT
z
cascade
case sel is when 00 => z <= a; when 01 => z <= b; when 10 => z <= c; when 11 => z <= d; when others => z <= (others => X); end case;
a b sel[0] z PFUMUX
c d sel[0]
Lucent
a
a b sel[0] z
F H G
CLB
z
b z c d
sel[1]
c d sel[0]
o o
sel[0] sel[1]
QuickLogic
Xilinx XC4000
Actel
112
Altera
Logic Element with Cascade , Quick-feedback counter, EABs and ESBs
Actel
CM8
Lucent
RAM, Counters, PFU Muxes
Synthesis Optimizations in the Mapper
113
MUX8x1(Xilinx Virtex)
module mux8x1(din, sel, dout); input [7:0] din; input [2:0] sel; output dout; assign dout = din[sel]; endmodule
Slice A
Slice B
Synthesis Optimizations in the Mapper
114
module srltest(z1, z2, a, en, clk); output z1, z2; input a; input clk, en; reg [10:0] dataa, datab; always @(posedge clk) dataa = {dataa[9:0], a}; always @(posedge clk) if (en) datab = {datab{9:0], a}; assign z1 = dataa[10]; assign z2 = datab[10]; endmodule
115
module cascade_ex(din, dout); output dout; input [7:0] din; reg dout; assign dout = &din; endmodule
116
module cntr(clk, q, aclr); output [3:0] q; input clk, aclr; reg [3:0] q; always @(posedge clk or posedge aclr) if (aclr) q <= 0; else q <= q + 1; endmodule
117
CM8 (Actel)
module module_d(a, b, sum, clk, rst); output [7:0] sum; input clk, rst; input [7:0] a, b; reg [7:0] sum; reg [7:0] a_int, b_int; always @(posedge clk or posedge rst) if (rst) begin a_int <= 0; b_int <= 0; sum <= 0; end else begin a_int <= a; b_int <= b; sum <= a_int + b_int; end endmodule
118
RAM (Lucent)
module ramtest(address, data_in, data_out, clk, we); output [0:0] data_out; input clk, we; input [0:0] data_in; input [2:0] address; reg [0:0] data[0:7]; reg [7:0] a_int, b_int; always @(posedge clk) begin if (we) data[address] <= data_in; data_out <= data[address]; end endmodule
RAMs are also inferred for Xilinx, Altera, Quicklogic and Cypress Technologies
Synthesis Optimizations in the Mapper
119
120
Timing Constraints
Apply timing constraints to drive synthesis Basic timing constraints include:
Clock frequency Input/Output delay Multi-cycle path False path
121
Input to Output
122
Timing Constraints
Essential for achieving the performance goal
define_input_delay
Delay
Big Delay
define_multicycle_path define_clock D Q
Delay
Delay
define_output_delay
123
Clock Frequency
Clock Period
If the equation Tco + Tcomb + Tsu < clock period is valid, data transfers from register to register
The Tcomb value guides the mapper to synthesize the combinational logic and reduce the levels of logic between the registers.
Synthesis Optimizations in the Mapper
124
Chip
Chip
If Tindelay or Toutdelay= 0, it means that a fictitious register exists at the input or output port.
125
126
Multi-cycle Path
Impacts:
1. 2.
False Path
False Paths are of two types
Architectural false paths
Designer is aware that such paths exist
x
b
Synthesis Optimizations in the Mapper
x
c
0 1
z x
128
Attributes
User Defined
Generic
syn_hier, syn_noclockbuf, syn_maxfan, syn_useioff
Technology-specific
Xilinx and Altera
syn_ramstyle, syn_romstyle
129
syn_maxfan
Applied on an input or register Takes an integer value Specifies maximum fanout for an input or register Results in replication
module test(a, clk, rst, din, q); input [3:0] a; input [31:0] din; input clk, rst; output [31:0] q; reg [31:0] q; reg en /* synthesis syn_maxfan = 10 */; always @(posedge clk or posedge rst) begin if (rst) begin en <= 0; q <= 0; end else begin en <= &a; if (en) q <= din; end end
With syn_maxfan
Without syn_maxfan
Synthesis Optimizations in the Mapper
endmodule
130
syn_noclockbuf
Turns off clock resource usage Used on ports or entire modules Takes a boolean value
module simpledff(clk, d, q); input [3:0] d; input clk /* synthesis syn_noclockbuf = 1 */; output [3:0] q; reg [3:0] q; always @(posedge clk) q <= d; endmodule
With syn_noclockbuf
Without syn_noclockbuf
132
syn_useioff
With syn_useioff
Used to control I/O register packing Can be applied on ports or entire modules Takes a boolean value
module dff(q, d, clock, reset); input d; input clock, reset; output q /* synthesis syn_useioff = 1*/; reg temp, q; always @(posedge clock or posedge reset) begin if (reset) begin tmp <= 0; q <= 0; end else begin tmp <= d; q <= tmp; end end endmodule
Without syn_useioff
Synthesis Optimizations in the Mapper
133
syn_ramstyle
Determines the RAM implementation Applied on the RAM primitive Takes a string value
module ram_test(q, addr, data, we, clk); input [1:0] d; input clk, we; Input [2:0] addr; output [1:0] q; reg [1:0] mem[7:0] /* synthesis syn_ramstyle = registers */; always @(posedge clk) if (we) mem[addr] <= data; assign q = mem[addr]; endmodule
Without syn_ramstyle
With syn_ramstyle=registers
134
syn_romstyle
With syn_romstyle = block_rom
module romz(z,a); output [3:0] z;; input [4:0] a; reg [3:0] z /* synthesis syn_romstyle = logic */; always @(a) case (a) 5b00000 : z = 4b1011; 5b00001 : z = 4b0001; 5b00100 : z = 4b0011; 5b00110 : z = 4b0010; 5b00111 : z = 4b1110; 5b01001 : z = 4b0111; 5b01010 : z = 4b0101; 5b01101 : z = 4b0100; 5b10000 : z = 4b1100; 5b10001 : z = 4b1101; 5b10010 : z = 4b1111; 5b10011 : z = 4b1110; 5b11000 : z = 4b1010; 5b11010 : z = 4b1011; 5b11110 : z = 4b1001; 5b11111 : z = 4b1000; default : z = 4b0000; endcase end endmodule
136
Overview
Common features used in the HDL Analyst module
Cross-probing Filtering
Useful Features
Hierarchical and Flattened views
Allows users to see the hierarchy created in a design making design easier to look at. Also allows users to flatten the design. This makes it easier to see the overall flow of the design.
Cross-probing
Cross-probe between HDL code and RTL View or Technology view. Can also cross-probe between a Place and Route timing report file and the Technology View
139
141
142
143
144
RTL View
What is it?
Graphical representation of the HDL source code. Everything shown before any technology specific optimization.
Benefits
Allows users to see exactly what was written.
Novice designers can make sure that what they have written is what they want Expert designers can look for ways to improve their code
145
RTL View
Schematic of what is in the source code No technology specific optimizations
146
[3]
IB U F
I
O
[3]
a _ib uf [3 ]
[0 ] [1 ] [2 ] [3 ]
R O M 16X 1
A0 A1 A2 A3
O
[3 ]
[3]
OBUF
I
O
[3]
[3:0]
z[3:0]
z _ o b uf [3 ]
ro m o ut.I_ 1 2
[2]
IB U F
I
O
[2]
a[3:0]
[3:0] [3:0]
rom
A[3:0] DOUT[3:0]
a _ib uf [2 ]
[3:0] [3:0]
z[3:0]
IB U F
I
O
[0 ] [1 ] [2 ] [3 ]
R O M 16X 1
A0 A1 A2 A3
O
[1 ]
[2]
OBUF
I
O
[2]
z _ o b uf [2 ]
romout[3:0]
ro m o ut.I_ 1 1
[1]
[1]
a _ib uf [1 ]
[1]
OBUF
I
O
[1]
z _ o b uf [1 ]
[0 ] [1 ] [2 ] [3 ]
[0]
R O M 16X 1
A0 A1 A2 A3
O
[2 ]
[0]
IB U F
I
O
a _ib uf [0 ]
ro m o ut.I_ 1 0
[0]
OBUF
I
O
[0]
z _ o b uf [0 ]
[0 ] [1 ] [2 ] [3 ]
R O M 16X 1
A0 A1 A2 A3
O
[0 ]
ro m o ut.I_ 9
147
FSM Viewer
State Machines shown as onehot encoding in RTL View
No decoding needed, onehot is easier to interpret.
FSM Viewer invoked by pushing into State Machine primitive in RTL View
Has three tabs
State Transition Diagram RTL Encoding
Shows state machine as onehot encoding
Mapped Encoding
Shows exactly how the mapper implemented state machine Direct link between state registers and HDL code
148
149
150
151
152
Technology View
What is it?
Graphical representation of the optimized and mapped design. Contains the exact components that make up the target architecture (RAMs, ROMs, LUTs, LABs .).
Benefits
Allows users to see exactly how their design was implemented. Critical paths can be looked at directly and can suggest ways of improving delay.
153
Technology View
(cont.)
154
Technology View
155
Steps to cross-probe
Open the RTL View Open the Flattened Technology View
This facilitates viewing the entire critical path
Open the Place and Route timing report file in the Synplify Pro tool Select the critical path Cross-probe to HDL Analyst module
156
Cross-probing (cont.)
Place and Route timing report File with Critical Path selected Technology View showing the selected critical path
157
159
160
RESULTS 82 MHz!!!!
161
Labs 3 & 4
Design Flow and Synthesis Concepts Project Management Lab 1 SCOPE Editor Lunch Synthesis Optimizations in the Compiler Lab 2 Synthesis Optimizations in the Mapper Debugging with the HDL Analyst Module Labs 3 & 4
Labs 3 & 4
162