Example: --allow-const-ram-index
The following code snippet demonstrates code that can benefit from the --allow-const-ram-index option. Lines 13, 15, 23, and 25 use a constant index to address the first dimension of the memory:
subtype t_dim1 is std_logic_vector(7 downto 0);
type t_dim1_vector is array(natural range <>) of t_dim1;
subtype t_dim2 is t_dim1_vector(0 to 511);
type t_dim3_vector is array(natural range <>) of t_dim2;
subtype t_dim3 is t_dim3_vector(0 to 3);
signal RAM : t_dim3 := (others => (others => (others => '0')));
...
RAM3Proc_t : process(Clk)
begin
if(rising_edge(Clk)) then
if(WriteEn = '1') then
RAM(3)(to_integer(unsigned(Addr))) <= WriteData3_t;
end if;
ReadData3_t <= RAM(3)(to_integer(unsigned(Addr)));
end if;
end process RAM3Proc_t;
RAM2Proc_t : process(Clk)
begin
if(rising_edge(Clk)) then
if(WriteEn = '1') then
RAM(2)(to_integer(unsigned(Addr))) <= WriteData2_t;
end if;
ReadData2_t <= RAM(2)(to_integer(unsigned(Addr)));
end if;
end process RAM2Proc_t;
...
Setting the --allow-const-ram-index option to 1 (enable) instructs the synthesis tool to infer the code as a RAM block.