1 |
10 |
bjoerno |
---====================== Start Software License ========================---
|
2 |
|
|
--== ==--
|
3 |
|
|
--== This license governs the use of this software, and your use of ==--
|
4 |
|
|
--== this software constitutes acceptance of this license. Agreement ==--
|
5 |
|
|
--== with all points is required to use this software. ==--
|
6 |
|
|
--== ==--
|
7 |
|
|
--== 1. This source file may be used and distributed without ==--
|
8 |
|
|
--== restriction provided that this software license statement is not ==--
|
9 |
|
|
--== removed from the file and that any derivative work contains the ==--
|
10 |
|
|
--== original software license notice and the associated disclaimer. ==--
|
11 |
|
|
--== ==--
|
12 |
|
|
--== 2. This source file is free software; you can redistribute it ==--
|
13 |
|
|
--== and/or modify it under the restriction that UNDER NO CIRCUMTANCES ==--
|
14 |
|
|
--== this Software is to be used to CONSTRUCT a SPACEWIRE INTERFACE ==--
|
15 |
|
|
--== This implies modification and/or derivative work of this Software. ==--
|
16 |
|
|
--== ==--
|
17 |
|
|
--== 3. This source is distributed in the hope that it will be useful, ==--
|
18 |
|
|
--== but WITHOUT ANY WARRANTY; without even the implied warranty of ==--
|
19 |
|
|
--== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ==--
|
20 |
|
|
--== ==--
|
21 |
|
|
--== Your rights under this license are terminated immediately if you ==--
|
22 |
|
|
--== breach it in any way. ==--
|
23 |
|
|
--== ==--
|
24 |
|
|
---======================= End Software License =========================---
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
---====================== Start Copyright Notice ========================---
|
28 |
|
|
--== ==--
|
29 |
|
|
--== Filename ..... socwire_switch.vhd ==--
|
30 |
|
|
--== Download ..... http://www.ida.ing.tu-bs.de ==--
|
31 |
|
|
--== Company ...... IDA TU Braunschweig, Prof. Dr.-Ing. Harald Michalik ==--
|
32 |
|
|
--== Authors .......Björn Osterloh, Karel Kotarowski ==--
|
33 |
|
|
--== Contact .......Björn Osterloh (b.osterloh@tu-bs.de) ==--
|
34 |
|
|
--== Copyright .... Copyright (c) 2008 IDA ==--
|
35 |
|
|
--== Project ...... SoCWire Switch ==--
|
36 |
|
|
--== Version ...... 1.00 ==--
|
37 |
|
|
--== Conception ... 11 November 2008 ==--
|
38 |
|
|
--== Modified ..... N/A ==--
|
39 |
|
|
--== ==--
|
40 |
|
|
---======================= End Copyright Notice =========================---
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
LIBRARY IEEE;
|
44 |
|
|
USE IEEE.STD_LOGIC_1164.ALL;
|
45 |
|
|
USE WORK.ALL;
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
ENTITY SoCWire_switch IS
|
49 |
|
|
GENERIC(
|
50 |
|
|
datawidth : NATURAL RANGE 8 TO 8192:=16;
|
51 |
|
|
nports : NATURAL RANGE 2 TO 32:=32;
|
52 |
|
|
speed : NATURAL RANGE 1 TO 100:=10;
|
53 |
|
|
after64 : NATURAL RANGE 1 TO 6400:=6400; -- Spacewire Standard 6400 = 6.4 us
|
54 |
|
|
after128 : NATURAL RANGE 1 TO 12800:=12800; -- Spacewire Standard 12800 = 12.8 us
|
55 |
|
|
disconnect_detection : NATURAL RANGE 1 TO 850:=850 -- Spacewire Standard 850 = 850 ns
|
56 |
|
|
);
|
57 |
|
|
PORT(
|
58 |
|
|
--== General Interface (Sync Rst, 50MHz Clock) ==--
|
59 |
|
|
|
60 |
|
|
rst : IN STD_LOGIC;
|
61 |
|
|
clk : IN STD_LOGIC;
|
62 |
|
|
|
63 |
|
|
--== Serial Receive Interface ==--
|
64 |
|
|
|
65 |
|
|
rx : IN STD_LOGIC_VECTOR((datawidth+2)*nports-1 DOWNTO 0);
|
66 |
|
|
rx_valid : IN STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
67 |
|
|
|
68 |
|
|
--== Serial Transmit Interface ==--
|
69 |
|
|
|
70 |
|
|
tx : OUT STD_LOGIC_VECTOR((datawidth+2)*nports-1 DOWNTO 0);
|
71 |
|
|
tx_valid : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
72 |
|
|
|
73 |
|
|
--== Active Interface ==--
|
74 |
|
|
|
75 |
|
|
active : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0)
|
76 |
|
|
);
|
77 |
|
|
END SoCWire_switch;
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
ARCHITECTURE rtl OF SoCWire_switch IS
|
81 |
|
|
|
82 |
|
|
---=====================================---
|
83 |
|
|
--== Signal Declarations (Link Enable) ==--
|
84 |
|
|
---=====================================---
|
85 |
|
|
|
86 |
|
|
SIGNAL socw_en : STD_LOGIC;
|
87 |
|
|
SIGNAL socw_dis : STD_LOGIC;
|
88 |
|
|
|
89 |
|
|
---================================---
|
90 |
|
|
--== Signal Declarations (Active) ==--
|
91 |
|
|
---================================---
|
92 |
|
|
|
93 |
|
|
SIGNAL active_i : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
94 |
|
|
|
95 |
|
|
---=====================================================---
|
96 |
|
|
--== Signal Declarations (Data : CODEC to Switch Core) ==--
|
97 |
|
|
---=====================================================---
|
98 |
|
|
|
99 |
|
|
SIGNAL dat_full : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
100 |
|
|
SIGNAL dat_nwrite : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
101 |
|
|
SIGNAL dat_din : STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
|
102 |
|
|
|
103 |
|
|
---=====================================================---
|
104 |
|
|
--== Signal Declarations (Data : Switch Core to CODEC) ==--
|
105 |
|
|
---=====================================================---
|
106 |
|
|
|
107 |
|
|
SIGNAL dat_nread : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
108 |
|
|
SIGNAL dat_empty : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
109 |
|
|
SIGNAL dat_dout : STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
---=============================================---
|
113 |
|
|
--== Component Instantiations for leaf modules ==--
|
114 |
|
|
---=============================================---
|
115 |
|
|
|
116 |
|
|
COMPONENT socwire_codec
|
117 |
|
|
GENERIC(
|
118 |
|
|
datawidth : NATURAL RANGE 8 TO 8192;
|
119 |
|
|
speed : NATURAL RANGE 1 TO 100;
|
120 |
|
|
after64 : NATURAL RANGE 1 TO 6400;
|
121 |
|
|
after128 : NATURAL RANGE 1 TO 12800;
|
122 |
|
|
disconnect_detection : NATURAL RANGE 1 TO 850
|
123 |
|
|
);
|
124 |
|
|
|
125 |
|
|
PORT(
|
126 |
|
|
--== General Interface (Sync Rst, 50MHz Clock) ==--
|
127 |
|
|
|
128 |
|
|
rst : IN STD_LOGIC;
|
129 |
|
|
clk : IN STD_LOGIC;
|
130 |
|
|
|
131 |
|
|
--== Link Enable Interface ==--
|
132 |
|
|
|
133 |
|
|
socw_en : IN STD_LOGIC;
|
134 |
|
|
socw_dis : IN STD_LOGIC;
|
135 |
|
|
|
136 |
|
|
--== Serial Receive Interface ==--
|
137 |
|
|
|
138 |
|
|
rx : IN STD_LOGIC_VECTOR(datawidth+1 downto 0);
|
139 |
|
|
rx_valid : IN STD_LOGIC;
|
140 |
|
|
|
141 |
|
|
--== Serial Transmit Interface ==--
|
142 |
|
|
|
143 |
|
|
tx : OUT STD_LOGIC_VECTOR(datawidth+1 downto 0);
|
144 |
|
|
tx_valid : OUT STD_LOGIC;
|
145 |
|
|
|
146 |
|
|
--== Data Input Interface ==--
|
147 |
|
|
|
148 |
|
|
dat_full : OUT STD_LOGIC;
|
149 |
|
|
dat_nwrite : IN STD_LOGIC;
|
150 |
|
|
dat_din : IN STD_LOGIC_VECTOR(datawidth DOWNTO 0);
|
151 |
|
|
|
152 |
|
|
--== Data Output Interface ==--
|
153 |
|
|
|
154 |
|
|
dat_nread : IN STD_LOGIC;
|
155 |
|
|
dat_empty : OUT STD_LOGIC;
|
156 |
|
|
dat_dout : OUT STD_LOGIC_VECTOR(datawidth DOWNTO 0);
|
157 |
|
|
|
158 |
|
|
--== Active Interface ==--
|
159 |
|
|
|
160 |
|
|
active : OUT STD_LOGIC
|
161 |
|
|
);
|
162 |
|
|
END COMPONENT;
|
163 |
|
|
|
164 |
|
|
|
165 |
|
|
COMPONENT switch
|
166 |
|
|
GENERIC(
|
167 |
|
|
datawidth : NATURAL RANGE 8 TO 8192;
|
168 |
|
|
nports : NATURAL RANGE 2 TO 32
|
169 |
|
|
);
|
170 |
|
|
PORT(
|
171 |
|
|
--== General Interface (Sync Rst) ==--
|
172 |
|
|
|
173 |
|
|
clk : IN STD_LOGIC;
|
174 |
|
|
rst : IN STD_LOGIC;
|
175 |
|
|
|
176 |
|
|
--== Input Interface ==--
|
177 |
|
|
|
178 |
|
|
nwrite : IN STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
179 |
|
|
full : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
180 |
|
|
din : IN STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
|
181 |
|
|
|
182 |
|
|
--== Output Interface ==--
|
183 |
|
|
|
184 |
|
|
empty : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
185 |
|
|
nread : IN STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
|
186 |
|
|
dout : OUT STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
|
187 |
|
|
|
188 |
|
|
--== Activity Interface ==--
|
189 |
|
|
|
190 |
|
|
active : IN STD_LOGIC_VECTOR(nports-1 DOWNTO 0)
|
191 |
|
|
);
|
192 |
|
|
END COMPONENT;
|
193 |
|
|
|
194 |
|
|
|
195 |
|
|
BEGIN
|
196 |
|
|
|
197 |
|
|
---=====================================---
|
198 |
|
|
--== Enable All CODEC's for Auto-Start ==--
|
199 |
|
|
---=====================================---
|
200 |
|
|
|
201 |
|
|
socw_en <= '1';
|
202 |
|
|
socw_dis <= '0';
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
---=====================---
|
206 |
|
|
--== SoCWire CODEC's ==--
|
207 |
|
|
---=====================---
|
208 |
|
|
|
209 |
|
|
G0 : FOR i IN 0 TO nports-1 GENERATE
|
210 |
|
|
socw_codec : socwire_codec
|
211 |
|
|
GENERIC MAP
|
212 |
|
|
(
|
213 |
|
|
datawidth => datawidth,
|
214 |
|
|
speed => speed,
|
215 |
|
|
after64=> after64,
|
216 |
|
|
after128=>after128,
|
217 |
|
|
disconnect_detection=>disconnect_detection
|
218 |
|
|
)
|
219 |
|
|
PORT MAP
|
220 |
|
|
(--== General Interface (Sync Rst, 50MHz Clock) ==--
|
221 |
|
|
rst => rst,
|
222 |
|
|
clk => clk,
|
223 |
|
|
--== Link Enable Interface ==--
|
224 |
|
|
socw_en => socw_en,
|
225 |
|
|
socw_dis => socw_dis,
|
226 |
|
|
--== Serial Receive Interface ==--
|
227 |
|
|
rx => rx((i+1)*(datawidth+2)-1 DOWNTO i*(datawidth+2)),
|
228 |
|
|
rx_valid => rx_valid(i),
|
229 |
|
|
--== Serial Transmit Interface ==--
|
230 |
|
|
tx => tx((i+1)*(datawidth+2)-1 DOWNTO i*(datawidth+2)),
|
231 |
|
|
tx_valid => tx_valid(i),
|
232 |
|
|
--== Data Input Interface ==--
|
233 |
|
|
dat_full => dat_full(i),
|
234 |
|
|
dat_nwrite => dat_nwrite(i),
|
235 |
|
|
dat_din => dat_din((i+1)*(datawidth+1)-1 DOWNTO i*(datawidth+1)),
|
236 |
|
|
--== Data Output Interface ==--
|
237 |
|
|
dat_nread => dat_nread(i),
|
238 |
|
|
dat_empty => dat_empty(i),
|
239 |
|
|
dat_dout => dat_dout((i+1)*(datawidth+1)-1 DOWNTO i*(datawidth+1)),
|
240 |
|
|
--== Active Interface ==--
|
241 |
|
|
active => active_i(i)
|
242 |
|
|
);
|
243 |
|
|
END GENERATE G0;
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
---==============================---
|
247 |
|
|
--== SoCWire Data Switch Core ==--
|
248 |
|
|
---==============================---
|
249 |
|
|
|
250 |
|
|
socw_switch : switch
|
251 |
|
|
GENERIC MAP
|
252 |
|
|
(
|
253 |
|
|
datawidth => datawidth,
|
254 |
|
|
nports => nports
|
255 |
|
|
)
|
256 |
|
|
PORT MAP
|
257 |
|
|
(--== General Interface (Sync Rst) ==--
|
258 |
|
|
clk => clk,
|
259 |
|
|
rst => rst,
|
260 |
|
|
--== Input Interface ==--
|
261 |
|
|
nwrite => dat_empty,
|
262 |
|
|
full => dat_nread,
|
263 |
|
|
din => dat_dout,
|
264 |
|
|
--== Output Interface ==--
|
265 |
|
|
empty => dat_nwrite,
|
266 |
|
|
nread => dat_full,
|
267 |
|
|
dout => dat_din,
|
268 |
|
|
--== Activity Interface ==--
|
269 |
|
|
active => active_i
|
270 |
|
|
);
|
271 |
|
|
|
272 |
|
|
---======================================---
|
273 |
|
|
--== Shared Internal & External Signals ==--
|
274 |
|
|
---======================================---
|
275 |
|
|
|
276 |
|
|
active <= active_i;
|
277 |
|
|
|
278 |
|
|
END rtl;
|