1 |
5 |
sonicwave |
------------------------------------------------------------------------------
|
2 |
|
|
-- user_logic.vhd - entity/architecture pair
|
3 |
|
|
------------------------------------------------------------------------------
|
4 |
|
|
--
|
5 |
|
|
-- ***************************************************************************
|
6 |
|
|
-- ** Copyright (c) 1995-2010 Xilinx, Inc. All rights reserved. **
|
7 |
|
|
-- ** **
|
8 |
|
|
-- ** Xilinx, Inc. **
|
9 |
|
|
-- ** XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" **
|
10 |
|
|
-- ** AS A COURTESY TO YOU, SOLELY FOR USE IN DEVELOPING PROGRAMS AND **
|
11 |
|
|
-- ** SOLUTIONS FOR XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, **
|
12 |
|
|
-- ** OR INFORMATION AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, **
|
13 |
|
|
-- ** APPLICATION OR STANDARD, XILINX IS MAKING NO REPRESENTATION **
|
14 |
|
|
-- ** THAT THIS IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT, **
|
15 |
|
|
-- ** AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE **
|
16 |
|
|
-- ** FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY **
|
17 |
|
|
-- ** WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE **
|
18 |
|
|
-- ** IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR **
|
19 |
|
|
-- ** REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF **
|
20 |
|
|
-- ** INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS **
|
21 |
|
|
-- ** FOR A PARTICULAR PURPOSE. **
|
22 |
|
|
-- ** **
|
23 |
|
|
-- ***************************************************************************
|
24 |
|
|
--
|
25 |
|
|
------------------------------------------------------------------------------
|
26 |
|
|
-- Filename: user_logic.vhd
|
27 |
|
|
-- Version: 3.20.a
|
28 |
|
|
-- Description: User logic.
|
29 |
|
|
-- Date: Tue Aug 03 15:27:10 2010 (by Create and Import Peripheral Wizard)
|
30 |
|
|
-- VHDL Standard: VHDL'93
|
31 |
|
|
------------------------------------------------------------------------------
|
32 |
|
|
-- Naming Conventions:
|
33 |
|
|
-- active low signals: "*_n"
|
34 |
|
|
-- clock signals: "clk", "clk_div#", "clk_#x"
|
35 |
|
|
-- reset signals: "rst", "rst_n"
|
36 |
|
|
-- generics: "C_*"
|
37 |
|
|
-- user defined types: "*_TYPE"
|
38 |
|
|
-- state machine next state: "*_ns"
|
39 |
|
|
-- state machine current state: "*_cs"
|
40 |
|
|
-- combinatorial signals: "*_com"
|
41 |
|
|
-- pipelined or register delay signals: "*_d#"
|
42 |
|
|
-- counter signals: "*cnt*"
|
43 |
|
|
-- clock enable signals: "*_ce"
|
44 |
|
|
-- internal version of output port: "*_i"
|
45 |
|
|
-- device pins: "*_pin"
|
46 |
|
|
-- ports: "- Names begin with Uppercase"
|
47 |
|
|
-- processes: "*_PROCESS"
|
48 |
|
|
-- component instantiations: "<ENTITY_>I_<#|FUNC>"
|
49 |
|
|
------------------------------------------------------------------------------
|
50 |
|
|
|
51 |
|
|
-- DO NOT EDIT BELOW THIS LINE --------------------
|
52 |
|
|
library ieee;
|
53 |
|
|
use ieee.std_logic_1164.all;
|
54 |
|
|
use ieee.std_logic_arith.all;
|
55 |
|
|
use ieee.std_logic_unsigned.all;
|
56 |
|
|
|
57 |
|
|
library proc_common_v3_00_a;
|
58 |
|
|
use proc_common_v3_00_a.proc_common_pkg.all;
|
59 |
|
|
|
60 |
|
|
-- DO NOT EDIT ABOVE THIS LINE --------------------
|
61 |
|
|
|
62 |
|
|
--USER libraries added here
|
63 |
|
|
|
64 |
|
|
------------------------------------------------------------------------------
|
65 |
|
|
-- Entity section
|
66 |
|
|
------------------------------------------------------------------------------
|
67 |
|
|
-- Definition of Generics:
|
68 |
|
|
-- C_SLV_AWIDTH -- Slave interface address bus width
|
69 |
|
|
-- C_SLV_DWIDTH -- Slave interface data bus width
|
70 |
|
|
-- C_NUM_REG -- Number of software accessible registers
|
71 |
|
|
-- C_NUM_MEM -- Number of memory spaces
|
72 |
|
|
--
|
73 |
|
|
-- Definition of Ports:
|
74 |
|
|
-- Bus2IP_Clk -- Bus to IP clock
|
75 |
|
|
-- Bus2IP_Reset -- Bus to IP reset
|
76 |
|
|
-- Bus2IP_Addr -- Bus to IP address bus
|
77 |
|
|
-- Bus2IP_CS -- Bus to IP chip select for user logic memory selection
|
78 |
|
|
-- Bus2IP_RNW -- Bus to IP read/not write
|
79 |
|
|
-- Bus2IP_Data -- Bus to IP data bus
|
80 |
|
|
-- Bus2IP_BE -- Bus to IP byte enables
|
81 |
|
|
-- Bus2IP_RdCE -- Bus to IP read chip enable
|
82 |
|
|
-- Bus2IP_WrCE -- Bus to IP write chip enable
|
83 |
|
|
-- IP2Bus_Data -- IP to Bus data bus
|
84 |
|
|
-- IP2Bus_RdAck -- IP to Bus read transfer acknowledgement
|
85 |
|
|
-- IP2Bus_WrAck -- IP to Bus write transfer acknowledgement
|
86 |
|
|
-- IP2Bus_Error -- IP to Bus error response
|
87 |
|
|
------------------------------------------------------------------------------
|
88 |
|
|
|
89 |
|
|
entity user_logic is
|
90 |
|
|
generic
|
91 |
|
|
(
|
92 |
|
|
-- ADD USER GENERICS BELOW THIS LINE ---------------
|
93 |
|
|
C_REG_ENABLE : std_logic_vector(7 downto 0) := X"00";
|
94 |
|
|
C_NODE_ID : integer := 0;
|
95 |
|
|
C_MAX_SKIPPED_READS : integer := 0;
|
96 |
|
|
C_MAX_SKIPPED_WRITES : integer := 0;
|
97 |
|
|
C_WATCHDOG_THRESHOLD : integer := 16384;
|
98 |
|
|
C_DISABLE_MASTER : std_logic := '0';
|
99 |
|
|
C_DISABLE_SLAVE : std_logic := '0';
|
100 |
|
|
C_DISABLE_ASYNC : std_logic := '0';
|
101 |
|
|
-- ADD USER GENERICS ABOVE THIS LINE ---------------
|
102 |
|
|
|
103 |
|
|
-- DO NOT EDIT BELOW THIS LINE ---------------------
|
104 |
|
|
-- Bus protocol parameters, do not add to or delete
|
105 |
|
|
C_SLV_AWIDTH : integer := 32;
|
106 |
|
|
C_SLV_DWIDTH : integer := 32;
|
107 |
|
|
C_NUM_REG : integer := 5;
|
108 |
|
|
C_NUM_MEM : integer := 1
|
109 |
|
|
-- DO NOT EDIT ABOVE THIS LINE ---------------------
|
110 |
|
|
);
|
111 |
|
|
port
|
112 |
|
|
(
|
113 |
|
|
-- ADD USER PORTS BELOW THIS LINE ------------------
|
114 |
|
|
sig_in : in std_logic;
|
115 |
|
|
sig_out : out std_logic;
|
116 |
|
|
clk_50M : in std_logic;
|
117 |
|
|
sync_strobe : out std_logic;
|
118 |
|
|
system_halt : out std_logic;
|
119 |
|
|
-- ADD USER PORTS ABOVE THIS LINE ------------------
|
120 |
|
|
|
121 |
|
|
-- DO NOT EDIT BELOW THIS LINE ---------------------
|
122 |
|
|
-- Bus protocol ports, do not add to or delete
|
123 |
|
|
Bus2IP_Clk : in std_logic;
|
124 |
|
|
Bus2IP_Reset : in std_logic;
|
125 |
|
|
Bus2IP_Addr : in std_logic_vector(0 to C_SLV_AWIDTH-1);
|
126 |
|
|
Bus2IP_CS : in std_logic_vector(0 to C_NUM_MEM-1);
|
127 |
|
|
Bus2IP_RNW : in std_logic;
|
128 |
|
|
Bus2IP_Data : in std_logic_vector(0 to C_SLV_DWIDTH-1);
|
129 |
|
|
Bus2IP_BE : in std_logic_vector(0 to C_SLV_DWIDTH/8-1);
|
130 |
|
|
Bus2IP_RdCE : in std_logic_vector(0 to C_NUM_REG-1);
|
131 |
|
|
Bus2IP_WrCE : in std_logic_vector(0 to C_NUM_REG-1);
|
132 |
|
|
IP2Bus_Data : out std_logic_vector(0 to C_SLV_DWIDTH-1);
|
133 |
|
|
IP2Bus_RdAck : out std_logic;
|
134 |
|
|
IP2Bus_WrAck : out std_logic;
|
135 |
|
|
IP2Bus_Error : out std_logic
|
136 |
|
|
-- DO NOT EDIT ABOVE THIS LINE ---------------------
|
137 |
|
|
);
|
138 |
|
|
|
139 |
|
|
attribute SIGIS : string;
|
140 |
|
|
attribute SIGIS of Bus2IP_Clk : signal is "CLK";
|
141 |
|
|
attribute SIGIS of Bus2IP_Reset : signal is "RST";
|
142 |
|
|
|
143 |
|
|
end entity user_logic;
|
144 |
|
|
|
145 |
|
|
------------------------------------------------------------------------------
|
146 |
|
|
-- Architecture section
|
147 |
|
|
------------------------------------------------------------------------------
|
148 |
|
|
|
149 |
|
|
architecture IMP of user_logic is
|
150 |
|
|
|
151 |
|
|
--USER signal declarations added here, as needed for user logic
|
152 |
|
|
|
153 |
|
|
component tdl_top is
|
154 |
|
|
Port( node_id : in STD_LOGIC_VECTOR(3 downto 0);
|
155 |
|
|
reg_enable : in STD_LOGIC_VECTOR(7 downto 0);
|
156 |
|
|
watchdog_threshold : in STD_LOGIC_VECTOR(17 downto 0);
|
157 |
|
|
data_out_ext : out STD_LOGIC_VECTOR(7 downto 0);
|
158 |
|
|
data_out_strobe_ext : out STD_LOGIC;
|
159 |
|
|
data_out_enable_ext : out STD_LOGIC;
|
160 |
|
|
data_in_ext : in STD_LOGIC_VECTOR(7 downto 0);
|
161 |
|
|
data_in_strobe_ext : in STD_LOGIC;
|
162 |
|
|
data_in_enable_ext : in STD_LOGIC;
|
163 |
|
|
buffer_full : inout STD_LOGIC;
|
164 |
|
|
packet_error : inout STD_LOGIC;
|
165 |
|
|
force_packet_error : inout STD_LOGIC;
|
166 |
|
|
sync_strobe : inout STD_LOGIC;
|
167 |
|
|
online : out STD_LOGIC;
|
168 |
|
|
network_reg_addr : in STD_LOGIC_VECTOR(3 downto 0);
|
169 |
|
|
network_reg_data : out STD_LOGIC_VECTOR(31 downto 0);
|
170 |
|
|
network_reg_clk : in STD_LOGIC;
|
171 |
|
|
node_is_master : out STD_LOGIC;
|
172 |
|
|
node_address : out STD_LOGIC_VECTOR(3 downto 0);
|
173 |
|
|
clk_50M : in STD_LOGIC;
|
174 |
|
|
reset : in STD_LOGIC;
|
175 |
|
|
sig_in : in STD_LOGIC;
|
176 |
|
|
sig_out : inout STD_LOGIC);
|
177 |
|
|
end component;
|
178 |
|
|
|
179 |
|
|
component tal_top is
|
180 |
|
|
Generic(disable_slave : STD_LOGIC := '0';
|
181 |
|
|
disable_master : STD_LOGIC := '0';
|
182 |
|
|
disable_async : STD_LOGIC := '0');
|
183 |
|
|
Port( node_id : in STD_LOGIC_VECTOR(3 downto 0);
|
184 |
|
|
max_skipped_writes : in STD_LOGIC_VECTOR(15 downto 0);
|
185 |
|
|
max_skipped_reads : in STD_LOGIC_VECTOR(15 downto 0);
|
186 |
|
|
data_in : in STD_LOGIC_VECTOR(7 downto 0);
|
187 |
|
|
data_in_strobe : in STD_LOGIC;
|
188 |
|
|
data_in_enable : in STD_LOGIC;
|
189 |
|
|
data_out : out STD_LOGIC_VECTOR(7 downto 0);
|
190 |
|
|
data_out_strobe : out STD_LOGIC;
|
191 |
|
|
data_out_enable : out STD_LOGIC;
|
192 |
|
|
buffer_full : in STD_LOGIC;
|
193 |
|
|
packet_error : in STD_LOGIC;
|
194 |
|
|
force_packet_error : out STD_LOGIC;
|
195 |
|
|
sync_strobe : in STD_LOGIC;
|
196 |
|
|
network_reg_addr : out STD_LOGIC_VECTOR(3 downto 0);
|
197 |
|
|
network_reg_data : in STD_LOGIC_VECTOR(31 downto 0);
|
198 |
|
|
network_reg_clk : out STD_LOGIC;
|
199 |
|
|
data_reg_addr : in STD_LOGIC_VECTOR(9 downto 0);
|
200 |
|
|
data_reg_data_in : in STD_LOGIC_VECTOR(31 downto 0);
|
201 |
|
|
data_reg_data_out : out STD_LOGIC_VECTOR(31 downto 0);
|
202 |
|
|
data_reg_clk : in STD_LOGIC;
|
203 |
|
|
data_reg_we : in STD_LOGIC_VECTOR(0 downto 0);
|
204 |
|
|
data_reg_commit_write : in STD_LOGIC;
|
205 |
|
|
data_reg_commit_read : in STD_LOGIC;
|
206 |
|
|
skip_count_write : out STD_LOGIC_VECTOR(15 downto 0);
|
207 |
|
|
skip_count_read : out STD_LOGIC_VECTOR(15 downto 0);
|
208 |
|
|
current_buffer_index : out STD_LOGIC_VECTOR(3 downto 0);
|
209 |
|
|
node_address : in STD_LOGIC_VECTOR(3 downto 0);
|
210 |
|
|
is_master : in STD_LOGIC;
|
211 |
|
|
clk_50M : in STD_LOGIC;
|
212 |
|
|
pause : in STD_LOGIC;
|
213 |
|
|
pause_ack : out STD_LOGIC;
|
214 |
|
|
reset : in STD_LOGIC;
|
215 |
|
|
system_halt : out STD_LOGIC;
|
216 |
|
|
reset_counter : out STD_LOGIC_VECTOR(31 downto 0);
|
217 |
|
|
packet_counter : out STD_LOGIC_VECTOR(31 downto 0);
|
218 |
|
|
error_counter : out STD_LOGIC_VECTOR(31 downto 0);
|
219 |
|
|
async_in_data : in STD_LOGIC_VECTOR(37 downto 0);
|
220 |
|
|
async_out_data : out STD_LOGIC_VECTOR(37 downto 0);
|
221 |
|
|
async_in_clk : in STD_LOGIC;
|
222 |
|
|
async_out_clk : in STD_LOGIC;
|
223 |
|
|
async_in_full : out STD_LOGIC;
|
224 |
|
|
async_out_empty : out STD_LOGIC;
|
225 |
|
|
async_in_wr_en : in STD_LOGIC;
|
226 |
|
|
async_out_rd_en : in STD_LOGIC;
|
227 |
|
|
async_out_valid : out STD_LOGIC);
|
228 |
|
|
end component;
|
229 |
|
|
|
230 |
|
|
signal sig_out_int : STD_LOGIC;
|
231 |
|
|
signal data_up : STD_LOGIC_VECTOR(7 downto 0);
|
232 |
|
|
signal data_up_strobe : STD_LOGIC;
|
233 |
|
|
signal data_up_enable : STD_LOGIC;
|
234 |
|
|
signal data_down : STD_LOGIC_VECTOR(7 downto 0);
|
235 |
|
|
signal data_down_strobe : STD_LOGIC;
|
236 |
|
|
signal data_down_enable : STD_LOGIC;
|
237 |
|
|
signal buffer_full : STD_LOGIC;
|
238 |
|
|
signal sync_strobe_int : STD_LOGIC;
|
239 |
|
|
signal network_reg_addr : STD_LOGIC_VECTOR(3 downto 0);
|
240 |
|
|
signal network_reg_data : STD_LOGIC_VECTOR(31 downto 0);
|
241 |
|
|
signal network_reg_clk : STD_LOGIC;
|
242 |
|
|
signal node_address : STD_LOGIC_VECTOR(3 downto 0);
|
243 |
|
|
signal node_is_master : STD_LOGIC;
|
244 |
|
|
signal packet_error : STD_LOGIC;
|
245 |
|
|
signal online : STD_LOGIC;
|
246 |
|
|
signal app_reset : STD_LOGIC;
|
247 |
|
|
signal force_packet_error : STD_LOGIC;
|
248 |
|
|
signal max_skipped_writes : STD_LOGIC_VECTOR(15 downto 0);
|
249 |
|
|
signal max_skipped_reads : STD_LOGIC_VECTOR(15 downto 0);
|
250 |
|
|
signal watchdog_threshold : STD_LOGIC_VECTOR(17 downto 0);
|
251 |
|
|
signal data_reg_addr : STD_LOGIC_VECTOR(9 downto 0);
|
252 |
|
|
signal data_reg_data_in : STD_LOGIC_VECTOR(31 downto 0);
|
253 |
|
|
signal data_reg_data_out : STD_LOGIC_VECTOR(31 downto 0);
|
254 |
|
|
signal data_reg_clk : STD_LOGIC;
|
255 |
|
|
signal data_reg_we : STD_LOGIC_VECTOR(0 downto 0);
|
256 |
|
|
signal commit_write : STD_LOGIC;
|
257 |
|
|
signal commit_read : STD_LOGIC;
|
258 |
|
|
signal system_halt_int : STD_LOGIC;
|
259 |
|
|
signal packet_counter : STD_LOGIC_VECTOR(31 downto 0);
|
260 |
|
|
signal error_counter : STD_LOGIC_VECTOR(31 downto 0);
|
261 |
|
|
signal reset_counter : STD_LOGIC_VECTOR(31 downto 0);
|
262 |
|
|
|
263 |
|
|
signal async_in_data : STD_LOGIC_VECTOR(37 downto 0);
|
264 |
|
|
signal async_out_data : STD_LOGIC_VECTOR(37 downto 0);
|
265 |
|
|
signal async_rd_en : STD_LOGIC;
|
266 |
|
|
signal async_wr_en : STD_LOGIC;
|
267 |
|
|
signal async_empty : STD_LOGIC;
|
268 |
|
|
signal async_full : STD_LOGIC;
|
269 |
|
|
signal async_valid : STD_LOGIC;
|
270 |
|
|
signal async_rd_node_id : STD_LOGIC_VECTOR(3 downto 0);
|
271 |
|
|
signal async_wr_node_id : STD_LOGIC_VECTOR(3 downto 0);
|
272 |
|
|
signal async_rd_be : STD_LOGIC_VECTOR(1 downto 0);
|
273 |
|
|
signal async_wr_be : STD_LOGIC_VECTOR(1 downto 0);
|
274 |
|
|
|
275 |
|
|
------------------------------------------
|
276 |
|
|
-- Signals for user logic slave model s/w accessible register example
|
277 |
|
|
------------------------------------------
|
278 |
|
|
signal slv_reg0 : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
279 |
|
|
signal slv_reg1 : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
280 |
|
|
signal slv_reg2 : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
281 |
|
|
signal slv_reg3 : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
282 |
|
|
signal slv_reg4 : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
283 |
|
|
signal slv_reg_write_sel : std_logic_vector(0 to 4);
|
284 |
|
|
signal slv_reg_read_sel : std_logic_vector(0 to 4);
|
285 |
|
|
signal slv_ip2bus_data : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
286 |
|
|
signal slv_read_ack : std_logic;
|
287 |
|
|
signal slv_write_ack : std_logic;
|
288 |
|
|
|
289 |
|
|
------------------------------------------
|
290 |
|
|
-- Signals for user logic memory space example
|
291 |
|
|
------------------------------------------
|
292 |
|
|
type BYTE_RAM_TYPE is array (0 to 255) of std_logic_vector(0 to 7);
|
293 |
|
|
type DO_TYPE is array (0 to C_NUM_MEM-1) of std_logic_vector(0 to C_SLV_DWIDTH-1);
|
294 |
|
|
signal mem_data_out : DO_TYPE;
|
295 |
|
|
signal mem_address : std_logic_vector(0 to 7);
|
296 |
|
|
signal mem_select : std_logic_vector(0 to 0);
|
297 |
|
|
signal mem_read_enable : std_logic;
|
298 |
|
|
signal mem_read_enable_dly1 : std_logic;
|
299 |
|
|
signal mem_read_req : std_logic;
|
300 |
|
|
signal mem_ip2bus_data : std_logic_vector(0 to C_SLV_DWIDTH-1);
|
301 |
|
|
signal mem_read_ack_dly1 : std_logic;
|
302 |
|
|
signal mem_read_ack : std_logic;
|
303 |
|
|
signal mem_write_ack : std_logic;
|
304 |
|
|
|
305 |
|
|
begin
|
306 |
|
|
|
307 |
|
|
--USER logic implementation added here
|
308 |
|
|
|
309 |
|
|
tdl_top_inst : tdl_top
|
310 |
|
|
Port map ( node_id => conv_std_logic_vector(C_NODE_ID, 4),
|
311 |
|
|
reg_enable => C_REG_ENABLE,
|
312 |
|
|
watchdog_threshold => conv_std_logic_vector(C_WATCHDOG_THRESHOLD, 18),
|
313 |
|
|
sig_in => sig_in,
|
314 |
|
|
sig_out => sig_out_int,
|
315 |
|
|
reset => Bus2IP_Reset,
|
316 |
|
|
clk_50M => clk_50M,
|
317 |
|
|
data_in_ext => data_down,
|
318 |
|
|
data_in_enable_ext => data_down_enable,
|
319 |
|
|
data_in_strobe_ext => data_down_strobe,
|
320 |
|
|
data_out_ext => data_up,
|
321 |
|
|
data_out_enable_ext => data_up_enable,
|
322 |
|
|
data_out_strobe_ext => data_up_strobe,
|
323 |
|
|
buffer_full => buffer_full,
|
324 |
|
|
packet_error => packet_error,
|
325 |
|
|
force_packet_error => force_packet_error,
|
326 |
|
|
sync_strobe => sync_strobe_int,
|
327 |
|
|
online => online,
|
328 |
|
|
network_reg_addr => network_reg_addr,
|
329 |
|
|
network_reg_data => network_reg_data,
|
330 |
|
|
network_reg_clk => network_reg_clk,
|
331 |
|
|
node_address => node_address,
|
332 |
|
|
node_is_master => node_is_master);
|
333 |
|
|
|
334 |
|
|
application_inst : tal_top
|
335 |
|
|
Generic map(disable_master => C_DISABLE_MASTER,
|
336 |
|
|
disable_slave => C_DISABLE_SLAVE,
|
337 |
|
|
disable_async => C_DISABLE_ASYNC)
|
338 |
|
|
Port map( node_id => conv_std_logic_vector(C_NODE_ID, 4),
|
339 |
|
|
max_skipped_writes => conv_std_logic_vector(C_MAX_SKIPPED_WRITES, 16),
|
340 |
|
|
max_skipped_reads => conv_std_logic_vector(C_MAX_SKIPPED_READS, 16),
|
341 |
|
|
data_in => data_up,
|
342 |
|
|
data_in_strobe => data_up_strobe,
|
343 |
|
|
data_in_enable => data_up_enable,
|
344 |
|
|
data_out => data_down,
|
345 |
|
|
data_out_strobe => data_down_strobe,
|
346 |
|
|
data_out_enable => data_down_enable,
|
347 |
|
|
buffer_full => buffer_full,
|
348 |
|
|
packet_error => packet_error,
|
349 |
|
|
force_packet_error => force_packet_error,
|
350 |
|
|
sync_strobe => sync_strobe_int,
|
351 |
|
|
network_reg_addr => network_reg_addr,
|
352 |
|
|
network_reg_data => network_reg_data,
|
353 |
|
|
network_reg_clk => network_reg_clk,
|
354 |
|
|
node_address => node_address,
|
355 |
|
|
is_master => node_is_master,
|
356 |
|
|
data_reg_addr => data_reg_addr,
|
357 |
|
|
data_reg_data_in => data_reg_data_in,
|
358 |
|
|
data_reg_data_out => data_reg_data_out,
|
359 |
|
|
data_reg_clk => data_reg_clk,
|
360 |
|
|
data_reg_we => data_reg_we,
|
361 |
|
|
data_reg_commit_write => commit_write,
|
362 |
|
|
data_reg_commit_read => commit_read,
|
363 |
|
|
clk_50M => clk_50M,
|
364 |
|
|
pause => '0',
|
365 |
|
|
reset => app_reset,
|
366 |
|
|
system_halt => system_halt_int,
|
367 |
|
|
packet_counter => packet_counter,
|
368 |
|
|
error_counter => error_counter,
|
369 |
|
|
reset_counter => reset_counter,
|
370 |
|
|
async_in_data => async_in_data,
|
371 |
|
|
async_out_data => async_out_data,
|
372 |
|
|
async_in_clk => Bus2IP_Clk,
|
373 |
|
|
async_out_clk => Bus2IP_Clk,
|
374 |
|
|
async_in_full => async_full,
|
375 |
|
|
async_out_empty => async_empty,
|
376 |
|
|
async_in_wr_en => async_wr_en,
|
377 |
|
|
async_out_rd_en => async_rd_en,
|
378 |
|
|
async_out_valid => async_valid);
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
app_reset <= not online;
|
382 |
|
|
sig_out <= sig_out_int;
|
383 |
|
|
|
384 |
|
|
------------------------------------------
|
385 |
|
|
-- Example code to read/write user logic slave model s/w accessible registers
|
386 |
|
|
--
|
387 |
|
|
-- Note:
|
388 |
|
|
-- The example code presented here is to show you one way of reading/writing
|
389 |
|
|
-- software accessible registers implemented in the user logic slave model.
|
390 |
|
|
-- Each bit of the Bus2IP_WrCE/Bus2IP_RdCE signals is configured to correspond
|
391 |
|
|
-- to one software accessible register by the top level template. For example,
|
392 |
|
|
-- if you have four 32 bit software accessible registers in the user logic,
|
393 |
|
|
-- you are basically operating on the following memory mapped registers:
|
394 |
|
|
--
|
395 |
|
|
-- Bus2IP_WrCE/Bus2IP_RdCE Memory Mapped Register
|
396 |
|
|
-- "1000" C_BASEADDR + 0x0
|
397 |
|
|
-- "0100" C_BASEADDR + 0x4
|
398 |
|
|
-- "0010" C_BASEADDR + 0x8
|
399 |
|
|
-- "0001" C_BASEADDR + 0xC
|
400 |
|
|
--
|
401 |
|
|
------------------------------------------
|
402 |
|
|
slv_reg_write_sel <= Bus2IP_WrCE(0 to 4);
|
403 |
|
|
slv_reg_read_sel <= Bus2IP_RdCE(0 to 4);
|
404 |
|
|
slv_write_ack <= Bus2IP_WrCE(0) or Bus2IP_WrCE(1) or Bus2IP_WrCE(2) or Bus2IP_WrCE(3) or Bus2IP_WrCE(4);
|
405 |
|
|
slv_read_ack <= Bus2IP_RdCE(0) or Bus2IP_RdCE(1) or Bus2IP_RdCE(2) or Bus2IP_RdCE(3) or Bus2IP_RdCE(4);
|
406 |
|
|
|
407 |
|
|
slv_reg0(0 to 3) <= async_rd_node_id;
|
408 |
|
|
slv_reg0(4 to 5) <= async_rd_be;
|
409 |
|
|
slv_reg0(6 to 7) <= "00";
|
410 |
|
|
slv_reg0(8 to 15) <= C_REG_ENABLE;
|
411 |
|
|
slv_reg0(16 to 19) <= node_address;
|
412 |
|
|
slv_reg0(20 to 23) <= conv_std_logic_vector(C_NODE_ID, 4);
|
413 |
|
|
slv_reg0(24) <= async_valid;
|
414 |
|
|
slv_reg0(25) <= async_empty;
|
415 |
|
|
slv_reg0(26) <= async_full;
|
416 |
|
|
slv_reg0(27) <= system_halt_int;
|
417 |
|
|
slv_reg0(28) <= node_is_master;
|
418 |
|
|
slv_reg0(29) <= online;
|
419 |
|
|
slv_reg0(30 to 31) <= "00";
|
420 |
|
|
slv_reg1 <= packet_counter;
|
421 |
|
|
slv_reg2 <= error_counter;
|
422 |
|
|
slv_reg3 <= reset_counter;
|
423 |
|
|
slv_reg4 <= async_out_data(31 downto 0) when async_valid = '1' else (others => '0');
|
424 |
|
|
|
425 |
|
|
async_in_data(37 downto 36) <= async_wr_be;
|
426 |
|
|
async_in_data(35 downto 32) <= async_wr_node_id;
|
427 |
|
|
|
428 |
|
|
async_rd_node_id <= async_out_data(35 downto 32) when async_valid = '1' else (others => '0');
|
429 |
|
|
async_rd_be <= async_out_data(37 downto 36) when async_valid = '1' else (others => '0');
|
430 |
|
|
|
431 |
|
|
async_rd_en <= '1' when slv_reg_read_sel = "00001" else '0';
|
432 |
|
|
|
433 |
|
|
-- implement slave model software accessible register(s)
|
434 |
|
|
SLAVE_REG_WRITE_PROC : process( Bus2IP_Clk ) is
|
435 |
|
|
begin
|
436 |
|
|
|
437 |
|
|
if Bus2IP_Clk'event and Bus2IP_Clk = '1' then
|
438 |
|
|
async_wr_en <= '0';
|
439 |
|
|
case slv_reg_write_sel is
|
440 |
|
|
when "10000" =>
|
441 |
|
|
if ( Bus2IP_BE(0) = '1' ) then
|
442 |
|
|
async_wr_node_id <= Bus2IP_Data(0 to 3);
|
443 |
|
|
async_wr_be <= Bus2IP_Data(4 to 5);
|
444 |
|
|
end if;
|
445 |
|
|
if ( Bus2IP_BE(3) = '1' ) then
|
446 |
|
|
commit_write <= Bus2IP_Data(30);
|
447 |
|
|
commit_read <= Bus2IP_Data(31);
|
448 |
|
|
end if;
|
449 |
|
|
when "00001" =>
|
450 |
|
|
if ( Bus2IP_BE = "1111" ) then
|
451 |
|
|
async_in_data(31 downto 0) <= Bus2IP_Data;
|
452 |
|
|
async_wr_en <= '1';
|
453 |
|
|
end if;
|
454 |
|
|
when others => null;
|
455 |
|
|
end case;
|
456 |
|
|
end if;
|
457 |
|
|
|
458 |
|
|
end process SLAVE_REG_WRITE_PROC;
|
459 |
|
|
|
460 |
|
|
-- implement slave model software accessible register(s) read mux
|
461 |
|
|
SLAVE_REG_READ_PROC : process( slv_reg_read_sel, slv_reg0, slv_reg1, slv_reg2, slv_reg3, slv_reg4) is
|
462 |
|
|
begin
|
463 |
|
|
|
464 |
|
|
case slv_reg_read_sel is
|
465 |
|
|
when "10000" => slv_ip2bus_data <= slv_reg0;
|
466 |
|
|
when "01000" => slv_ip2bus_data <= slv_reg1;
|
467 |
|
|
when "00100" => slv_ip2bus_data <= slv_reg2;
|
468 |
|
|
when "00010" => slv_ip2bus_data <= slv_reg3;
|
469 |
|
|
when "00001" => slv_ip2bus_data <= slv_reg4;
|
470 |
|
|
when others => slv_ip2bus_data <= (others => '0');
|
471 |
|
|
end case;
|
472 |
|
|
|
473 |
|
|
end process SLAVE_REG_READ_PROC;
|
474 |
|
|
|
475 |
|
|
------------------------------------------
|
476 |
|
|
-- Example code to generate user logic interrupts
|
477 |
|
|
--
|
478 |
|
|
-- Note:
|
479 |
|
|
-- The example code presented here is to show you one way of generating
|
480 |
|
|
-- interrupts from the user logic. This code snippet infers a counter
|
481 |
|
|
-- and generate the interrupts whenever the counter rollover (the counter
|
482 |
|
|
-- will rollover ~21 sec @50Mhz).
|
483 |
|
|
------------------------------------------
|
484 |
|
|
|
485 |
|
|
sync_strobe <= sync_strobe_int;
|
486 |
|
|
system_halt <= system_halt_int;
|
487 |
|
|
|
488 |
|
|
------------------------------------------
|
489 |
|
|
-- Example code to access user logic memory region
|
490 |
|
|
--
|
491 |
|
|
-- Note:
|
492 |
|
|
-- The example code presented here is to show you one way of using
|
493 |
|
|
-- the user logic memory space features. The Bus2IP_Addr, Bus2IP_CS,
|
494 |
|
|
-- and Bus2IP_RNW IPIC signals are dedicated to these user logic
|
495 |
|
|
-- memory spaces. Each user logic memory space has its own address
|
496 |
|
|
-- range and is allocated one bit on the Bus2IP_CS signal to indicated
|
497 |
|
|
-- selection of that memory space. Typically these user logic memory
|
498 |
|
|
-- spaces are used to implement memory controller type cores, but it
|
499 |
|
|
-- can also be used in cores that need to access additional address space
|
500 |
|
|
-- (non C_BASEADDR based), s.t. bridges. This code snippet infers
|
501 |
|
|
-- 1 256x32-bit (byte accessible) single-port Block RAM by XST.
|
502 |
|
|
------------------------------------------
|
503 |
|
|
mem_select <= Bus2IP_CS;
|
504 |
|
|
mem_read_ack <= mem_read_ack_dly1;
|
505 |
|
|
mem_write_ack <= data_reg_we(0);
|
506 |
|
|
mem_read_enable <= Bus2IP_CS(0) and Bus2IP_RNW;
|
507 |
|
|
data_reg_we(0) <= Bus2IP_CS(0) and not Bus2IP_RNW;
|
508 |
|
|
data_reg_addr <= Bus2IP_Addr(20 to 29);
|
509 |
|
|
data_reg_clk <= Bus2IP_Clk;
|
510 |
|
|
data_reg_data_in <= Bus2IP_Data;
|
511 |
|
|
|
512 |
|
|
-- implement single clock wide read request
|
513 |
|
|
mem_read_req <= mem_read_enable and not(mem_read_enable_dly1);
|
514 |
|
|
BRAM_RD_REQ_PROC : process( Bus2IP_Clk ) is
|
515 |
|
|
begin
|
516 |
|
|
|
517 |
|
|
if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then
|
518 |
|
|
if ( Bus2IP_Reset = '1' ) then
|
519 |
|
|
mem_read_enable_dly1 <= '0';
|
520 |
|
|
else
|
521 |
|
|
mem_read_enable_dly1 <= mem_read_enable;
|
522 |
|
|
end if;
|
523 |
|
|
end if;
|
524 |
|
|
|
525 |
|
|
end process BRAM_RD_REQ_PROC;
|
526 |
|
|
|
527 |
|
|
-- this process generates the read acknowledge 1 clock after read enable
|
528 |
|
|
-- is presented to the BRAM block. The BRAM block has a 1 clock delay
|
529 |
|
|
-- from read enable to data out.
|
530 |
|
|
BRAM_RD_ACK_PROC : process( Bus2IP_Clk ) is
|
531 |
|
|
begin
|
532 |
|
|
|
533 |
|
|
if ( Bus2IP_Clk'event and Bus2IP_Clk = '1' ) then
|
534 |
|
|
if ( Bus2IP_Reset = '1' ) then
|
535 |
|
|
mem_read_ack_dly1 <= '0';
|
536 |
|
|
else
|
537 |
|
|
mem_read_ack_dly1 <= mem_read_req;
|
538 |
|
|
end if;
|
539 |
|
|
end if;
|
540 |
|
|
|
541 |
|
|
end process BRAM_RD_ACK_PROC;
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
-- implement Block RAM read mux
|
545 |
|
|
MEM_IP2BUS_DATA_PROC : process( data_reg_data_out, mem_select ) is
|
546 |
|
|
begin
|
547 |
|
|
|
548 |
|
|
case mem_select is
|
549 |
|
|
when "1" => mem_ip2bus_data <= data_reg_data_out;
|
550 |
|
|
when others => mem_ip2bus_data <= (others => '0');
|
551 |
|
|
end case;
|
552 |
|
|
|
553 |
|
|
end process MEM_IP2BUS_DATA_PROC;
|
554 |
|
|
|
555 |
|
|
------------------------------------------
|
556 |
|
|
-- Example code to drive IP to Bus signals
|
557 |
|
|
------------------------------------------
|
558 |
|
|
IP2Bus_Data <= slv_ip2bus_data when slv_read_ack = '1' else
|
559 |
|
|
mem_ip2bus_data when mem_read_ack = '1' else
|
560 |
|
|
(others => '0');
|
561 |
|
|
|
562 |
|
|
IP2Bus_WrAck <= slv_write_ack or mem_write_ack;
|
563 |
|
|
IP2Bus_RdAck <= slv_read_ack or mem_read_ack;
|
564 |
|
|
IP2Bus_Error <= '0';
|
565 |
|
|
|
566 |
|
|
end IMP;
|