UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor navyamohan
Visitor
1,069 Views
Registered: ‎01-27-2015

Storing floating point values in BRAM ipcore

I want to store a set of floating point values in BRAM from a COE file. How can I initialize the BRAM using these values? I have the coe file given below:

----------------------------------------------------

memory_initialization_radix=10;
memory_initialization_vector=
1.1,
1.1,
1,
1,
0,
0,
0,
0;

----------------------------------------------------

 

 

Whenever I try to do the same I am getting the error given below:

---------------------------------------------------------

ERROR:sim - Invalid coefficient value 1.1 in COE file.
WARNING:sim - A core named 'BRAM_test' already exists in the project. Output
products for this core may be overwritten.
Resolving generics for 'BRAM_test'...
ERROR:sim - IP initializer could not set IP core parameters on IP model
ERROR:sim - Failed to initialize IP model.
ERROR:sim - Failed executing Tcl generator.
ERROR:sim - Failed to generate 'BRAM_test'. Failed executing Tcl generator.

---------------------------------------------------------

 

 

Could anyone please suggest to solve the problem of  storage of floating point values in BRAM ipcore?Can i use any other ipcore for storing the floating point values?

 

 

 

Thanks

Navya

0 Kudos
4 Replies
Xilinx Employee
Xilinx Employee
1,043 Views
Registered: ‎08-02-2011

Re: Storing floating point values in BRAM ipcore

You can't put real values directly this way because it's arbitrary. You need to actually specify the bit vector of the value you want to be stored in the BRAM in a way that makes sense for how the rest of the logic is going to interpret it.

For example, 2.5 can be represented as a fixed-point or floating-point value. What does your logic actually expect? Based on that, you would do the quantization of 2.5 to a fixed point value or convert it to single/double precision float format and enter the 32/64-bit value.

 

These might help:

https://www.h-schmidt.net/FloatConverter/IEEE754.html

https://www.rapidtables.com/convert/number/decimal-to-binary.html

www.xilinx.com
0 Kudos
Visitor navyamohan
Visitor
1,030 Views
Registered: ‎01-27-2015

Re: Storing floating point values in BRAM ipcore

I want these stored real values to be given as input to the transform Ipcore block to perform the transformation. Do you mean bit wise equivalent of each digit by the term "bit vector value"? If so it will be difficult for long length of data. Could you please clarify my doubt once more?

 

Is there any other work around for the same?

Is it possible to store real values in FIFO ipcore block using COE file?

 

0 Kudos
Scholar drjohnsmith
Scholar
1,021 Views
Registered: ‎07-09-2009

Re: Storing floating point values in BRAM ipcore

the coe format goes back a long time,,

 

as such, it does not understand floating point numbers which are relatively new to fpga's.

 

as for initialising values in a fifo at start up,

 

 

there are multiple ways that a fifo can be made in an fpga,

   from the flip flop based, through to srl, bram and built in fifo's

 

each have different characteristics,

 

the built in fifo's of some devices can't be initialised with data,

    some fifos can be cleared at reset, but 

  

 

 

 

<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Explorer
Explorer
1,012 Views
Registered: ‎01-09-2012

Re: Storing floating point values in BRAM ipcore

@navyamohan

 

I do this as follows:

 

   amp_ramb36_inst: RAMB36E1
   generic map
   (
      RDADDR_COLLISION_HWCONFIG   => "DELAYED_WRITE",
      DOA_REG                     =>  0,
      DOB_REG                     =>  1,
      INIT_08(224 to 255)         => X"3A34F1E5", -- the average of the calibrated signals is 0.00069025  which is close to the theoretical value of 10^(( 0 - 63)/20) = 0.00070794578438413800
      INIT_08(192 to 223)         => X"3A4F8F75", -- the average of the calibrated signals is 0.00079178  which is close to the theoretical value of 10^(( 1 - 63)/20) = 0.00079432823472428100
.

.

.
      INIT_0F( 32 to  63)         => X"3F733024", -- the average of the calibrated signals is 0.949953333 which is close to the theoretical value of 10^((62 - 63)/20) = 0.89125093813374500000
      INIT_0F(  0 to  31)         => X"3F800000", -- the average of the calibrated signals is  1.0        which is close to the theoretical value of 10^((63 - 63)/20) = 1.00000000000000000000
      EN_ECC_READ                 => FALSE,
      EN_ECC_WRITE                => FALSE,
      INIT_A                      => X"000000000",
      INIT_B                      => X"000000000",
      INIT_FILE                   => "NONE",
      RAM_MODE                    => "TDP",
      RAM_EXTENSION_A             => "NONE",
      RAM_EXTENSION_B             => "NONE",
      READ_WIDTH_A                => 36,
      WRITE_WIDTH_A               => 36,
      READ_WIDTH_B                => 36,
      WRITE_WIDTH_B               => 36,
      RSTREG_PRIORITY_A           => "RSTREG",
      RSTREG_PRIORITY_B           => "RSTREG",
      SRVAL_A                     => X"000000000",
      SRVAL_B                     => X"03F800000",    -- Correction amplitude := 1.0 (ieee754 single precision) if no correction is required
      SIM_COLLISION_CHECK         => "NONE",
      SIM_DEVICE                  => "7SERIES",
      WRITE_MODE_A                => "WRITE_FIRST",
      WRITE_MODE_B                => "WRITE_FIRST"
   )
   port map
   (
      CLKARDCLK                   => i_cpu_clk,
      REGCEAREGCE                 => HIGH,
      RSTRAMARSTRAM               => LOW,
      RSTREGARSTREG               => LOW,
      ENARDEN                     => HIGH,
      WEA( 0)                     => i_ampl_usr_bram_wr,
      WEA( 1)                     => i_ampl_usr_bram_wr,
      WEA( 2)                     => i_ampl_usr_bram_wr,
      WEA( 3)                     => i_ampl_usr_bram_wr,
      ADDRARDADDR( 4 downto 0)    => LOW8( 4 downto  0),
      ADDRARDADDR(14 downto 5)    => i_ampl_usr_bram_addr(11 downto  2),
      ADDRARDADDR(15)             => LOW,
      DIPADIP                     => LOW4,
      DIADI                       => i_ampl_usr_bram_data,
      DOPADOP                     => open,
      DOADO                       => o_ampl_bram_usr_data,
      CASCADEINA                  => LOW,
      CASCADEOUTA                 => open,

      CLKBWRCLK                   => i_adc_clk,
      REGCEB                      => HIGH,
      RSTRAMB                     => LOW,
      RSTREGB                     => LOW,
      ENBWREN                     => HIGH,
      WEBWE( 0)                   => LOW,
      WEBWE( 1)                   => LOW,
      WEBWE( 2)                   => LOW,
      WEBWE( 3)                   => LOW,
      WEBWE( 4)                   => LOW,
      WEBWE( 5)                   => LOW,
      WEBWE( 6)                   => LOW,
      WEBWE( 7)                   => LOW,
      ADDRBWRADDR( 4 downto  0)   => LOW8( 4 downto  0),
      ADDRBWRADDR(10 downto  5)   => att_addr,
      ADDRBWRADDR(11)             => corr_ena_b,
      ADDRBWRADDR(15 downto 12)   => LOW4,
      DIPBDIP                     => LOW4,
      DIBDI                       => LOW32,
      DOPBDOP                     => open,
      DOBDO                       => amp_corr,
      CASCADEINB                  => LOW,
      CASCADEOUTB                 => open,

      INJECTSBITERR               => LOW,
      INJECTDBITERR               => LOW,
      SBITERR                     => open,
      DBITERR                     => open,
      ECCPARITY                   => open,
      RDADDRECC                   => open
   );

 

Is this what you wanted?

 

Cheers

Goran

0 Kudos