Synthesizable VHDL Slides Ayon
Synthesizable VHDL Slides Ayon
Synthesizable VHDL Slides Ayon
Jan Koenek r
[email protected]
Outline
Introduction to synthesis Synthesis levels VHDL templates and implementation Synthesis issues Conclusion
VHDL
VHDL - Very high speed integrated circuit Hardware Description Language. Designed for simulation discrete time simulation based on processes Now is also used for synthesis
Design ow
Synthesis
Synthesis is a general term that describes the process of transformation of the model of a design, usually described in a hardware description language (HDL), from one level of behavioral abstraction to a lower, more detailed behavioral level. These transformations try to improve upon a set of objective metrics (e.g., area, speed, power dissipation) of a design, while satisfying a set of constraints (e.g., I/O rates, MIPS, sample period) imposed on it.
Levels of Synthesis
Behavioral Synthesis - synthesis of abstract behavior or control-ow behavior from a high level algorithm description RTL Synthesis - synthesis of register-transfer structure from abstract, control-ow, or register-transfer behavior Logic Synthesis - synthesis of gate-level logic (an implementation) from register-transfer structure or Boolean equations
Levels of Synthesis
Behavioral level
RTL level
Logic level
Behavioral level
The input to a behavioral synthesis system describes the dataow, input/output constraints, memory accesses, and user dened constraints (sample period, latency). The output of the behavioral synthesis system provides the datapath, registers, memories, I/O structures, and a state machine-based controller that satises the same test bench as the input.
Development diagram
Practical templates
combinational circuits and logic multiplexer and demultiplexer counter, comparators, etc. register and sequential circuits synchronious and asynchronious registers shift registers State machines and controllers
Decoder or Multiplexer
using case statement.
process (sel, a, b, c, d) begin case sel is when "00" => mux_out when "01" => mux_out when "10" => mux_out when "11" => mux_out when others => null; end case; end process;
a; b; c; d;
when statement
mx_out <= a when "00" else b when "01" else c when "10" else d;
Counter
up and down counter.
process (clk, reset) begin if reset=1 then count <= "0000"; elsif clk=1 and clkevent then if ce=1 then if load=1 then count <= din; else if dir=1 then count <= count + 1; else count <= count 1; end if; end if; end if; end if; end process;
Register
with asynchronious reset
process (clk, reset) begin if reset=1 then asynchronous reset dout <= 0; elsif (clkevent and clk=1) then dout <= din; end if; end process;
Shift register
VirtexII component instantion
component SRLC16E generic ( INIT : bit_vector := X"0000" ); port ( D : in std_logic; CE : in std_logic; CLK : in std_logic; A0 : in std_logic; A1 : in std_logic; A2 : in std_logic; A3 : in std_logic; Q : out std_logic; Q15 : out std_logic ); end component;
memory
memory
User can choose state encoding type in synthesis tool Sequential One Hot Gray Others enum_encoding attribute can be used to specify encoding directly
=>
next_state <= fst_state; when others null; end case; end process ns_logic; =>
output logic
Block RAM
VirtexII component instantion
component RAMB16_S36 generic ( WRITE_MODE : string := "READ_FIRST"; ); port ( DI : in (31 downto 0); DIP : in std_logic_vector (3 downto 0); ADDR : in std_logic_vector (8 downto 0); EN : in std_logic; WE : in std_logic; SSR : in std_logic; CLK : in std_logic; DO : out std_logic_vector (31 downto 0); DOP : out std_logic_vector (3 downto 0) ); end component;
Synthesis library
The standard for VHDL Register Transfer Level Synthesis is IEEE Std 1076.6-1999.
basic synthesis library use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; arithmetic operations
The purpose of the standard is to dene a syntax and semantics for VHDL RTL synthesis. It denes a subset of IEEE 1076 (VHDL) that is intended to be used in common by all RTL synthesis tools.
Data types
Signal data types std_logic std_logic_vector(*) integer Constant format Binary - "1010101100000000" Hexadecimal - X"AB00" Integer format - conv_integer(const_integer)
Operators
Logical Operators: and, or, nand, nor, xor, xnor Relational Operators: =, /=, < , <= , > , >= Shift Operators: sll , srl , sla , sra , rol , ror Adding Operators: + , - , & Sign Operators: + , Multiplying Operators: * , / , mod , rem Miscellaneous Operators: ** , abs , not
Design issues
Inferring latches Incomplete sensitivity list Loop and Generate statements Seqvential assignment Technology consideration
Inferring latches
Code and circuit example
correct source
process (sel, a, b, c) begin case sel is when "00" => mux_out <= a; when "01" => mux_out <= b; when "10" => mux_out <= c; end case; end process;
process (sel, a, b, c) begin mx_out <= a; case sel is when "00" => mux_out <= a; when "01" => mux_out <= b; when "10" => mux_out <= c; end case; end process;
uncavered values
=>
latch generation
a; b; c; d;
Seqvential assignment
Order of signal assignments does not affect synthesis and simulation as long as the sensitivity list is complete. However, if using signals and variables the order may affect simulation and synthesis
Sig_s <= not Test1_v; Test1_v := Test2_v and B and C; Test2_v := D and E;
Technology consideration
The developer of a synthesizable behavioral VHDL description MUST consider the implementation technology when writing the code Some FPGA families do not have internal tri-state devices - behavioral descriptions that are based on internal tri-state busses will fail in the technology mapping phase Many PLDs have ip ops only on the I/O pins - state machines with too many I/O ports and state variables simply wont t
Design improvements
Basic issues logic delay wire delay Solution - using paralel technics Paralel blocks Pipeline
Paralel blocks
Basic paralel technic Easy for implementation Increasing throuput
PE Input data PE Output data
Pipeline
Basic paralel technic Paralel computing - similar computation time Can eliminate wire delay Higher freqvency can be reach
Reg Reg Reg
Conclusion
Model translation from higher to lower level Synthesis levels - use only RTL and Logic levels Use only predened templates Issues - inferring latches, incomplete sensitivity list, etc Design speed-up - pipeline and other paralel technics