Vendor | Xilinx |
FAQ Entry Author | Brian Philofsky |
FAQ Entry Editor | Philip Freidin |
FAQ Entry Date | 4/9/2002 updated 10/13/2003 |
Q. How to initialize BRAM |
A.When you initialize block RAMs, in a synthesis flow, you need to specify the initialization twice,once for synthesis to pass on to the place and route software, and once for the simulation software. When using VHDL, in order to pass INIT information during synthesis,
VHDL attributes are used
-- The attribute needs to be only defined once for each attribute name attribute INIT_00: string; attribute INIT_01: string; : : -- The label for an attribute (the assigned value) will need to be done for each instance of -- the block RAM attribute INIT_00 of U1 : label is "f0c33cf0f0f00f0ff0f00f0f0f3cc30ffc03fcc003fc033ffcc03fc0033fc03f"; attribute INIT_01 of U1 : label is "000000000000000000000000000000006a52a92aaa6aa5a995a5565554954a56"; : : For Verilog synthesis, the attribute is generally embedded in a comment.
The format for the
For simulation, the INIT information must be passed by a defparam if
you are using Verilog
The user must ensure that values passed for simulation match that for
implementation or else
The reason for the need to specify this information twice is an unfortunate
disconnect
Verilog VHDL
For more information, try this: go to http://www.xilinx.com/support/support.htm
and
10073
FPGA express info
Starting with the 4.1i release, XST can now understand generics and
use them for
-- Sample code using XST passing INITs via generics -- library IEEE; use IEEE.std_logic_1164.all; library unisim; use unisim.vcomponents.all; entity Ram is port( clk : in std_ulogic; ADDR : in STD_LOGIC_VECTOR(11 downto 0); dout : out STD_LOGIC_VECTOR(11 downto 0) ); end Ram; architecture Ram of Ram is ---- Component declarations ----- component RAMB4_S1 generic( INIT_00 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_01 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_02 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_03 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_04 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_05 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_06 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_07 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_08 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_09 : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0A : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0B : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0C : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0D : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0E : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000"; INIT_0F : BIT_VECTOR := X"0000000000000000000000000000000000000000000000000000000000000000" ); port ( ADDR : in STD_LOGIC_VECTOR(11 downto 0); CLK : in std_ulogic; DI : in STD_LOGIC_VECTOR(0 downto 0); EN : in std_ulogic; RST : in std_ulogic; WE : in std_ulogic; DO : out STD_LOGIC_VECTOR(0 downto 0) ); end component; ---- Constants ----- constant VCC_CONSTANT : STD_LOGIC := '1'; constant GND_CONSTANT : STD_LOGIC := '0'; ---- Signal declarations used on the diagram ---- signal GND : STD_LOGIC; signal VCC : STD_LOGIC; ---- Configuration specifications for declared components begin ---- Component instantiations ---- U1 : RAMB4_S1 generic map ( INIT_00 => X"f0c33cf0f0f00f0ff0f00f0f0f3cc30ffc03fcc003fc033ffcc03fc0033fc03f", INIT_01 => X"000000000000000000000000000000006a52a92aaa6aa5a995a5565554954a56", INIT_02 => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_03 => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_04 => X"ffcccc33f3cccc33cc3333cfcc3333ffcf30f30cf30c00ffff0030cf30cf0cf3", INIT_05 => X"73733939ccccc7c7e3e333339c9ccecefcc0033ff0030ffc3ff0c00ffcc0033f", INIT_06 => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_07 => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_08 => X"f030300c000f0fcff3f0f000300c0c0ffff00ff30ff0300ff00c0ff0cff00fff", INIT_09 => X"f81ffa07fa05fa05a05fa05fe05ff81ff300cff3cff3300ff00ccff3cff300cf", INIT_0A => X"ff00abd5ff002addbb5400ffabd500ff4df3df3004ff4df3cfb2ff200cfbcfb2", INIT_0B => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_0C => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_0D => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_0E => X"0000000000000000000000000000000000000000000000000000000000000000", INIT_0F => X"0000000000000000000000000000000000000000000000000000000000000000" ) port map( ADDR => ADDR, CLK => CLK, DI(0) => GND, DO(0) => dout(0), EN => VCC, RST => GND, WE => GND ); ---- Power , ground assignment ---- GND <= GND_CONSTANT; VCC <= VCC_CONSTANT; end Ram; =========================================================================================== UPDATE: 4/9/2002 A reader of C.A.F was having problems with Sim and Synth of the
16X1 ROMs, and I pointed him
========================== Thank you very much, Philip. I tried the suggested approach,
and modified it
entity rom is
architecture rom of rom is -- component declarations --
-- signal declarations --
-- configuration specifications for declared components -- begin -- component instantiations --
-- processes --
It's my understanding that as of ISE4.1i, we can now use generics
to initialize
=========================================================================================== UPDATE: 10/13/2003
If you are using Synplify Pro, the 7.3.3 release now supports passing the INIT values using generics or defparams. This allows the INIT values and other component attributes to be entered only once for synthesis and simulation as a generic or defparam. It should be less error prone than remembering to change both the attribute for synthesis and the generic/defparam for simulation. Bob Synplicity FAE - Colorado/Utah
|