-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathport_manager.vhd
41 lines (35 loc) · 975 Bytes
/
port_manager.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity port_manager is
generic (blocksize : integer := 64);
port (clk, readio, writeio: in std_logic;
addressbus: in std_logic_vector (15 downto 0);
databus : inout std_logic_vector (15 downto 0)
);
end entity port_manager;
architecture behavioral of port_manager is
type mem is array (0 to blocksize - 1) of std_logic_vector (15 downto 0);
begin
process (clk)
variable buffermem : mem := (others => (others => '0'));
variable ad : integer;
variable init : boolean := true;
begin
if clk'event and clk = '1' then
ad := to_integer(unsigned(addressbus));
if read_io = '1' then
memdataready <= '0';
if ad >= blocksize then
databus <= (others => 'Z');
else
databus <= buffermem(ad);
end if;
elsif write_io = '1' then
if ad < blocksize then
buffermem(ad) := databus;
end if;
end if;
end if;
end process;
end architecture behavioral;