Dear all,
Lately I have been trying to design and implement a synchronous FIFO using a cyclic buffer, that can be synthesized by XST to use Block RAMs.
I now have a version that works (it does so in simulation using GHDL). I have attached it below. However, since it doesn't follow the prescribed pattern for BLOCK RAM inference, the code as shown synthesizes to an implementation that uses "distributed RAM" instead.
Fortunately, I can easily get it in a form where BRAM can be inferred by enabling the currently-commented-out line marked "ENABLE FOR BRAM", around line 70.
The thing is that if I do this, the entity stops functioning as intended. This is particularly strange since (as far as I can tell) the change shouldn't affect the architecture's semantics in any way!
Any help/pointers by one of the VHDL gurus here would be much appreciated.
Best regards,
Sidney
------------- ramfifo.vhdl
library ieee;
use ieee.std_logic_1164.all, ieee.numeric_std.all;
entity RAMFIFO is port( CLK : in std_logic; data_in : in std_logic_vector(7 downto 0); data_out : out std_logic_vector(7 downto 0); status : out std_logic_vector(7 downto 0); reset : in std_logic; shift_in : in std_logic; shift_out : in std_logic ); end entity RAMFIFO;
architecture arch of RAMFIFO is
signal cur_address_r : unsigned(3 downto 0) := "0000"; signal cur_address_r2 : unsigned(3 downto 0) := "0000"; signal cur_num_entries : unsigned(3 downto 0) := "0000"; signal cur_address_w : unsigned(3 downto 0);
signal nxt_address_r : unsigned(3 downto 0); signal nxt_num_entries : unsigned(3 downto 0);
signal sig_data_r : std_logic_vector(7 downto 0);
type RAMType is array(0 to 15) of std_logic_vector(7 downto 0);
-- initialize the ram below with sensible ascii values for debugging signal ram : RAMType := ( x"30", x"31", x"32", x"33", x"34", x"35", x"36", x"37", x"38", x"39", x"41", x"42", x"43", x"44", x"45", x"46" );
signal shift_in_possible : std_logic; signal shift_out_possible : std_logic; signal shift_in_will_happen : std_logic; signal shift_out_will_happen : std_logic;
begin
status