FPGA Design Tutorial - Advanced HDL Synthesis
FPGA Design Tutorial - Advanced HDL Synthesis
Products
Design Services
Market Solutions
Support
Library
FPGA design services 1-CORE Technologies provides FPGA design services of high quality since 2004. Outsourcing FPGA design to Russia will significantly reduce your design costs.
architecture behavioral of sreg is signal tmp: std_logic_vector(7 downto 0); begin process (CLK) begin if rising_edge(CLK) then if CE='1' then tmp<=tmp(6 downto 0)&DIN; end if; end if; end process; DOUT<=tmp(7); end behavioral; This implementation will use 1 slice instead of 8. The cause of this difference is that SRL16E library element doesn't support reset.
Synthesis constraints
Synthesis constraints are used as guidelines to synthesizer, indicating how it should implement a particular module or signal. Synthesis constraints are not to be confused with implementation constraints, which guide place & route and static timing analysis. Synthesis constraints can be specified in the HDL source, or in separate constraints file. Synthesis constraints depend upon a synthesizer. Specifying synthesis constraints in VHDL source In order to declare a synthesis contraint in VHDL, an attribute must be declared and then linked to the appropriate entity or signal: attribute AttributeName : Type ; attribute AttributeName of ObjectList : ObjectType is AttributeValue ; ObjectList is a list of objects to apply a constraint. Objects that can be assigned constraints are entities, components, labels, signals, variables and types. The following code uses an XST synthesis constraint that forces a multiplier to be implemented in a dedicated DSP48 block. attribute use_dsp48 : string; attribute use_dsp48 of product : signal is "yes"; ... product <= A*B; Specifying synthesis constraints in Verilog source Before Verilog 2001 standard was introduced, Verilog language didn't have any means to specify attributes in source. Synthesis attributes were specified in the comments instead: reg [7:0] dataout[31:0] /* synthesis syn_ramstyle="block_ram" */; These attributes were placed after the signal/module in question. Verilog 2001 (which is now supported by the majority of EDA tools) introduced a syntax element for attribute: (* use_dsp48 = "yes" *) reg [15:0] product;
Consider a dual-port block RAM with 16-bit data words, 6-bit address, one write port and one read port. Here's its VHDL description: library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity mem1 is port ( CLK : in std_logic; WE : in std_logic; WADDR : in std_logic_vector(5 downto 0); RE: in std_logic; RADDR : in std_logic_vector(5 downto 0); DIN : in std_logic_vector(15 downto 0); DOUT : out std_logic_vector(15 downto 0) ); end mem1; architecture behavioral of mem1 is type ram_type is array (63 downto 0) of std_logic_vector (15 downto 0); signal RAM : ram_type; signal read_addr : std_logic_vector(5 downto 0); attribute syn_ramstyle : string; attribute syn_ramstyle of RAM : signal is "block_ram"; begin process (CLK) begin if rising_edge(CLK) then if WE='1' then RAM(conv_integer(WADDR))<=DIN; end if; end if; end process; process (CLK) begin if rising_edge(CLK) then if RE='1' then read_addr<=RADDR; end if; end if; end process; DOUT<=RAM(conv_integer(read_addr)); end behavioral; A Verilog description of the same module: module mem1 (clk,re,we,waddr,raddr,din,dout); input clk; input re; input we; input [5:0] waddr; input [5:0] raddr; input [15:0] din; output [15:0] dout; reg [15:0] ram [63:0]; /* synthesis syn_ramstyle="block_ram" */ reg [5:0] read_addr; always @(posedge clk) begin if (we) ram[waddr] <= din; end always @(posedge clk) begin if (re) read_addr <= raddr; end assign dout = ram[read_addr];
endmodule syn_ramstyle attribute is intended for Synplify, but XST also recognises it. Using behavioral block RAM descriptions is recommended when possible, since it increases portability and facilitates design reuse. Resources Support Library Careers Contacts
Copyright 1-CORE Technologies, 2004-2009. All product and company names mentioned here are trademarks or registered trademarks of their respective owners. Materials from this site can be distributed freely as long as a link to the 1-CORE Technologies website is provided.