Klemens Schölhorn
5f47c1327f
This adds an explicit terminal_buffer entity to help with the blockram inference. Both read and write are completely independent, although they run with the same clock for now.
38 lines
884 B
VHDL
38 lines
884 B
VHDL
library ieee;
|
|
|
|
use ieee.std_logic_1164.all;
|
|
use ieee.std_logic_unsigned.all;
|
|
use ieee.numeric_std.all;
|
|
|
|
entity terminal_buffer is
|
|
port (
|
|
clk: in std_logic;
|
|
we: in std_logic;
|
|
wa: in std_logic_vector(12 downto 0);
|
|
ra: in std_logic_vector(12 downto 0);
|
|
di: in std_logic_vector(7 downto 0);
|
|
do: out std_logic_vector(7 downto 0)
|
|
);
|
|
end terminal_buffer;
|
|
|
|
architecture syn of terminal_buffer is
|
|
type ram_type is array((2**13 - 1) downto 0) of std_logic_vector(7 downto 0);
|
|
signal RAM: ram_type;
|
|
signal read_a: std_logic_vector(ra'range);
|
|
begin
|
|
|
|
process(clk)
|
|
begin
|
|
if rising_edge(clk) then
|
|
if we = '1' then
|
|
RAM(to_integer(unsigned(wa))) <= di;
|
|
end if;
|
|
|
|
read_a <= ra;
|
|
end if;
|
|
end process;
|
|
|
|
do <= RAM(to_integer(unsigned(read_a)));
|
|
|
|
end syn;
|