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