Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
So, with Xilinx/Altera this code should always yield a "read_before_write" block RAM?Xilinx and Altera both have the feature
type memory_matrix is array 0 to x of std_logic_vector(y downto 0);
signal memory:memory_matrix;
process(clock) is
begin
if rising_edge(clock) then
memory (to_integer(address))<=in_data;
end if;
end process;
out_data<=memory(address);
So, with Xilinx/Altera this code should always yield a "read_before_write" block RAM?
Code:type memory_matrix is array 0 to x of std_logic_vector(y downto 0); signal memory:memory_matrix; process(clock) is begin if rising_edge(clock) then memory (to_integer(address))<=in_data; end if; end process; out_data<=memory(address);
So, with Xilinx/Altera this code should always yield a "read_before_write" block RAM?
Code:type memory_matrix is array 0 to x of std_logic_vector(y downto 0); signal memory:memory_matrix; process(clock) is begin if rising_edge(clock) then memory (to_integer(address))<=in_data; end if; end process; out_data<=memory(address);
I wouldn't expect either Xilinx or Altera to create BRAM from this
type memory_matrix is array 0 to x of std_logic_vector(y downto 0);
signal memory:memory_matrix;
process(clock) is
begin
if rising_edge(clock) then
memory (to_integer(address))<=in_data;
end if;
end process;
out_data<=memory(address);
out_data<=memory(address);--show yourself NOW!
Yes, my design must use a "read before write" memory - why is that an "issue" ?IMO, if you care about such behaviour, then there is probably an issue with the design somewhere.
vGoodtimes,
Code:type memory_matrix is array 0 to x of std_logic_vector(y downto 0); signal memory:memory_matrix; process(clock) is begin if rising_edge(clock) then memory (to_integer(address))<=in_data; end if; end process; out_data<=memory(address);
It successfully infers BRAM in Cyclone IV and Lattice XP devices.
And as I see it, if it passes synthesis and infers a BRAM - this BRAM must be "read before write".
As this is explicitly described in the VHDL code.
Code:out_data<=memory(address);--show yourself NOW!
TrickyDicky,
Yes, my design must use a "read before write" memory - why is that an "issue" ?
Wrong understanding of the terminology from my side.No it is not read before write what it is, is a asynchronous read single port RAM, i.e. a flow-through RAM.
This is why I don't like Xilinx's terms. It actually describes the behavior of the data output of the port being written to. Reading from port B when writing to port A actually requires port A (the write port) to be in read-first mode, and port B (the read port) can be in any mode. To get the currently written data on the output requires a mux, either with the write port in write-first mode or by just using the input data. As a developer, when I head "read-first" I think about typical use cases of dual-port BRAM and except it to mean the read port reads before the write port.To my sometimes faulty recollection: Dual port RAMs use the read-before-write and write-before read settings to know how to deal with simultaneous access to the exact same location from two different ports.
The code you show was for an async read, which means there is no x before y relationship. The data is written and immediately read, similar to treating the BRAM as a register.Anyways, from my understanding both: "read before write" and "write before read" refer to RAM with an un-registered output.