PoC.mem.ocram.sdp_wf
Inferring / instantiating simple dual-port memory, with:
single clock, clock enable,
1 read port plus 1 write port.
Command truth table:
ce |
we |
Command |
---|---|---|
0 |
X |
No operation |
1 |
0 |
Read only from memory |
1 |
1 |
Read from and Write to memory |
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.
- Mixed-Port Read-During-Write
When reading at the write address, the read value will be the new data, aka. “write-first behavior”. Of course, the read is still synchronous, i.e, the latency is still one clock cyle.
Entity Declaration:
1entity ocram_sdp_wf is
2 generic (
3 A_BITS : positive; -- number of address bits
4 D_BITS : positive; -- number of data bits
5 FILENAME : string := "" -- file-name for RAM initialization
6 );
7 port (
8 clk : in std_logic; -- clock
9 ce : in std_logic; -- clock-enable
10 we : in std_logic; -- write enable
11 ra : in unsigned(A_BITS-1 downto 0); -- read address
12 wa : in unsigned(A_BITS-1 downto 0); -- write address
13 d : in std_logic_vector(D_BITS-1 downto 0); -- data in
14 q : out std_logic_vector(D_BITS-1 downto 0) -- data out
15 );
16end entity;