-
Notifications
You must be signed in to change notification settings - Fork 0
/
trb_net16_gbe_response_constructor_Test1.vhd
160 lines (126 loc) · 4.5 KB
/
trb_net16_gbe_response_constructor_Test1.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
USE IEEE.std_logic_UNSIGNED.ALL;
library work;
use work.trb_net_std.all;
use work.trb_net_components.all;
use work.trb_net16_hub_func.all;
use work.trb_net_gbe_components.all;
--********
-- Response Constructor which recevies data and does nothing except counting incoming packets
--
entity trb_net16_gbe_response_constructor_Test1 is
port (
CLK : in std_logic; -- system clock
RESET : in std_logic;
-- INTERFACE
PS_DATA_IN : in std_logic_vector(8 downto 0);
PS_WR_EN_IN : in std_logic;
PS_ACTIVATE_IN : in std_logic;
PS_RESPONSE_READY_OUT : out std_logic;
PS_BUSY_OUT : out std_logic;
PS_SELECTED_IN : in std_logic;
PS_SRC_MAC_ADDRESS_IN : in std_logic_vector(47 downto 0);
PS_DEST_MAC_ADDRESS_IN : in std_logic_vector(47 downto 0);
PS_SRC_IP_ADDRESS_IN : in std_logic_vector(31 downto 0);
PS_DEST_IP_ADDRESS_IN : in std_logic_vector(31 downto 0);
PS_SRC_UDP_PORT_IN : in std_logic_vector(15 downto 0);
PS_DEST_UDP_PORT_IN : in std_logic_vector(15 downto 0);
TC_RD_EN_IN : in std_logic;
TC_DATA_OUT : out std_logic_vector(8 downto 0);
TC_FRAME_SIZE_OUT : out std_logic_vector(15 downto 0);
TC_FRAME_TYPE_OUT : out std_logic_vector(15 downto 0);
TC_IP_PROTOCOL_OUT : out std_logic_vector(7 downto 0);
TC_DEST_MAC_OUT : out std_logic_vector(47 downto 0);
TC_DEST_IP_OUT : out std_logic_vector(31 downto 0);
TC_DEST_UDP_OUT : out std_logic_vector(15 downto 0);
TC_SRC_MAC_OUT : out std_logic_vector(47 downto 0);
TC_SRC_IP_OUT : out std_logic_vector(31 downto 0);
TC_SRC_UDP_OUT : out std_logic_vector(15 downto 0);
TC_BUSY_IN : in std_logic;
RECEIVED_FRAMES_OUT : out std_logic_vector(15 downto 0);
SENT_FRAMES_OUT : out std_logic_vector(15 downto 0);
-- END OF INTERFACE
-- debug
DEBUG_OUT : out std_logic_vector(31 downto 0)
);
end trb_net16_gbe_response_constructor_Test1;
architecture trb_net16_gbe_response_constructor_Test1 of trb_net16_gbe_response_constructor_Test1 is
--attribute HGROUP : string;
--attribute HGROUP of trb_net16_gbe_response_constructor_Forward : architecture is "GBE_MAIN_group";
attribute syn_encoding : string;
type dissect_states is (IDLE, SAVE, CLEANUP);
signal dissect_current_state, dissect_next_state : dissect_states;
attribute syn_encoding of dissect_current_state: signal is "safe,gray";
signal ff_wr_en : std_logic;
signal ff_rd_en : std_logic;
signal resp_bytes_ctr : std_logic_vector(15 downto 0);
signal ff_empty : std_logic;
signal ff_full : std_logic;
signal ff_q : std_logic_vector(8 downto 0);
signal ff_rd_lock : std_logic;
signal state : std_logic_vector(3 downto 0);
signal rec_frames : std_logic_vector(15 downto 0);
signal sent_frames : std_logic_vector(15 downto 0);
begin
DISSECT_MACHINE_PROC : process(CLK)
begin
if rising_edge(CLK) then
if (RESET = '1') then
dissect_current_state <= IDLE;
else
dissect_current_state <= dissect_next_state;
end if;
end if;
end process DISSECT_MACHINE_PROC;
DISSECT_MACHINE : process(dissect_current_state, PS_WR_EN_IN, PS_ACTIVATE_IN, PS_DATA_IN)
begin
case dissect_current_state is
when IDLE =>
state <= x"1";
if (PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1') then
dissect_next_state <= SAVE;
else
dissect_next_state <= IDLE;
end if;
when SAVE =>
state <= x"2";
if (PS_DATA_IN(8) = '1') then
dissect_next_state <= CLEANUP;
else
dissect_next_state <= SAVE;
end if;
when CLEANUP =>
state <= x"5";
dissect_next_state <= IDLE;
end case;
end process DISSECT_MACHINE;
PS_BUSY_OUT <= '0';
TC_DATA_OUT <= (others => '0');
PS_RESPONSE_READY_OUT <= '0';
TC_FRAME_SIZE_OUT <= (others => '0');
TC_FRAME_TYPE_OUT <= x"0008";
TC_DEST_MAC_OUT <= x"9a680f201300";
TC_DEST_IP_OUT <= x"0100a8c0";
TC_DEST_UDP_OUT <= x"50c3";
TC_SRC_MAC_OUT <= x"efbeefbe0000";
TC_SRC_IP_OUT <= x"0b00a8c0";
TC_SRC_UDP_OUT <= x"50c3";
TC_IP_PROTOCOL_OUT <= x"11";
REC_FRAMES_PROC : process(CLK)
begin
if rising_edge(CLK) then
if (RESET = '1') then
rec_frames <= (others => '0');
elsif (dissect_current_state = IDLE and PS_WR_EN_IN = '1' and PS_ACTIVATE_IN = '1') then
rec_frames <= rec_frames + x"1";
end if;
end if;
end process REC_FRAMES_PROC;
RECEIVED_FRAMES_OUT <= rec_frames;
SENT_FRAMES_OUT <= (others => '0');
-- **** debug
DEBUG_OUT(31 downto 0) <= (others => '0');
-- ****
end trb_net16_gbe_response_constructor_Test1;