OpenCores
URL https://opencores.org/ocsvn/nocem/nocem/trunk

Subversion Repositories nocem

[/] [nocem/] [trunk/] [VHDL/] [access_point_exerciser.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 schelleg
 
2
-----------------------------------------------------------------------------
3
-- NoCem -- Network on Chip Emulation Tool for System on Chip Research 
4
-- and Implementations
5
-- 
6
-- Copyright (C) 2006  Graham Schelle, Dirk Grunwald
7
-- 
8
-- This program is free software; you can redistribute it and/or
9
-- modify it under the terms of the GNU General Public License
10
-- as published by the Free Software Foundation; either version 2
11
-- of the License, or (at your option) any later version.
12
-- 
13
-- This program is distributed in the hope that it will be useful,
14
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
-- GNU General Public License for more details.
17
-- 
18
-- You should have received a copy of the GNU General Public License
19
-- along with this program; if not, write to the Free Software
20
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
21
-- 02110-1301, USA.
22
-- 
23
-- The authors can be contacted by email: <schelleg,grunwald>@cs.colorado.edu 
24
-- 
25
-- or by mail: Campus Box 430, Department of Computer Science,
26
-- University of Colorado at Boulder, Boulder, Colorado 80309
27
-------------------------------------------------------------------------------- 
28
 
29
 
30
-- 
31 2 schelleg
-- Filename: access_point_exerciser.vhd
32 4 schelleg
-- 
33 2 schelleg
-- Description: access point exerciser for nonVC designs
34 4 schelleg
-- 
35 2 schelleg
 
36 4 schelleg
 
37
 
38 2 schelleg
library IEEE;
39
use IEEE.STD_LOGIC_1164.ALL;
40
use IEEE.STD_LOGIC_ARITH.ALL;
41
use IEEE.STD_LOGIC_UNSIGNED.ALL;
42
 
43
use work.pkg_nocem.all;
44
 
45
 
46
 
47
entity access_point_exerciser is
48
        Generic(
49
 
50
                DELAY_START_COUNTER_WIDTH : integer := 32;
51
                DELAY_START_CYCLES : integer := 500;
52
 
53
 
54
                BURST_LENGTH : integer := 5;
55
                INIT_DATA_OUT : data_word := CONV_STD_LOGIC_VECTOR(1,NOCEM_DW);
56
 
57
                INTERVAL_COUNTER_WIDTH : integer := 8;
58
                DATA_OUT_INTERVAL : integer := 16;
59
 
60 4 schelleg
           INIT_DEST_ADDR : integer := 2
61 2 schelleg
 
62 4 schelleg
 
63
 
64 2 schelleg
                 )      ;
65
    Port (
66
 
67 4 schelleg
                -- arbitration lines (usage depends on underlying network)
68
                arb_req         : out  std_logic;
69
                arb_cntrl_out   : out  arb_cntrl_word;
70
 
71
                arb_grant         : in std_logic;
72
                arb_cntrl_in   : in  arb_cntrl_word;
73
 
74
                datain        : in   data_word;
75
                datain_valid  : in   std_logic;
76
                datain_recvd  : out  std_logic;
77
 
78
                dataout       : out data_word;
79
                dataout_valid : out std_logic;
80
                dataout_recvd : in  std_logic;
81
 
82
                pkt_cntrl_in        : in   pkt_cntrl_word;
83
                pkt_cntrl_in_valid  : in   std_logic;
84
                pkt_cntrl_in_recvd  : out  std_logic;
85
 
86
                pkt_cntrl_out       : out pkt_cntrl_word;
87
                pkt_cntrl_out_valid : out std_logic;
88 2 schelleg
                pkt_cntrl_out_recvd : in  std_logic;
89 4 schelleg
 
90
                clk : in std_logic;
91 2 schelleg
      rst : in std_logic
92
 
93
                );
94
 
95
 
96
 
97
end access_point_exerciser;
98
 
99
architecture Behavioral of access_point_exerciser is
100
 
101
 
102
 
103
 
104
signal rst_i : std_logic;
105
signal rst_counter : std_logic_vector(DELAY_START_COUNTER_WIDTH-1 downto 0);
106
signal interval_counter : std_logic_vector(INTERVAL_COUNTER_WIDTH-1 downto 0);
107
signal dataout_reg : std_logic_vector(NOCEM_DW-1 downto 0);
108
signal pkt_cntrl_out_reg : pkt_cntrl_word;
109
 
110
 
111 4 schelleg
signal burst_counter : std_logic_vector(7 downto 0);
112
 
113
signal datain_reg : data_word;
114
signal pkt_cntrl_in_reg : pkt_cntrl_word;
115
 
116
 
117 2 schelleg
  type stateType is (init_st,sending_st,getting_arb_st);
118
  signal state,nextState : stateType;
119
 
120
 
121
begin
122
 
123
rst_gen : process (clk,rst)
124
begin
125
        if rst='1' then
126
                rst_i <= '1';
127
                rst_counter <= (others => '0');
128
        elsif clk'event and clk ='1' then
129
                rst_counter <= rst_counter+1;
130
                if rst_counter = DELAY_START_CYCLES then
131
                                 rst_i <= '0';
132
                end if;
133
        end if;
134
end process;
135
 
136
 
137
dataout_gen_clkd : process (clk,rst_i,nextState)
138
begin
139
        if rst_i = '1' then
140
                 state <= init_st;
141 4 schelleg
                 interval_counter               <= (others => '0');
142
                 dataout_reg                    <= INIT_DATA_OUT;
143
 
144
                 -- setup pkt_cntrl correctly
145
                 pkt_cntrl_out_reg      <= CONV_STD_LOGIC_VECTOR(INIT_DEST_ADDR,NOCEM_PKT_CNTRL_WIDTH);
146
 
147
 
148
 
149 2 schelleg
                 burst_counter       <= (others => '0');
150
        elsif clk'event and clk='1' then
151
                state <= nextState;
152
        case state is
153
        when init_st =>
154 4 schelleg
                                interval_counter <= interval_counter+1;
155 2 schelleg
                                burst_counter <= (others => '0');
156
                                --dataout_reg <=  INIT_DATA_OUT;
157
                                --pkt_cntrl_out_reg <= 
158
                        when getting_arb_st =>
159
                                interval_counter <= (others => '0');
160
 
161
                                if nextState = sending_st or nextState = init_st then
162 4 schelleg
                                        dataout_reg <= dataout_reg + 1;
163 2 schelleg
                                        burst_counter <= burst_counter+1;
164 4 schelleg
                                end if;
165 2 schelleg
 
166 4 schelleg
                                if nextState = init_st then
167
                                        pkt_cntrl_out_reg <= pkt_cntrl_out_reg + 1;
168
                                end if;
169
 
170
 
171
                        when sending_st =>
172 2 schelleg
                                if arb_grant = '1' and dataout_recvd = '1' then
173 4 schelleg
                                        burst_counter <=        burst_counter + 1;
174
                                end if;
175
 
176
                                if nextState = init_st then
177
                                        pkt_cntrl_out_reg <= pkt_cntrl_out_reg + 1;
178
                                end if;
179 2 schelleg
 
180
                        when others =>
181
                                null;
182
                end case;
183
        end if;
184
end process;
185
 
186
 
187
dataout_gen_uclkd : process (pkt_cntrl_out_reg, pkt_cntrl_out_recvd,state, interval_counter, dataout_reg, arb_grant, dataout_recvd, burst_counter)
188
begin
189
 
190
                 arb_req         <= '0';
191
                 dataout         <= (others => '0');
192
                 dataout_valid   <= '0';
193 4 schelleg
                 nextState <= init_st;
194
                 arb_cntrl_out <= (others => '0');
195
                 pkt_cntrl_out   <= (others => '0');
196
                 pkt_cntrl_out_valid <= '0';
197 2 schelleg
 
198
        case state is
199
        when init_st =>
200
                                        if interval_counter = CONV_STD_LOGIC_VECTOR(DATA_OUT_INTERVAL,INTERVAL_COUNTER_WIDTH) then
201 4 schelleg
                                                nextState <= getting_arb_st;
202
                                        else
203 2 schelleg
                                                nextState <= init_st;
204 4 schelleg
                                        end if;
205
 
206 2 schelleg
                        when getting_arb_st =>
207
                                arb_req <= '1';
208
                                dataout <= dataout_reg;
209 4 schelleg
                                dataout_valid <= '1';
210
 
211 2 schelleg
                                pkt_cntrl_out <= pkt_cntrl_out_reg;
212 4 schelleg
                                pkt_cntrl_out_valid <= '1';
213 2 schelleg
 
214
 
215
                                if arb_grant = '1' and dataout_recvd = '1' and pkt_cntrl_out_recvd = '1'and BURST_LENGTH /= 1 then
216
                                        nextState <= sending_st;
217 4 schelleg
                                elsif   arb_grant = '1' and dataout_recvd = '1' and pkt_cntrl_out_recvd = '1' and BURST_LENGTH = 1 then
218
                                        nextState <= init_st;
219 2 schelleg
                                else
220
                                        nextState <= getting_arb_st;
221 4 schelleg
                                end if;
222 2 schelleg
 
223 4 schelleg
 
224
 
225
 
226 2 schelleg
                        when sending_st =>
227
                                arb_req <= '1';
228
                                dataout <= dataout_reg;
229 4 schelleg
                                dataout_valid <= '1';
230
 
231
                                if burst_counter = BURST_LENGTH then
232
                                        nextState <= init_st;
233
                                else
234
                                        nextState <= sending_st;
235 2 schelleg
                                end if;
236
 
237
                        when others =>
238
                                null;
239
                end case;
240
end process;
241
 
242
 
243 4 schelleg
 
244
datain_gather_clkd : process (clk,rst)
245
begin
246
 
247
        if rst='1' then
248
                --datain_recvd      <= '0';
249
                datain_reg            <= (others => '0');
250
                pkt_cntrl_in_reg        <= (others => '0');
251
                --pkt_cntrl_in_recvd <= '0';
252
        elsif clk'event and clk= '1' then
253
                if datain_valid = '1' then
254
                        datain_reg <= datain;
255
                        --datain_recvd <= '1';
256
                        --pkt_cntrl_in_recvd <= '1';
257
                else
258
                        --datain_recvd <= '0';
259
                        --pkt_cntrl_in_recvd <= '0';
260
                end if;
261
 
262
                if pkt_cntrl_in_valid = '1' then
263
                        pkt_cntrl_in_reg <= pkt_cntrl_in;
264
                        --pkt_cntrl_in_recvd  <= '1';
265
                else
266
                        --pkt_cntrl_in_recvd  <= '0';
267
                end if;
268
        end if;
269
 
270
end process;
271
 
272
datain_gather_uclkd : process (datain_valid,pkt_cntrl_in_valid)
273
begin
274
 
275
        datain_recvd <= '0';
276
        pkt_cntrl_in_recvd <= '0';
277
 
278
        if datain_valid = '1' then
279
                datain_recvd <= '1';
280
        end if;
281
 
282
        if pkt_cntrl_in_valid = '1' then
283
                pkt_cntrl_in_recvd <= '1';
284
        end if;
285
 
286
 
287
end process;
288
 
289
 
290
 
291
 
292
 
293 2 schelleg
end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.