PoC.mem.ocram.sdp

Inferring / instantiating simple dual-port memory, with:

  • dual clock, clock enable,

  • 1 read port plus 1 write port.

Both reading and writing are synchronous to the rising-edge of the clock. Thus, when reading, the memory data will be outputted after the clock edge, i.e, in the following clock cycle.

The generalized behavior across Altera and Xilinx FPGAs since Stratix/Cyclone and Spartan-3/Virtex-5, respectively, is as follows:

Mixed-Port Read-During-Write

When reading at the write address, the read value will be unknown which is aka. “don’t care behavior”. This applies to all reads (at the same address) which are issued during the write-cycle time, which starts at the rising-edge of the write clock and (in the worst case) extends until the next rising-edge of the write clock.

For simulation, always our dedicated simulation model PoC.mem.ocram.tdp_sim is used.

Entity Declaration:

 1    A_BITS    : positive;                              -- number of address bits
 2    D_BITS    : positive;                              -- number of data bits
 3    RAM_TYPE  : T_RAM_TYPE := RAM_TYPE_AUTO;
 4    FILENAME  : string    := ""                        -- file-name for RAM initialization
 5  );
 6  port (
 7    rclk  : in  std_logic;                            -- read clock
 8    rce   : in  std_logic;                            -- read clock-enable
 9    wclk  : in  std_logic;                            -- write clock
10    wce   : in  std_logic;                            -- write clock-enable
11    we    : in  std_logic;                            -- write enable
12    ra    : in  unsigned(A_BITS-1 downto 0);          -- read address
13    wa    : in  unsigned(A_BITS-1 downto 0);          -- write address
14    d     : in  std_logic_vector(D_BITS-1 downto 0);  -- data in
15    q     : out std_logic_vector(D_BITS-1 downto 0)    -- data out
16  );
17end entity;