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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [RTL_VA/] [SPW_TOP.sv] - Blame information for rev 40

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 40 redbear
/*
2
//=================================================================//
3
//=
4
//=     SpwTCR
5
//=
6
//=     Author: Tiago da Costa Rodrigues
7
//=     E-Mail: tiagofee@gmail.com
8
//=     Licence: LGPL
9
//=
10
//=     Description: TOP module with submodules connections.
11
//=
12
//=
13
//=
14
//=     Version History:
15
//=     0.1: 10/01/2016 - First Version
16
//=
17
//=================================================================//
18
*/
19
module SPW_TOP(
20
CLOCK,
21
RESETn,
22
LINK_START,
23
LINK_DISABLE,
24
AUTOSTART,
25
CURRENTSTATE,
26
FLAGS,
27
DATA_I,
28
WR_DATA,
29
TX_FULL,
30
DATA_O,
31
RD_DATA,
32
RX_EMPTY,
33
TICK_OUT,
34
TIME_OUT,
35
TICK_IN,
36
TIME_IN,
37
TX_CLK_DIV,
38
SPILL_ENABLE,
39
Din,
40
Sin,
41
Dout,
42
Sout
43 5 redbear
);
44
 
45
 
46
 
47 40 redbear
//control Interface
48
input                                   CLOCK;
49
input                                   RESETn;
50
input                                   LINK_START;
51
input                                   LINK_DISABLE;
52
input                                   AUTOSTART;
53
output logic [2:0]      CURRENTSTATE;
54
output logic [10:0]     FLAGS;
55
input            [8:0]  DATA_I;
56
input                                   WR_DATA;
57
output logic                    TX_FULL;
58
output logic [8:0]      DATA_O;
59
input                                   RD_DATA;
60
output logic                    RX_EMPTY;
61
input                                   Din;
62
input                                   Sin;
63
output logic                    TICK_OUT;
64
output logic [7:0]      TIME_OUT;
65
output logic                    Dout;
66
output logic                    Sout;
67
input                                   TICK_IN;
68
input            [7:0]  TIME_IN;
69
input            [6:0]  TX_CLK_DIV;
70
input                                           SPILL_ENABLE;
71
 
72
//Wires
73
logic                   resetTx_w;
74
logic                   enableTx_w;
75
logic                   sendNULLs_w;
76
logic                   sendFCTs_w;
77
logic                   sendNChars_w;
78
logic                   sendTimeCodes_w;
79
logic                   startupRate_w;
80
logic                   resetRx_w;
81
logic                   enableRx_w;
82
logic                   gotBit_w;
83
logic                   gotFCT_w;
84
logic                   gotNChar_w;
85
logic                   gotTimeCode_w;
86
logic                   gotNULL_w;
87
logic                   creditError_w;
88
logic                   rxError_w;
89
logic                   gotData_w;
90
logic                   gotEEP_w;
91
logic                   gotEOP_w;
92
logic                   creditErr_w;
93
logic                   creditError_tx_w;
94
logic                   creditError_rx_w;
95
logic                   rx_fifo_empty_w;
96
logic                   rx_fifo_full_w;
97
logic                   rx_fifo_read_w;
98
logic                   rx_fifo_write_w;
99
logic                   tx_fifo_empty_w;
100
logic                   tx_fifo_full_w;
101
logic                   tx_fifo_read_w;
102
logic                   tx_fifo_write_w;
103
logic                   tx_clock_en_w;
104
logic                           clk_rx_w;
105
logic                   enableTimer_w;
106
logic                   after128_w;
107
logic                   after64_w;
108
logic                           sendFctReq_w;
109
logic                   sendFctAck_w;
110
logic                           almost_full_w;
111
logic [8:0]             rx_fifo_data_i_w;
112
logic [8:0]             rx_fifo_data_o_w;
113
logic [8:0]             tx_fifo_data_i_w;
114
logic [8:0]             tx_fifo_data_o_w;
115
logic                   data_req_w;
116
logic                   data_ack_w;
117
 
118
//Assignments
119
assign TX_FULL  = tx_fifo_full_w;
120
assign RX_EMPTY         = rx_fifo_empty_w;
121
//Error handle
122
assign FLAGS = {rxError_w, creditError_tx_w, creditError_rx_w, gotTimeCode_w, gotFCT_w, gotData_w, gotEEP_w, gotEOP_w, gotNChar_w, gotNULL_w, gotBit_w};
123
 
124
assign creditError_w = creditError_tx_w | creditError_rx_w;
125
SpwTCR_FSM FSM(
126
 
127
          .CLOCK(CLOCK),
128
          .RESETn(RESETn),
129
          .LINK_START(LINK_START),
130
          .LINK_DISABLE(LINK_DISABLE),
131
          .AUTOSTART(AUTOSTART),
132
          .CURRENTSTATE(CURRENTSTATE),
133
          .after128(after128_w),
134
          .after64(after64_w),
135
          .enableTimer(enableTimer_w),
136
          .resetTx(resetTx_w),
137
          .enableTx(enableTx_w),
138
          .sendNULLs(sendNULLs_w),
139
          .sendFCTs(sendFCTs_w),
140
          .sendNChars(sendNChars_w),
141
          .sendTimeCodes(sendTimeCodes_w),
142
          .startupRate(startupRate_w),
143
          .resetRx(resetRx_w),
144
          .enableRx(enableRx_w),
145
          .gotFCT(gotFCT_w),
146
          .gotNChar(gotNChar_w),
147
          .gotTimeCode(gotTimeCode_w),
148
          .gotNULL(gotNULL_w),
149
          .creditError(creditError_w),
150
          .rxError(rxError_w)
151
  );
152
 
153
SpwTCR_FSM_TIMER FSM_TIMER(
154
.CLOCK(CLOCK),
155
.RESETn(RESETn),
156
.enableTimer(enableTimer_w),
157
.after128(after128_w),
158
.after64(after64_w)
159
);
160
 
161
SpwTCR_RX_CLOCK_RECOVER RX_CLOCK_RECOVER(
162
.Din(Din),
163
.Sin(Sin),
164
.clk_rx(clk_rx_w)
165
);
166
 
167
SpwTCR_RX_FIFO RX_FIFO(
168
.clk(CLOCK),
169
.RESETn(RESETn),
170
.data_req(RD_DATA),
171
.we(rx_fifo_write_w),
172
.data_i(rx_fifo_data_i_w),
173
.data_o(DATA_O),
174
.full(rx_fifo_full_w),
175
.almost_full(almost_full_w),
176
.empty(rx_fifo_empty_w)
177
);
178
 
179
 
180
SpwTCR_RX RX(
181
.Din(Din),
182
.Sin(Sin),
183
.CLK_RX(clk_rx_w),
184
.CLOCK(CLOCK),
185
.RESETn(RESETn & resetRx_w),
186
.TICK_OUT(TICK_OUT),
187
.TIME_OUT(TIME_OUT),
188
.RX_DATA(rx_fifo_data_i_w),
189
.BUFFER_WRITE(rx_fifo_write_w),
190
.BUFFER_READY(!rx_fifo_full_w),
191
.almost_full(almost_full_w),
192
.enableRx(enableRx_w),
193
.gotBit(gotBit_w),
194
.gotFCT(gotFCT_w),
195
.gotNChar(gotNChar_w),
196
.gotTimeCode(gotTimeCode_w),
197
.gotNULL(gotNULL_w),
198
.gotData(gotData_w),
199
.gotEEP(gotEEP_w),
200
.gotEOP(gotEOP_w),
201
.creditErr(creditError_rx_w),
202
.rxError(rxError_w),
203
.sendFctReq(sendFctReq_w),
204
.sendFctAck(sendFctAck_w)
205
);
206
 
207
SpwTCR_TX_FIFO TX_FIFO(
208
.CLOCK(CLOCK),
209
.RESETn(RESETn),
210
.data_req(data_req_w),
211
.we(WR_DATA), .data_i(DATA_I),
212
.data_o(tx_fifo_data_o_w),
213
.data_ack(data_ack_w),
214
.full(tx_fifo_full_w),
215
.empty(tx_fifo_empty_w)
216
);
217
 
218
 
219
SpwTCR_TX_CLOCK TX_CLOCK (
220
.CLOCK(CLOCK),
221
.RESETn(RESETn),
222
.TX_CLK_DIV(TX_CLK_DIV),
223
.startupRate(startupRate_w),
224
.CLK_EN(tx_clock_en_w)
225
);
226
 
227
 
228
SpwTCR_TX TX(
229
.CLOCK(CLOCK),
230
.RESETn(RESETn),
231
.CLK_EN(tx_clock_en_w),
232
.resetTx(RESETn & resetTx_w),
233
.enableTx(enableTx_w),
234
.sendNULLs(sendNULLs_w),
235
.sendFCTs(sendFCTs_w),
236
.sendNChars(sendNChars_w),
237
.sendTimeCodes(sendTimeCodes_w),
238
.creditErr(creditError_tx_w),
239
.TICK_IN(TICK_IN),
240
.TIME_IN(TIME_IN),
241
.sendFctReq(sendFctReq_w),
242
.sendFctAck(sendFctAck_w),
243
.spillEnable(SPILL_ENABLE),
244
.gotFCT(gotFCT_w),
245
.data_ack(data_ack_w),
246
.data(tx_fifo_data_o_w),
247
.data_req(data_req_w),
248
.Dout(Dout),
249
.Sout(Sout)
250
);
251
 
252
endmodule

powered by: WebSVN 2.1.0

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