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

Subversion Repositories gpio

[/] [gpio/] [tags/] [rel_4/] [rtl/] [verilog/] [gpio_top.v] - Blame information for rev 21

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  WISHBONE General-Purpose I/O                                ////
4
////                                                              ////
5
////  This file is part of the GPIO project                       ////
6
////  http://www.opencores.org/cores/gpio/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Implementation of GPIO IP core according to                 ////
10
////  GPIO IP core specification document.                        ////
11
////                                                              ////
12
////  To Do:                                                      ////
13
////   Nothing                                                    ////
14
////                                                              ////
15
////  Author(s):                                                  ////
16
////      - Damjan Lampret, lampret@opencores.org                 ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48 21 lampret
// Revision 1.5  2001/12/12 20:35:53  lampret
49
// Fixing style.
50
//
51 20 lampret
// Revision 1.4  2001/12/12 07:12:58  lampret
52
// Fixed bug when wb_inta_o is registered (GPIO_WB_REGISTERED_OUTPUTS)
53
//
54 19 lampret
// Revision 1.3  2001/11/15 02:24:37  lampret
55
// Added GPIO_REGISTERED_WB_OUTPUTS, GPIO_REGISTERED_IO_OUTPUTS and GPIO_NO_NEGEDGE_FLOPS.
56
//
57 17 lampret
// Revision 1.2  2001/10/31 02:26:51  lampret
58
// Fixed wb_err_o.
59
//
60 15 lampret
// Revision 1.1  2001/09/18 18:49:07  lampret
61
// Changed top level ptc into gpio_top. Changed defines.v into gpio_defines.v.
62
//
63 14 lampret
// Revision 1.1  2001/08/21 21:39:28  lampret
64
// Changed directory structure, port names and drfines.
65
//
66
// Revision 1.2  2001/07/14 20:39:26  lampret
67
// Better configurability.
68
//
69
// Revision 1.1  2001/06/05 07:45:26  lampret
70
// Added initial RTL and test benches. There are still some issues with these files.
71
//
72
//
73
 
74
// synopsys translate_off
75
`include "timescale.v"
76
// synopsys translate_on
77
`include "gpio_defines.v"
78
 
79
module gpio_top(
80
        // WISHBONE Interface
81
        wb_clk_i, wb_rst_i, wb_cyc_i, wb_adr_i, wb_dat_i, wb_sel_i, wb_we_i, wb_stb_i,
82
        wb_dat_o, wb_ack_o, wb_err_o, wb_inta_o,
83
 
84
        // Auxiliary inputs interface
85
        aux_i,
86
 
87
        // External GPIO Interface
88
        in_pad_i, ext_clk_pad_i, out_pad_o, oen_padoen_o
89
);
90
 
91
parameter dw = 32;
92
parameter aw = `GPIO_ADDRHH+1;
93
parameter gw = `GPIO_IOS;
94
 
95
//
96
// WISHBONE Interface
97
//
98
input                   wb_clk_i;       // Clock
99
input                   wb_rst_i;       // Reset
100
input                   wb_cyc_i;       // cycle valid input
101
input   [aw-1:0] wb_adr_i;       // address bus inputs
102
input   [dw-1:0] wb_dat_i;       // input data bus
103
input   [3:0]            wb_sel_i;       // byte select inputs
104
input                   wb_we_i;        // indicates write transfer
105
input                   wb_stb_i;       // strobe input
106
output  [dw-1:0] wb_dat_o;       // output data bus
107
output                  wb_ack_o;       // normal termination
108
output                  wb_err_o;       // termination w/ error
109
output                  wb_inta_o;      // Interrupt request output
110
 
111
// Auxiliary Inputs Interface
112
input   [gw-1:0] aux_i;          // Auxiliary inputs
113
 
114
//
115
// External GPIO Interface
116
//
117
input   [gw-1:0] in_pad_i;       // GPIO Inputs
118
input                   ext_clk_pad_i;  // GPIO Eclk
119
output  [gw-1:0] out_pad_o;      // GPIO Outputs
120
output  [gw-1:0] oen_padoen_o;   // GPIO output drivers enables
121
 
122
`ifdef GPIO_IMPLEMENTED
123
 
124
//
125
// GPIO Input Register (or no register)
126
//
127
`ifdef GPIO_RGPIO_IN
128
reg     [gw-1:0] rgpio_in;       // RGPIO_IN register
129
`else
130
wire    [gw-1:0] rgpio_in;       // No register
131
`endif
132
 
133
//
134
// GPIO Output Register (or no register)
135
//
136
`ifdef GPIO_RGPIO_OUT
137
reg     [gw-1:0] rgpio_out;      // RGPIO_OUT register
138
`else
139
wire    [gw-1:0] rgpio_out;      // No register
140
`endif
141
 
142
//
143
// GPIO Output Driver Enable Register (or no register)
144
//
145
`ifdef GPIO_RGPIO_OE
146
reg     [gw-1:0] rgpio_oe;       // RGPIO_OE register
147
`else
148
wire    [gw-1:0] rgpio_oe;       // No register
149
`endif
150
 
151
//
152
// GPIO Interrupt Enable Register (or no register)
153
//
154
`ifdef GPIO_RGPIO_INTE
155
reg     [gw-1:0] rgpio_inte;     // RGPIO_INTE register
156
`else
157
wire    [gw-1:0] rgpio_inte;     // No register
158
`endif
159
 
160
//
161
// GPIO Positive edge Triggered Register (or no register)
162
//
163
`ifdef GPIO_RGPIO_PTRIG
164
reg     [gw-1:0] rgpio_ptrig;    // RGPIO_PTRIG register
165
`else
166
wire    [gw-1:0] rgpio_ptrig;    // No register
167
`endif
168
 
169
//
170
// GPIO Auxiliary select Register (or no register)
171
//
172
`ifdef GPIO_RGPIO_AUX
173
reg     [gw-1:0] rgpio_aux;      // RGPIO_AUX register
174
`else
175
wire    [gw-1:0] rgpio_aux;      // No register
176
`endif
177
 
178
//
179
// GPIO Control Register (or no register)
180
//
181
`ifdef GPIO_RGPIO_CTRL
182
reg     [3:0]            rgpio_ctrl;     // RGPIO_CTRL register
183
`else
184
wire    [3:0]            rgpio_ctrl;     // No register
185
`endif
186
 
187
//
188 21 lampret
// GPIO Interrupt Status Register (or no register)
189
//
190
`ifdef GPIO_RGPIO_INTS
191
reg     [gw-1:0] rgpio_ints;     // RGPIO_INTS register
192
`else
193
wire    [gw-1:0] rgpio_ints;     // No register
194
`endif
195
 
196
//
197 14 lampret
// Internal wires & regs
198
//
199
wire                    rgpio_out_sel;  // RGPIO_OUT select
200
wire                    rgpio_oe_sel;   // RGPIO_OE select
201
wire                    rgpio_inte_sel; // RGPIO_INTE select
202
wire                    rgpio_ptrig_sel;// RGPIO_PTRIG select
203
wire                    rgpio_aux_sel;  // RGPIO_AUX select
204
wire                    rgpio_ctrl_sel; // RGPIO_CTRL select
205 21 lampret
wire                    rgpio_ints_sel; // RGPIO_INTS select
206 14 lampret
wire                    latch_clk;      // Latch clock
207
wire                    full_decoding;  // Full address decoding qualification
208 17 lampret
wire    [gw-1:0] in_muxed;       // Muxed inputs
209
wire                    wb_ack;         // WB Acknowledge
210
wire                    wb_err;         // WB Error
211
wire                    wb_inta;        // WB Interrupt
212
reg     [dw-1:0] wb_dat;         // WB Data out
213
`ifdef GPIO_REGISTERED_WB_OUTPUTS
214
reg                     wb_ack_o;       // WB Acknowledge
215
reg                     wb_err_o;       // WB Error
216
reg                     wb_inta_o;      // WB Interrupt
217
reg     [dw-1:0] wb_dat_o;       // WB Data out
218
`endif
219
wire    [gw-1:0] out_pad;        // GPIO Outputs
220
`ifdef GPIO_REGISTERED_IO_OUTPUTS
221
reg     [gw-1:0] out_pad_o;      // GPIO Outputs
222
`endif
223
wire    [gw-1:0] extc_in;        // Muxed inputs sampled by external clock
224
wire                    pext_clk;       // External clock for posedge flops
225
reg     [gw-1:0] pextc_sampled;  // Posedge external clock sampled inputs
226
`ifdef GPIO_NO_NEGEDGE_FLOPS
227
`else
228
reg     [gw-1:0] nextc_sampled;  // Negedge external clock sampled inputs
229
`endif
230 14 lampret
 
231
//
232
// All WISHBONE transfer terminations are successful except when:
233
// a) full address decoding is enabled and address doesn't match
234
//    any of the GPIO registers
235
// b) wb_sel_i evaluation is enabled and one of the wb_sel_i inputs is zero
236
//
237 17 lampret
 
238
//
239
// WB Acknowledge
240
//
241
assign wb_ack = wb_cyc_i & wb_stb_i & !wb_err_o;
242
 
243
//
244
// Optional registration of WB Ack
245
//
246
`ifdef GPIO_REGISTERED_WB_OUTPUTS
247
always @(posedge wb_clk_i or posedge wb_rst_i)
248
        if (wb_rst_i)
249
                wb_ack_o <= #1 1'b0;
250
        else
251
                wb_ack_o <= #1 wb_ack;
252
`else
253
assign wb_ack_o = wb_ack;
254
`endif
255
 
256
//
257
// WB Error
258
//
259 14 lampret
`ifdef GPIO_FULL_DECODE
260
`ifdef GPIO_STRICT_32BIT_ACCESS
261 17 lampret
assign wb_err = wb_cyc_i & wb_stb_i & (!full_decoding | (wb_sel_i != 4'b1111));
262 14 lampret
`else
263 17 lampret
assign wb_err = wb_cyc_i & wb_stb_i & !full_decoding;
264 14 lampret
`endif
265
`else
266
`ifdef GPIO_STRICT_32BIT_ACCESS
267 17 lampret
assign wb_err = wb_cyc_i & wb_stb_i & (wb_sel_i != 4'b1111);
268 14 lampret
`else
269 17 lampret
assign wb_err = 1'b0;
270 14 lampret
`endif
271
`endif
272
 
273
//
274 17 lampret
// Optional registration of WB error
275 14 lampret
//
276 17 lampret
`ifdef GPIO_REGISTERED_WB_OUTPUTS
277
always @(posedge wb_clk_i or posedge wb_rst_i)
278
        if (wb_rst_i)
279
                wb_err_o <= #1 1'b0;
280
        else
281
                wb_err_o <= #1 wb_err;
282
`else
283
assign wb_err_o = wb_err;
284
`endif
285 14 lampret
 
286
//
287
// Full address decoder
288
//
289
`ifdef GPIO_FULL_DECODE
290
assign full_decoding = (wb_adr_i[`GPIO_ADDRHH:`GPIO_ADDRHL] == {`GPIO_ADDRHH-`GPIO_ADDRHL+1{1'b0}}) &
291
                        (wb_adr_i[`GPIO_ADDRLH:`GPIO_ADDRLL] == {`GPIO_ADDRLH-`GPIO_ADDRLL+1{1'b0}});
292
`else
293
assign full_decoding = 1'b1;
294
`endif
295
 
296
//
297
// GPIO registers address decoder
298
//
299
assign rgpio_out_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_OUT) & full_decoding;
300
assign rgpio_oe_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_OE) & full_decoding;
301
assign rgpio_inte_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_INTE) & full_decoding;
302
assign rgpio_ptrig_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_PTRIG) & full_decoding;
303
assign rgpio_aux_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_AUX) & full_decoding;
304
assign rgpio_ctrl_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_CTRL) & full_decoding;
305 21 lampret
assign rgpio_ints_sel = wb_cyc_i & wb_stb_i & (wb_adr_i[`GPIO_OFS_BITS] == `GPIO_RGPIO_INTS) & full_decoding;
306 14 lampret
 
307
//
308
// Write to RGPIO_CTRL or update of RGPIO_CTRL[INT] bit
309
//
310
`ifdef GPIO_RGPIO_CTRL
311
always @(posedge wb_clk_i or posedge wb_rst_i)
312
        if (wb_rst_i)
313
                rgpio_ctrl <= #1 4'b0;
314
        else if (rgpio_ctrl_sel && wb_we_i)
315
                rgpio_ctrl <= #1 wb_dat_i[3:0];
316
        else if (rgpio_ctrl[`GPIO_RGPIO_CTRL_INTE])
317 21 lampret
                rgpio_ctrl[`GPIO_RGPIO_CTRL_INTS] <= #1 rgpio_ctrl[`GPIO_RGPIO_CTRL_INTS] | wb_inta_o;
318 14 lampret
`else
319
assign rgpio_ctrl = 4'h01;      // RGPIO_CTRL[EN] = 1
320
`endif
321
 
322
//
323
// Write to RGPIO_OUT
324
//
325
`ifdef GPIO_RGPIO_OUT
326
always @(posedge wb_clk_i or posedge wb_rst_i)
327
        if (wb_rst_i)
328
                rgpio_out <= #1 {gw{1'b0}};
329
        else if (rgpio_out_sel && wb_we_i)
330
                rgpio_out <= #1 wb_dat_i[gw-1:0];
331
`else
332 17 lampret
assign rgpio_out = `GPIO_DEF_RGPIO_OUT; // RGPIO_OUT = 0x0
333 14 lampret
`endif
334
 
335
//
336 17 lampret
// Write to RGPIO_OE. Bits in RGPIO_OE are stored inverted.
337 14 lampret
//
338
`ifdef GPIO_RGPIO_OE
339
always @(posedge wb_clk_i or posedge wb_rst_i)
340
        if (wb_rst_i)
341
                rgpio_oe <= #1 {gw{1'b0}};
342
        else if (rgpio_oe_sel && wb_we_i)
343 17 lampret
                rgpio_oe <= #1 ~wb_dat_i[gw-1:0];
344 14 lampret
`else
345
assign rgpio_oe = `GPIO_DEF_RPGIO_OE;   // RGPIO_OE = 0x0
346
`endif
347
 
348
//
349
// Write to RGPIO_INTE
350
//
351
`ifdef GPIO_RGPIO_INTE
352
always @(posedge wb_clk_i or posedge wb_rst_i)
353
        if (wb_rst_i)
354
                rgpio_inte <= #1 {gw{1'b0}};
355
        else if (rgpio_inte_sel && wb_we_i)
356
                rgpio_inte <= #1 wb_dat_i[gw-1:0];
357
`else
358
assign rgpio_inte = `GPIO_DEF_RPGIO_INTE;       // RGPIO_INTE = 0x0
359
`endif
360
 
361
//
362
// Write to RGPIO_PTRIG
363
//
364
`ifdef GPIO_RGPIO_PTRIG
365
always @(posedge wb_clk_i or posedge wb_rst_i)
366
        if (wb_rst_i)
367
                rgpio_ptrig <= #1 {gw{1'b0}};
368
        else if (rgpio_ptrig_sel && wb_we_i)
369
                rgpio_ptrig <= #1 wb_dat_i[gw-1:0];
370
`else
371
assign rgpio_ptrig = `GPIO_DEF_RPGIO_PTRIG;     // RGPIO_PTRIG = 0x0
372
`endif
373
 
374
//
375
// Write to RGPIO_AUX
376
//
377
`ifdef GPIO_RGPIO_AUX
378
always @(posedge wb_clk_i or posedge wb_rst_i)
379
        if (wb_rst_i)
380
                rgpio_aux <= #1 {gw{1'b0}};
381
        else if (rgpio_aux_sel && wb_we_i)
382
                rgpio_aux <= #1 wb_dat_i[gw-1:0];
383
`else
384
assign rgpio_aux = `GPIO_DEF_RPGIO_AUX; // RGPIO_AUX = 0x0
385
`endif
386
 
387
//
388
// Latch into RGPIO_IN
389
//
390
`ifdef GPIO_RGPIO_IN
391 17 lampret
always @(posedge wb_clk_i or posedge wb_rst_i)
392 14 lampret
        if (wb_rst_i)
393
                rgpio_in <= #1 {gw{1'b0}};
394
        else
395 17 lampret
                rgpio_in <= #1 in_muxed;
396 14 lampret
`else
397 17 lampret
assign rgpio_in = in_muxed;
398 14 lampret
`endif
399
 
400
//
401 17 lampret
// Mux inputs directly from input pads with inputs sampled by external clock
402 14 lampret
//
403 17 lampret
assign in_muxed = rgpio_ctrl[`GPIO_RGPIO_CTRL_ECLK] ? extc_in : in_pad_i;
404
 
405
//
406
// Posedge pext_clk is inverted by NEC bit if negedge flops are not allowed.
407
// If negedge flops are allowed, pext_clk only clocks posedge flops.
408
//
409
`ifdef GPIO_NO_NEGEDGE_FLOPS
410
assign pext_clk = rgpio_ctrl[`GPIO_RGPIO_CTRL_NEC] ? ~ext_clk_pad_i : ext_clk_pad_i;
411
`else
412
assign pext_clk = ext_clk_pad_i;
413
`endif
414
 
415
//
416
// If negedge flops are allowed, ext_in is mux of negedge and posedge external clocked flops.
417
//
418
`ifdef GPIO_NO_NEGEDGE_FLOPS
419
assign extc_in = pextc_sampled;
420
`else
421
assign extc_in = rgpio_ctrl[`GPIO_RGPIO_CTRL_NEC] ? nextc_sampled : pextc_sampled;
422
`endif
423
 
424
//
425
// Latch using posedge external clock
426
//
427
always @(posedge pext_clk or posedge wb_rst_i)
428
        if (wb_rst_i)
429
                pextc_sampled <= #1 {gw{1'b0}};
430
        else
431
                pextc_sampled <= #1 in_pad_i;
432
 
433
//
434
// Latch using negedge external clock
435
//
436
`ifdef GPIO_NO_NEGEDGE_FLOPS
437
`else
438
always @(negedge ext_clk_pad_i or posedge wb_rst_i)
439
        if (wb_rst_i)
440
                nextc_sampled <= #1 {gw{1'b0}};
441
        else
442
                nextc_sampled <= #1 in_pad_i;
443
`endif
444
 
445
//
446
// Mux all registers when doing a read of GPIO registers
447
//
448 14 lampret
always @(wb_adr_i or rgpio_in or rgpio_out or rgpio_oe or rgpio_inte or
449
                rgpio_ptrig or rgpio_aux or rgpio_ctrl)
450
        case (wb_adr_i[`GPIO_OFS_BITS]) // synopsys full_case parallel_case
451
`ifdef GPIO_READREGS
452
                `GPIO_RGPIO_OUT: begin
453 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_out};
454 14 lampret
                end
455
                `GPIO_RGPIO_OE: begin
456 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, ~rgpio_oe};
457 14 lampret
                end
458
                `GPIO_RGPIO_INTE: begin
459 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_inte};
460 14 lampret
                end
461
                `GPIO_RGPIO_PTRIG: begin
462 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_ptrig};
463 14 lampret
                end
464
                `GPIO_RGPIO_AUX: begin
465 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_aux};
466 14 lampret
                end
467
                `GPIO_RGPIO_CTRL: begin
468 20 lampret
                        wb_dat[3:0] = rgpio_ctrl;
469
                        wb_dat[dw-1:4] = {dw-4{1'b0}};
470 14 lampret
                end
471
`endif
472 21 lampret
                `GPIO_RGPIO_INTS: begin
473
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_ints};
474
                end
475 14 lampret
                default: begin
476 20 lampret
                        wb_dat[dw-1:0] = {{dw-gw{1'b0}}, rgpio_in};
477 14 lampret
                end
478
        endcase
479
 
480
//
481 17 lampret
// WB data output
482
//
483
`ifdef GPIO_REGISTERED_WB_OUTPUTS
484
always @(posedge wb_clk_i or posedge wb_rst_i)
485
        if (wb_rst_i)
486
                wb_dat_o <= #1 {dw{1'b0}};
487
        else
488
                wb_dat_o <= #1 wb_dat;
489
`else
490
assign wb_dat_o = wb_dat;
491
`endif
492
 
493
//
494 21 lampret
// RGPIO_INTS
495
//
496
`ifdef GPIO_RGPIO_INTS
497
always @(posedge wb_clk_i or posedge wb_rst_i)
498
        if (wb_rst_i)
499
                rgpio_ints <= #1 {gw{1'b0}};
500
        else if (rgpio_ints_sel && wb_we_i)
501
                rgpio_ints <= #1 wb_dat_i[gw-1:0];
502
        else if (rgpio_ctrl[`GPIO_RGPIO_CTRL_INTE])
503
                rgpio_ints <= #1 rgpio_ints | (in_pad_i ^ ~rgpio_ptrig) & rgpio_inte;
504
`else
505
assign rgpio_ints = (in_pad_i ^ ~rgpio_ptrig) & rgpio_inte;
506
`endif
507
 
508
//
509 14 lampret
// Generate interrupt request
510
//
511 21 lampret
assign wb_inta = |rgpio_ints ? rgpio_ctrl[`GPIO_RGPIO_CTRL_INTE] : 1'b0;
512 14 lampret
 
513
//
514 17 lampret
// Optional registration of WB interrupt
515 14 lampret
//
516 17 lampret
`ifdef GPIO_REGISTERED_WB_OUTPUTS
517
always @(posedge wb_clk_i or posedge wb_rst_i)
518
        if (wb_rst_i)
519 19 lampret
                wb_inta_o <= #1 1'b0;
520 17 lampret
        else
521
                wb_inta_o <= #1 wb_inta;
522
`else
523
assign wb_inta_o = wb_inta;
524
`endif
525 14 lampret
 
526
//
527 17 lampret
// Output enables are RGPIO_OE bits
528 14 lampret
//
529 17 lampret
assign oen_padoen_o = rgpio_oe;
530 14 lampret
 
531 17 lampret
//
532
// Generate GPIO outputs
533
//
534
assign out_pad = rgpio_out & ~rgpio_aux | aux_i & rgpio_aux;
535
 
536
//
537
// Optional registration of GPIO outputs
538
//
539
`ifdef GPIO_REGISTERED_IO_OUTPUTS
540
always @(posedge wb_clk_i or posedge wb_rst_i)
541
        if (wb_rst_i)
542
                out_pad_o <= #1 {gw{1'b0}};
543
        else
544
                out_pad_o <= #1 out_pad;
545 14 lampret
`else
546 17 lampret
assign out_pad_o = out_pad;
547
`endif
548 14 lampret
 
549 17 lampret
`else
550
 
551 14 lampret
//
552
// When GPIO is not implemented, drive all outputs as would when RGPIO_CTRL
553
// is cleared and WISHBONE transfers complete with errors
554
//
555
assign wb_inta_o = 1'b0;
556
assign wb_ack_o = 1'b0;
557
assign wb_err_o = wb_cyc_i & wb_stb_i;
558
assign oen_padoen_o = {gw{1'b1}};
559
assign out_pad_o = {gw{1'b0}};
560
 
561
//
562
// Read GPIO registers
563
//
564
assign wb_dat_o = {dw{1'b0}};
565
 
566
`endif
567
 
568
endmodule

powered by: WebSVN 2.1.0

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