-
Notifications
You must be signed in to change notification settings - Fork 0
/
avm_pipe.vhd
68 lines (58 loc) · 2.45 KB
/
avm_pipe.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std_unsigned.all;
entity avm_pipe is
generic (
G_ADDRESS_SIZE : integer; -- Number of bits
G_DATA_SIZE : integer -- Number of bits
);
port (
clk_i : in std_logic;
rst_i : in std_logic;
s_avm_waitrequest_o : out std_logic;
s_avm_write_i : in std_logic;
s_avm_read_i : in std_logic;
s_avm_address_i : in std_logic_vector(G_ADDRESS_SIZE - 1 downto 0);
s_avm_writedata_i : in std_logic_vector(G_DATA_SIZE - 1 downto 0);
s_avm_byteenable_i : in std_logic_vector(G_DATA_SIZE / 8 - 1 downto 0);
s_avm_burstcount_i : in std_logic_vector(7 downto 0);
s_avm_readdata_o : out std_logic_vector(G_DATA_SIZE - 1 downto 0);
s_avm_readdatavalid_o : out std_logic;
m_avm_waitrequest_i : in std_logic;
m_avm_write_o : out std_logic;
m_avm_read_o : out std_logic;
m_avm_address_o : out std_logic_vector(G_ADDRESS_SIZE - 1 downto 0);
m_avm_writedata_o : out std_logic_vector(G_DATA_SIZE - 1 downto 0);
m_avm_byteenable_o : out std_logic_vector(G_DATA_SIZE / 8 - 1 downto 0);
m_avm_burstcount_o : out std_logic_vector(7 downto 0);
m_avm_readdata_i : in std_logic_vector(G_DATA_SIZE - 1 downto 0);
m_avm_readdatavalid_i : in std_logic
);
end entity avm_pipe;
architecture synthesis of avm_pipe is
begin
s_avm_waitrequest_o <= (m_avm_write_o or m_avm_read_o) and m_avm_waitrequest_i;
pipe_proc : process (clk_i)
begin
if rising_edge(clk_i) then
s_avm_readdata_o <= m_avm_readdata_i;
s_avm_readdatavalid_o <= m_avm_readdatavalid_i;
if m_avm_waitrequest_i = '0' then
m_avm_write_o <= '0';
m_avm_read_o <= '0';
end if;
if s_avm_waitrequest_o = '0' then
m_avm_write_o <= s_avm_write_i;
m_avm_read_o <= s_avm_read_i;
m_avm_address_o <= s_avm_address_i;
m_avm_writedata_o <= s_avm_writedata_i;
m_avm_byteenable_o <= s_avm_byteenable_i;
m_avm_burstcount_o <= s_avm_burstcount_i;
end if;
if rst_i = '1' then
m_avm_write_o <= '0';
m_avm_read_o <= '0';
end if;
end if;
end process pipe_proc;
end architecture synthesis;