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

Subversion Repositories socwire

[/] [socwire/] [trunk/] [Switch/] [switch.vhd] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 ..... 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
 
44
LIBRARY IEEE;
45
USE IEEE.STD_LOGIC_1164.ALL;
46
 
47
ENTITY switch IS
48
  GENERIC(
49
          --== Number Of Ports ==--
50
 
51
          datawidth : NATURAL RANGE 8 TO 8192;
52
          nports   : NATURAL RANGE 2 TO 32
53
         );
54
  PORT(
55
       --==  General Interface (Sync Rst) ==--
56
 
57
       clk    : IN  STD_LOGIC;
58
       rst    : IN  STD_LOGIC;
59
 
60
       --== Input Interface ==--
61
 
62
       nwrite : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
63
       full   : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
64
       din    : IN  STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
65
 
66
       --== Output Interface ==--
67
 
68
       empty  : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
69
       nread  : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
70
       dout   : OUT STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
71
 
72
       --== Activity Interface ==--
73
 
74
       active : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0)
75
      );
76
END switch;
77
 
78
 
79
ARCHITECTURE rtl OF switch IS
80
 
81
---==========================---
82
--== Component Declarations ==--
83
---==========================---
84
 
85
COMPONENT entrance
86
  GENERIC(--== Number Of Ports ==--
87
          datawidth : NATURAL RANGE 8 TO 8192;
88
          nports : NATURAL RANGE 2 TO 32
89
         );
90
  PORT(--==  General Interface ==--
91
       clk     : IN  STD_LOGIC;
92
       rst     : IN  STD_LOGIC;
93
       --== Input Interface ==--
94
       nwrite  : IN  STD_LOGIC;
95
       full    : OUT STD_LOGIC;
96
       din     : IN  STD_LOGIC_VECTOR(datawidth DOWNTO 0);
97
       --== Connection Interface ==--
98
       full_in : IN  STD_LOGIC;
99
       connect : OUT STD_LOGIC;
100
       wanted  : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0)
101
      );
102
END COMPONENT;
103
 
104
COMPONENT matrix
105
  GENERIC(--== Number Of Ports ==--
106
          datawidth : NATURAL RANGE 8 TO 8192;
107
          nports : NATURAL RANGE 2 TO 32
108
         );
109
  PORT(--==  General Inputs ==--
110
       clk       : IN  STD_LOGIC;
111
       rst       : IN  STD_LOGIC;
112
       --== Input Interface ==--
113
       nwrite    : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
114
       full      : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
115
       din       : IN  STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
116
       --== Output Interface ==--
117
       empty     : OUT STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
118
       nread     : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
119
       dout      : OUT STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
120
       --== Vertical Inputs ==--
121
       op_eop    : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
122
       op_active : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
123
       op_wanted : IN  STD_LOGIC_VECTOR(nports*nports-1 DOWNTO 0);
124
       --== Horizontal Inputs ==--
125
       ip_eop    : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
126
       connect   : IN  STD_LOGIC_VECTOR(nports-1 DOWNTO 0)
127
      );
128
END COMPONENT;
129
 
130
 
131
---=======================---
132
--== Signal Declarations ==--
133
---=======================---
134
 
135
SIGNAL connect  : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
136
SIGNAL wanted   : STD_LOGIC_VECTOR(nports*nports-1 DOWNTO 0);
137
SIGNAL op_eop   : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
138
SIGNAL ip_eop   : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
139
SIGNAL full_ii  : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
140
SIGNAL din_i    : STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
141
SIGNAL full_i   : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
142
SIGNAL nwrite_i : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
143
SIGNAL empty_i  : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
144
SIGNAL nread_i  : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
145
SIGNAL dout_i   : STD_LOGIC_VECTOR((datawidth+1)*nports-1 DOWNTO 0);
146
SIGNAL active_i : STD_LOGIC_VECTOR(nports-1 DOWNTO 0);
147
 
148
BEGIN
149
 
150
  ---================================---
151
  --== Create port active signals.   ==--
152
  ---================================---
153
 
154
  active_i <= active(nports-1 DOWNTO 0);
155
 
156
  ---===============================================================---
157
  --== Detect EOP's & EEP's has they enter and leave switch matrix ==--
158
  ---===============================================================---
159
 
160
  G0 : FOR i IN 0 TO nports-1 GENERATE
161
    ip_eop(i) <= NOT(nwrite_i(i)) AND NOT(full_ii(i)) AND din_i((datawidth+1)*(i+1)-1);
162
    op_eop(i) <= NOT(empty_i(i)) AND NOT(nread_i(i)) AND dout_i((datawidth+1)*(i+1)-1);
163
  END GENERATE G0;
164
 
165
 
166
  ---================================================---
167
  --== Switch Matrix entrance & Hardware Addressing ==--
168
  ---================================================---
169
 
170
  G1 : FOR i IN 0 TO nports-1 GENERATE
171
    entr0 : entrance
172
      GENERIC MAP
173
        (--== Number Of Ports ==--
174
         datawidth => datawidth,
175
         nports => nports
176
        )
177
      PORT MAP
178
        (--==  General Interface ==--
179
         clk     => clk,
180
         rst     => rst,
181
         --== Input Interface ==--
182
         nwrite  => nwrite_i(i),
183
         full    => full_i(i),
184
         din     => din_i((datawidth+1)*(i+1)-1 DOWNTO (datawidth+1)*i),
185
         --== Connection Interface ==--
186
         full_in => full_ii(i),
187
         connect => connect(i),
188
         wanted  => wanted(nports*(i+1)-1 DOWNTO nports*i)
189
        );
190
  END GENERATE G1;
191
 
192
  ---=================---
193
  --== Switch Matrix ==--
194
  ---=================---
195
 
196
  matrix0 : matrix
197
    GENERIC MAP
198
      (--== Number Of Ports ==--
199
       datawidth => datawidth,
200
       nports => nports
201
      )
202
    PORT MAP
203
      (--==  General Inputs ==--
204
       clk       => clk,
205
       rst       => rst,
206
       --== Input Interface ==--
207
       nwrite    => nwrite_i,
208
       full      => full_ii,
209
       din       => din_i,
210
       --== Output Interface ==--
211
       empty     => empty_i,
212
       nread     => nread_i,
213
       dout      => dout_i,
214
       --== Vertical Inputs ==--
215
       op_eop    => op_eop,
216
       op_active => active_i,
217
       op_wanted => wanted,
218
       --== Horizontal Inputs ==--
219
       ip_eop    => ip_eop,
220
       connect   => connect
221
      );
222
 
223
 
224
    din_i((datawidth+1)*nports-1 DOWNTO 0) <= din;
225
    full <= full_i;
226
    nwrite_i(nports-1 DOWNTO 0) <= nwrite;
227
    empty <= empty_i(nports-1 DOWNTO 0);
228
    nread_i(nports-1 DOWNTO 0) <= nread;
229
    dout <= dout_i((datawidth+1)*nports-1 DOWNTO 0);
230
 
231
 
232
END rtl;

powered by: WebSVN 2.1.0

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