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

Subversion Repositories pci

[/] [pci/] [trunk/] [rtl/] [verilog/] [pci_wb_slave.v] - Blame information for rev 132

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

Line No. Rev Author Line
1 77 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "wb_slave.v"                                      ////
4
////                                                              ////
5
////  This file is part of the "PCI bridge" project               ////
6
////  http://www.opencores.org/cores/pci/                         ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Miha Dolenc (mihad@opencores.org)                     ////
10
////                                                              ////
11
////  All additional information is avaliable in the README       ////
12
////  file.                                                       ////
13
////                                                              ////
14
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2001 Miha Dolenc, mihad@opencores.org          ////
18
////                                                              ////
19
//// This source file may be used and distributed without         ////
20
//// restriction provided that this copyright statement is not    ////
21
//// removed from the file and that any derivative work contains  ////
22
//// the original copyright notice and the associated disclaimer. ////
23
////                                                              ////
24
//// This source file is free software; you can redistribute it   ////
25
//// and/or modify it under the terms of the GNU Lesser General   ////
26
//// Public License as published by the Free Software Foundation; ////
27
//// either version 2.1 of the License, or (at your option) any   ////
28
//// later version.                                               ////
29
////                                                              ////
30
//// This source is distributed in the hope that it will be       ////
31
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
32
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
33
//// PURPOSE.  See the GNU Lesser General Public License for more ////
34
//// details.                                                     ////
35
////                                                              ////
36
//// You should have received a copy of the GNU Lesser General    ////
37
//// Public License along with this source; if not, download it   ////
38
//// from http://www.opencores.org/lgpl.shtml                     ////
39
////                                                              ////
40
//////////////////////////////////////////////////////////////////////
41
//
42
// CVS Revision History
43
//
44
// $Log: not supported by cvs2svn $
45 132 mihad
// Revision 1.3  2003/08/14 18:01:53  simons
46
// ifdefs moved to thier own lines, this confuses some of the tools.
47
//
48 113 simons
// Revision 1.2  2003/08/03 18:05:06  mihad
49
// Added limited WISHBONE B3 support for WISHBONE Slave Unit.
50
// Doesn't support full speed bursts yet.
51
//
52 106 mihad
// Revision 1.1  2003/01/27 16:49:31  mihad
53
// Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
54
//
55 77 mihad
// Revision 1.4  2002/08/19 16:54:25  mihad
56
// Got rid of undef directives
57
//
58
// Revision 1.3  2002/02/01 15:25:13  mihad
59
// Repaired a few bugs, updated specification, added test bench files and design document
60
//
61
// Revision 1.2  2001/10/05 08:14:30  mihad
62
// Updated all files with inclusion of timescale file for simulation purposes.
63
//
64
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
65
// New project directory structure
66
//
67
//
68
 
69
`include "bus_commands.v"
70
`include "pci_constants.v"
71
 
72
// synopsys translate_off
73
`include "timescale.v"
74
// synopsys translate_on
75
 
76
module pci_wb_slave
77
               (    wb_clock_in,
78
                    reset_in,
79
                    wb_hit_in,
80
                    wb_conf_hit_in,
81
                    wb_map_in,
82
                    wb_pref_en_in,
83
                    wb_mrl_en_in,
84
                    wb_addr_in,
85
                    del_bc_in,
86
                    wb_del_req_pending_in,
87
                    wb_del_comp_pending_in,
88
                    pci_drcomp_pending_in,
89
                    del_bc_out,
90
                    del_req_out,
91
                    del_done_out,
92
                    del_burst_out,
93
                    del_write_out,
94
                    del_write_in,
95
                    del_error_in,
96
                    del_in_progress_out,
97
                    ccyc_addr_in,
98
                    wb_del_addr_in,
99
                    wb_del_be_in,
100
                    wb_conf_offset_out,
101
                    wb_conf_renable_out,
102
                    wb_conf_wenable_out,
103
                    wb_conf_be_out,
104
                    wb_conf_data_in,
105
                    wb_conf_data_out,
106
                    wb_data_out,
107
                    wb_cbe_out,
108
                    wbw_fifo_wenable_out,
109
                    wbw_fifo_control_out,
110
                    wbw_fifo_almost_full_in,
111
                    wbw_fifo_full_in,
112
                    wbr_fifo_renable_out,
113
                    wbr_fifo_be_in,
114
                    wbr_fifo_data_in,
115
                    wbr_fifo_control_in,
116
                    wbr_fifo_flush_out,
117
                    wbr_fifo_empty_in,
118
                    pciw_fifo_empty_in,
119
                    wbs_lock_in,
120
                    cache_line_size_not_zero,
121
                    sample_address_out,
122
                    CYC_I,
123
                    STB_I,
124
                    WE_I,
125
                    SEL_I,
126
                    SDATA_I,
127
                    SDATA_O,
128
                    ACK_O,
129
                    RTY_O,
130
                    ERR_O,
131
                    CAB_I
132
                );
133
 
134
/*----------------------------------------------------------------------------------------------------------------------
135
Various parameters needed for state machine and other stuff
136
----------------------------------------------------------------------------------------------------------------------*/
137
parameter WBR_SEL  = 1'b0 ;
138
parameter CONF_SEL = 1'b1 ;
139
 
140
`define FSM_BITS 3
141
parameter S_IDLE         = `FSM_BITS'h0 ;
142
parameter S_DEC1         = `FSM_BITS'h1 ;
143
parameter S_DEC2         = `FSM_BITS'h2 ;
144
parameter S_START        = `FSM_BITS'h3 ;
145
parameter S_W_ADDR_DATA  = `FSM_BITS'h4 ;
146
parameter S_READ         = `FSM_BITS'h5 ;
147
parameter S_CONF_WRITE   = `FSM_BITS'h6 ;
148
parameter S_CONF_READ    = `FSM_BITS'h7 ;
149
 
150
/*----------------------------------------------------------------------------------------------------------------------
151
System signals inputs
152
wb_clock_in - WISHBONE bus clock input
153
reset_in    - system reset input controlled by bridge's reset logic
154
----------------------------------------------------------------------------------------------------------------------*/
155
input wb_clock_in, reset_in ;
156
 
157
/*----------------------------------------------------------------------------------------------------------------------
158
Inputs from address decoding logic
159
wb_hit_in - Decoder logic indicates if address is in a range of one of images
160
wb_conf_hit_in - Decoder logic indicates that address is in configuration space range
161
wb_map_in   - Decoder logic provides information about image mapping - memory mapped image   - wb_map_in = 0
162
                                                                       IO space mapped image - wb_map_in = 1
163
wb_pref_en_in - Prefetch enable signal from currently selected image - used for PCI bus command usage
164
wb_addr_in - Address already transalted from WB bus to PCI bus input
165
wb_mrl_en_in - Memory read line enable input for each image
166
----------------------------------------------------------------------------------------------------------------------*/
167
input [4:0]     wb_hit_in ;         // hit indicators
168
input           wb_conf_hit_in ;    // configuration hit indicator
169
input [4:0]     wb_pref_en_in ;     // prefetch enable from all images
170
input [4:0]     wb_mrl_en_in ;      // Memory Read line command enable from images
171
input [4:0]     wb_map_in ;         // address space mapping indicators - 1 memory space mapping, 0-IO space mapping
172
input [31:0]    wb_addr_in ;        // Translated address input
173
 
174
/*----------------------------------------------------------------------------------------------------------------------
175
Delayed transaction control inputs and outputs:
176
Used for locking particular accesses when delayed transactions are in progress:
177
wb_del_addr_in - delayed transaction address input - when completion is ready it's used for transaction decoding
178
wb_del_be_in   - delayed transaction byte enable input - when completion is ready it's used for transaction decoding
179
----------------------------------------------------------------------------------------------------------------------*/
180
input  [31:0] wb_del_addr_in ;
181
input  [3:0]  wb_del_be_in ;
182
 
183
input [3:0] del_bc_in ;           // delayed request bus command used
184
input       wb_del_req_pending_in ;   // delayed request pending indicator
185
input       wb_del_comp_pending_in ;  // delayed completion pending indicator
186
input       pci_drcomp_pending_in ; // PCI initiated delayed read completion pending
187
 
188
output [3:0] del_bc_out ; // delayed transaction bus command output
189
 
190
output del_req_out ; // output for issuing delayed transaction requests
191
 
192
output del_done_out ; // output indicating current delayed completion finished on WISHBONE bus
193
 
194
output del_burst_out ; // delayed burst transaction indicator
195
 
196
output del_in_progress_out ; // delayed in progress indicator - since delayed transaction can be a burst transaction, progress indicator must be used for proper operation
197
 
198
output del_write_out ;   // write enable for delayed transaction - used for indicating that transaction is a write
199
 
200
input  del_write_in ;    // indicates that current delayed completion is from a write request
201
input  del_error_in ;    // indicate that delayed request terminated with an error - used for write requests
202
 
203
input  [31:0] ccyc_addr_in ; // configuration cycle address input - it's separate from other addresses, since it is stored separately and decoded for type 0 configuration access
204
 
205
/*----------------------------------------------------------------------------------------------------------------------
206
Configuration space access control and data signals
207
wb_conf_offset_out  - lower 12 bits of address input provided for register offset
208
wb_conf_renable     - read enable signal for configuration space accesses
209
wb_conf_wenable     - write enable signal for configuration space accesses
210
wb_conf_be_out      - byte enable signals for configuration space accesses
211
wb_conf_data_in     - data from configuration space
212
wb_conf_data_in     - data provided for configuration space
213
----------------------------------------------------------------------------------------------------------------------*/
214
output [11:0]   wb_conf_offset_out ;  // register offset output
215
output          wb_conf_renable_out,  // configuration read and write enable outputs
216
                wb_conf_wenable_out ;
217
output [3:0]    wb_conf_be_out ;      // byte enable outputs for configuration space
218
input  [31:0]   wb_conf_data_in ;     // configuration data input from configuration space
219
output [31:0]   wb_conf_data_out ;    // configuration data output for configuration space
220
 
221
/*----------------------------------------------------------------------------------------------------------------------
222
Data from WISHBONE bus output to interiror of the core:
223
Data output is used for normal and configuration accesses.
224
---------------------------------------------------------------------------------------------------------------------*/
225
output [31:0] wb_data_out ;
226
 
227
/*----------------------------------------------------------------------------------------------------------------------
228
Bus command - byte enable output - during address phase of image access this bus holds information about PCI
229
bus command that should be used, during dataphases ( configuration or image access ) this bus contains inverted
230
SEL_I signals
231
---------------------------------------------------------------------------------------------------------------------*/
232
output [3:0] wb_cbe_out ;
233
 
234
/*----------------------------------------------------------------------------------------------------------------------
235
WBW_FIFO control signals used for sinking data into WBW_FIFO and status monitoring
236
---------------------------------------------------------------------------------------------------------------------*/
237
output       wbw_fifo_wenable_out ;    // write enable for WBW_FIFO output
238
output [3:0] wbw_fifo_control_out ;    // control bus output for WBW_FIFO
239
input        wbw_fifo_almost_full_in ; // almost full status indicator from WBW_FIFO
240
input        wbw_fifo_full_in ;        // full status indicator from WBW_FIFO
241
 
242
/*----------------------------------------------------------------------------------------------------------------------
243
WBR_FIFO control signals used for fetching data from WBR_FIFO and status monitoring
244
---------------------------------------------------------------------------------------------------------------------*/
245
output          wbr_fifo_renable_out ;      // WBR_FIFO read enable output
246
input   [3:0]   wbr_fifo_be_in ;            // byte enable input from WBR_FIFO
247
input   [31:0]  wbr_fifo_data_in ;          // data input from WBR_FIFO
248
input   [3:0]   wbr_fifo_control_in ;       // control bus input from WBR_FIFO
249
output          wbr_fifo_flush_out ;        // flush signal for WBR_FIFO
250
input           wbr_fifo_empty_in ;         // empty status indicator from WBR_FIFO
251
 
252
// used for transaction ordering requirements - WISHBONE read cannot complete until writes from PCI are completed
253
input           pciw_fifo_empty_in ;        // empty status indicator from PCIW_FIFO
254
 
255
/*----------------------------------------------------------------------------------------------------------------------
256
wbs_lock_in: internal signal that locks out all accesses, except delayed completions or configuration accesses.
257
( when master operation is disabled via master enable bit in configuration spacei )
258
---------------------------------------------------------------------------------------------------------------------*/
259
input           wbs_lock_in ;
260
 
261
// cache line size register must hold appropriate value to enable read bursts and special commands on PCI bus!
262
input           cache_line_size_not_zero ;
263
 
264
// state machine signals to wb_addr_mux when to sample wb address input
265
output          sample_address_out ;
266
reg             sample_address_out ;
267
 
268
/*----------------------------------------------------------------------------------------------------------------------
269
WISHBONE bus interface signals - can be connected directly to WISHBONE bus
270
---------------------------------------------------------------------------------------------------------------------*/
271
input           CYC_I ;     // cycle indicator
272
input           STB_I ;     // strobe input - input data is valid when strobe and cycle indicator are high
273
input           WE_I  ;     // write enable input - 1 - write operation, 0 - read operation
274
input   [3:0]   SEL_I ;     // Byte select inputs
275
input   [31:0]  SDATA_I ;   // WISHBONE slave interface input data bus
276
output  [31:0]  SDATA_O ;   // WISHBONE slave interface output data bus
277
output          ACK_O ;     // Acknowledge output - qualifies valid data on data output bus or received data on data input bus
278
output          RTY_O ;     // retry output - signals to WISHBONE master that cycle should be terminated and retried later
279
output          ERR_O ;     // Signals to WISHBONE master that access resulted in an error
280
input           CAB_I ;     // consecutive address burst input - indicates that master will do a serial address transfer in current cycle
281
 
282
`ifdef REGISTER_WBS_OUTPUTS
283
reg [31:0]  SDATA_O ;
284
reg         ACK_O   ;
285
reg         RTY_O   ;
286
reg         ERR_O   ;
287
 
288
reg [3:0] del_bc_out ; // delayed transaction bus command output
289
reg       del_req_out ; // output for issuing delayed transaction requests
290
reg       del_done_out ; // output indicating current delayed completion finished on WISHBONE bus
291
reg       del_burst_out ; // delayed burst transaction indicator
292
reg       del_in_progress_out ; // delayed in progress indicator - since delayed transaction can be a burst transaction, progress indicator must be used for proper operation
293
reg       del_write_out ;   // write enable for delayed transaction - used for indicating that transaction is a write
294
 
295
`ifdef HOST
296
reg          wb_conf_wenable_out ;
297
reg [31:0]   wb_conf_data_out ;    // configuration data output for configuration space
298
`endif
299
 
300
reg [3:0]  wb_conf_be_out ;      // byte enable outputs for configuration space
301
reg [31:0] wb_data_out ;
302
 
303
reg [3:0] wb_cbe_out ;
304
 
305
reg       wbw_fifo_wenable_out ;    // write enable for WBW_FIFO output
306
reg [3:0] wbw_fifo_control_out ;    // control bus output for WBW_FIFO
307
 
308
reg       wbr_fifo_renable_out ;      // WBR_FIFO read enable output
309
`endif
310
 
311
reg [(`FSM_BITS - 1):0]  c_state ; //current state register
312
 
313
reg [(`FSM_BITS - 1):0]  n_state ; //next state input to current state register
314
 
315
// state machine register control
316
always@(posedge wb_clock_in or posedge reset_in)
317
begin
318
    if (reset_in)
319
        c_state <= #`FF_DELAY S_IDLE ;
320
    else
321
        c_state <= #`FF_DELAY n_state ;
322
end
323
 
324
 
325
// variable for bus command multiplexer logic output for delayed requests
326
reg [3:0] del_bc ;
327
 
328
//register for intermediate data and select storage
329
reg [35:0] d_incoming ;
330
 
331
// enable for incoming data register
332
reg d_incoming_ena ;
333
 
334
// incoming data register control logic
335
always@(posedge wb_clock_in or posedge reset_in)
336
begin
337
    if (reset_in)
338
        d_incoming <= #`FF_DELAY {35{1'b0}} ;
339
    else if (d_incoming_ena)
340
        d_incoming <= #`FF_DELAY {SEL_I, SDATA_I} ;
341
end
342
 
343
/*===================================================================================================================================================================================
344
Write allow for image accesses. Writes through images are allowed when all of following are true:
345
- WBW_FIFO musn't be almost full nor full for image writes to be allowed - Every transaction takes at least two locations in the FIFO
346
- delayed read from from WISHBONE to PCI request musn't be present
347
- delayed read from PCI to WISHBONE completion musn't be present
348
- lock input musn't be set - it can be set because of error reporting or because PCI master state machine is disabled
349
===================================================================================================================================================================================*/
350
wire wimg_wallow           = ~|{ wbw_fifo_almost_full_in , wbw_fifo_full_in, wb_del_req_pending_in, pci_drcomp_pending_in, wbs_lock_in } ;
351
reg img_wallow ;
352
/*===================================================================================================================================================================================
353
WISHBONE slave can request an image read accesses when all of following are true:
354
- delayed completion is not present
355
- delayed request is not present
356
- operation is not locked because of error reporting mechanism or because PCI master is disabled
357
===================================================================================================================================================================================*/
358
wire wdo_del_request     = ~|{ wb_del_req_pending_in, wb_del_comp_pending_in, wbs_lock_in } ;
359
reg do_del_request ;
360
/*===================================================================================================================================================================================
361
WISHBONE slave can complete an image read accesses when all of following are true:
362
- delayed read completion is present
363
- delayed read completion is the same as current read access ( dread_completion_hit is 1 )
364
- PCI Write FIFO is empty - no posted write is waiting to be finished in PCIW_FIFO
365
- WBR_FIFO empty status is not active
366
===================================================================================================================================================================================*/
367
wire wdel_addr_hit = ( wb_del_addr_in == wb_addr_in ) && ( SEL_I == wb_del_be_in ) ;
368
reg  del_addr_hit ;
369
wire wdel_completion_allow = wb_del_comp_pending_in && ((~del_write_in && ~WE_I && pciw_fifo_empty_in && ~wbr_fifo_empty_in) || (del_write_in && WE_I)) ;
370
reg del_completion_allow ;
371
 
372
/*----------------------------------------------------------------------------------------------------------------------
373
img_hit - state of wb_hit_in bus when when state machine signals decode is over
374
---------------------------------------------------------------------------------------------------------------------*/
375
reg [4:0] img_hit ;
376
wire wb_hit = |( img_hit ) ;
377
 
378
/*----------------------------------------------------------------------------------------------------------------------
379
Control logic for image control signals
380
pref_en - prefetch enable of currently selected image
381
mrl_en  - Memory read line enable of currently selected image
382
map     - Address space mapping for currently selected image
383
---------------------------------------------------------------------------------------------------------------------*/
384
reg pref_en, mrl_en, map ;
385
wire wpref_en   = |(wb_pref_en_in & wb_hit_in) ;
386
wire wmrl_en    = |(wb_mrl_en_in & wb_hit_in) ;
387
wire wmap       = |(wb_map_in & wb_hit_in) ;
388
 
389
// state machine controls when results from decoders, comparison etc. are sampled into registers to decode an access
390
reg decode_en ;
391
 
392
reg wb_conf_hit ;
393
always@(posedge reset_in or posedge wb_clock_in)
394
begin
395
    if (reset_in)
396
    begin
397
        img_wallow           <= #`FF_DELAY 1'b0 ;
398
        wb_conf_hit          <= #`FF_DELAY 1'b0 ;
399
        do_del_request       <= #`FF_DELAY 1'b0 ;
400
        del_addr_hit         <= #`FF_DELAY 1'b0 ;
401
        del_completion_allow <= #`FF_DELAY 1'b0 ;
402
        img_hit              <= #`FF_DELAY 5'h00 ;
403
        pref_en              <= #`FF_DELAY 1'b0 ;
404
        mrl_en               <= #`FF_DELAY 1'b0 ;
405
        map                  <= #`FF_DELAY 1'b0 ;
406
    end
407
    else
408
    if (decode_en)
409
    begin
410
        img_wallow           <= #`FF_DELAY wimg_wallow ;
411
        wb_conf_hit          <= #`FF_DELAY wb_conf_hit_in ;
412
        do_del_request       <= #`FF_DELAY wdo_del_request ;
413
        del_addr_hit         <= #`FF_DELAY wdel_addr_hit ;
414
        del_completion_allow <= #`FF_DELAY wdel_completion_allow ;
415
        img_hit              <= #`FF_DELAY wb_hit_in ;
416
        pref_en              <= #`FF_DELAY wpref_en && cache_line_size_not_zero ;
417
        mrl_en               <= #`FF_DELAY wmrl_en  && cache_line_size_not_zero ;
418
        map                  <= #`FF_DELAY wmap ;
419
    end
420
end
421
 
422
wire   del_burst = CAB_I && (pref_en || mrl_en) && ~WE_I && cache_line_size_not_zero ; // delayed burst indicator - only when WB master attempts CAB transfer and cache line size register is set appropriately and
423
                                                                                       // either prefetch enable or memory read line enable of corresponding image are set -
424
                                                                                       // applies for reads only - delayed write cannot be a burst
425
wire do_dread_completion = del_completion_allow && del_addr_hit ;
426
 
427
`ifdef GUEST
428
 
429
    // wires indicating allowance for configuration cycle generation requests
430
    wire do_ccyc_req  = 1'b0 ;
431
    wire do_ccyc_comp = 1'b0 ;
432
 
433
    // wires indicating allowance for interrupt acknowledge cycle generation requests
434
    wire do_iack_req  = 1'b0 ;
435
    wire do_iack_comp = 1'b0 ;
436
 
437
    // variables for configuration access control signals
438
    reg conf_wenable ;
439
    assign wb_conf_wenable_out = 1'b0 ;
440
 
441
    // configuration cycle data register hit
442
    wire ccyc_hit = 1'b0 ;
443
    wire iack_hit = 1'b0 ;
444
 
445
    wire wccyc_hit = 1'b0 ;
446
    wire wiack_hit = 1'b0 ;
447
 
448
`else
449
`ifdef HOST
450
    // only host implementation has access for generating interrupt acknowledge and configuration cycles
451
    // configuration cycle data register hit
452
    reg current_delayed_is_ccyc ;
453
    reg current_delayed_is_iack ;
454
 
455 132 mihad
    wire wccyc_hit = (wb_addr_in[8:2] == {1'b1, `CNF_DATA_ADDR}) ;
456
 
457
    wire wiack_hit = (wb_addr_in[8:2] == {1'b1, `INT_ACK_ADDR})  ;
458
 
459 77 mihad
    reg iack_hit ;
460
    reg ccyc_hit ;
461
    always@(posedge reset_in or posedge wb_clock_in)
462
    begin
463
        if (reset_in)
464
        begin
465
            ccyc_hit <= #`FF_DELAY 1'b0 ;
466
            iack_hit <= #`FF_DELAY 1'b0 ;
467
        end
468
        else
469
        if (decode_en)
470
        begin
471
            ccyc_hit <= #`FF_DELAY wccyc_hit ;
472
            iack_hit <= #`FF_DELAY wiack_hit ;
473
        end
474
    end
475
 
476
    // wires indicating allowance for configuration cycle generation requests
477
    wire do_ccyc_req  = do_del_request && ccyc_hit;
478
    wire do_ccyc_comp = del_completion_allow && ccyc_hit && current_delayed_is_ccyc ; // && del_bc_hit
479
 
480
    // wires indicating allowance for interrupt acknowledge cycle generation requests
481
    wire do_iack_req  = do_del_request && iack_hit ;
482
    wire do_iack_comp = del_completion_allow && iack_hit && current_delayed_is_iack ; // && del_bc_hit
483
 
484
    // variables for configuration access control signals
485
    reg conf_wenable ;
486
 
487
    // following flip-flops remember whether current delayed transaction is interrupt acknowledge or configuration cycle transaction
488
    always@(posedge wb_clock_in or posedge reset_in)
489
    begin
490
        if ( reset_in )
491
        begin
492
            current_delayed_is_ccyc <= #`FF_DELAY 1'b0 ;
493
            current_delayed_is_iack <= #`FF_DELAY 1'b0 ;
494
        end
495
        else
496
        if ( del_done_out )
497
        begin
498
            current_delayed_is_ccyc <= #`FF_DELAY 1'b0 ;
499
            current_delayed_is_iack <= #`FF_DELAY 1'b0 ;
500
        end
501
        else
502
        if ( del_req_out && wb_conf_hit )
503
        begin
504
            current_delayed_is_ccyc <= #`FF_DELAY do_ccyc_req ;
505
            current_delayed_is_iack <= #`FF_DELAY do_iack_req ;
506
        end
507
    end
508
 
509
`endif
510
`endif
511
 
512
// configuration read enable - supplied for host and guest bridges
513
reg conf_renable ;
514
assign wb_conf_renable_out = conf_renable ;
515
 
516
// burst access indicator
517
wire burst_transfer = CYC_I && CAB_I ;
518
 
519
// WBW_FIFO control output
520
reg [3:0] wbw_fifo_control ;
521
 
522
// WBW_FIFO wenable output assignment
523
reg wbw_fifo_wenable ;
524
 
525
// WBR_FIFO control outputs
526
reg wbr_fifo_flush, wbr_fifo_renable ; // flush and read enable outputs
527
 
528
// flush signal for WBR_FIFO must be registered, since it asinchronously resets some status registers
529
wire            wbr_fifo_flush_reg ;
530
pci_async_reset_flop async_reset_as_wbr_flush
531
(
532
    .data_in              (wbr_fifo_flush),
533
    .clk_in               (wb_clock_in),
534
    .async_reset_data_out (wbr_fifo_flush_reg),
535
    .reset_in                     (reset_in)
536
) ;
537
assign  wbr_fifo_flush_out = wbr_fifo_flush_reg ;
538
 
539
// delayed transaction request control signals
540
reg del_req, del_done ;
541
 
542
// WISHBONE handshaking control outputs
543
reg ack, rty, err ;
544
 
545
`ifdef REGISTER_WBS_OUTPUTS
546
// wire for write attempt - 1 when external WB master is attempting a write
547
// wire for read attempt  - 1 when external master is attempting a read
548
wire wattempt = ( CYC_I && STB_I && WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
549
wire rattempt = ( CYC_I && STB_I && ~WE_I ) && (!ACK_O && !ERR_O && !RTY_O) ;
550
 
551
`else
552
// wire for write attempt - 1 when external WB master is attempting a write
553
// wire for read attempt  - 1 when external master is attempting a read
554
wire wattempt = ( CYC_I && STB_I && WE_I ) ; // write is qualified when cycle, strobe and write enable inputs are all high
555
wire rattempt = ( CYC_I && STB_I && ~WE_I ) ; // read is qualified when cycle and strobe are high and write enable is low
556
 
557
`endif
558
/*----------------------------------------------------------------------------------------------------------------------
559
Delayed transaction bus command generation
560
Bus command for delayed reads depends on image's address space mapping and control bits and
561
whether or not these are interrupt acknowledge requests or configuration cycle requests
562
---------------------------------------------------------------------------------------------------------------------*/
563
 
564
always@(map or mrl_en or ccyc_hit or WE_I or wb_conf_hit or CAB_I or pref_en)
565
begin
566
`ifdef HOST
567
// only host implementation supports configuration and interrupt acknowledge commands
568
    if (wb_conf_hit)
569
    begin
570
        case( {ccyc_hit, WE_I} )
571
            2'b11:  del_bc = `BC_CONF_WRITE ;
572
            2'b10:  del_bc = `BC_CONF_READ ;
573
            2'b01:  del_bc = `BC_RESERVED0 ; // invalid combination - interrupt acknowledge cycle must be a read
574
            2'b00:  del_bc = `BC_IACK ;
575
        endcase
576
    end
577
    else
578
`endif
579
    begin
580
        if ( map )
581
        begin
582
            del_bc = `BC_IO_READ ;
583
        end
584
        else
585
        begin
586
            case ({(CAB_I && mrl_en), pref_en})
587
                2'b00: del_bc = `BC_MEM_READ ;     // if this is not burst transfer or memory read line command is disabled - use memory read
588
                2'b01: del_bc = `BC_MEM_READ ;     // same as previous case
589
                2'b10: del_bc = `BC_MEM_READ_LN ;  // burst transfer, memory read line command enabled, prefetch disabled - use memory read line command
590
                2'b11: del_bc = `BC_MEM_READ_MUL ; // same as previous case, except prefetch is enabled - use memory read multiple command
591
            endcase
592
        end
593
    end
594
end
595
 
596
reg del_in_progress ; // state machine indicates whether current read completion is in progress on WISHBONE bus
597
 
598 132 mihad
wire image_access_error = (map && burst_transfer) ; // IO write is a burst
599 77 mihad
 
600
`ifdef HOST
601
    reg [1:0]   wbw_data_out_sel ;
602
    parameter SEL_ADDR_IN = 2'b10 ;
603
    parameter SEL_CCYC_ADDR = 2'b11 ;
604
    parameter SEL_DATA_IN   = 2'b00 ;
605
`else
606
`ifdef GUEST
607
    reg wbw_data_out_sel ;
608
    parameter SEL_ADDR_IN = 1'b1 ;
609
    parameter SEL_DATA_IN = 1'b0 ;
610
`endif
611
`endif
612
 
613
`ifdef WB_DECODE_FAST
614
    `ifdef REGISTER_WBS_OUTPUTS
615
        `define PCI_WB_SLAVE_S_DEC1
616
    `endif
617
`endif
618
 
619
`ifdef WB_DECODE_MEDIUM
620
    `define PCI_WB_SLAVE_S_DEC1
621
`endif
622
 
623
`ifdef WB_DECODE_SLOW
624
    `define PCI_WB_SLAVE_S_DEC1
625
    `define PCI_WB_SLAVE_S_DEC2
626
`endif
627
// state machine logic
628
always@(
629
        c_state                     or
630
        wattempt                    or
631
        img_wallow                  or
632
        burst_transfer              or
633
        wb_hit                      or
634
        map                         or
635
        rattempt                    or
636
        do_dread_completion         or
637
        wbr_fifo_control_in         or
638
        wb_conf_hit                 or
639
        do_ccyc_req                 or
640
        do_ccyc_comp                or
641
        ccyc_hit                    or
642
        del_error_in                or
643
        do_iack_req                 or
644
        do_iack_comp                or
645
        iack_hit                    or
646
        image_access_error          or
647
        wbw_fifo_almost_full_in     or
648
        wbw_fifo_full_in            or
649
        do_del_request              or
650
        wbr_fifo_empty_in
651
       )
652
begin
653
    // default signal values
654
    // response signals inactive
655
    ack         = 1'b0 ;
656
    rty         = 1'b0 ;
657
    err         = 1'b0 ;
658
 
659
    //write signals inactive
660
    wbw_fifo_control[`ADDR_CTRL_BIT] = 1'b1 ;
661
    wbw_fifo_control[`DATA_ERROR_CTRL_BIT] = 1'b0 ;
662
    wbw_fifo_control[`LAST_CTRL_BIT] = 1'b0 ;
663
    wbw_fifo_control[`UNUSED_CTRL_BIT] = 1'b0 ;
664
 
665
    wbw_fifo_wenable = 1'b0 ;
666
    d_incoming_ena   = 1'b0 ;
667
 
668
    // read signals inactive
669
    wbr_fifo_flush   = 1'b0 ;
670
    wbr_fifo_renable = 1'b0 ;
671
    del_req          = 1'b0 ;
672
    del_done         = 1'b0 ;
673
 
674
    // configuration space control signals inactive
675
    conf_wenable = 1'b0 ;
676
    conf_renable = 1'b0 ;
677
 
678
    // read is not in progress
679
    del_in_progress = 1'b0 ;
680
 
681
    decode_en = 1'b0 ;
682
 
683
    wbw_data_out_sel         = SEL_ADDR_IN ;
684
 
685
    sample_address_out = 1'b0 ;
686
 
687
    case (c_state)
688
    S_IDLE: begin
689
                if ( wattempt || rattempt )
690
                begin
691
 
692
                `ifdef PCI_WB_SLAVE_S_DEC1
693
                    n_state = S_DEC1 ;
694
                `else
695
                    decode_en = 1'b1 ;
696
                    n_state = S_START ;
697
                `endif
698
 
699
                    sample_address_out = 1'b1 ;
700
                end
701
                else
702
                    n_state = S_IDLE ;
703
            end
704
`ifdef PCI_WB_SLAVE_S_DEC1
705
    S_DEC1: begin
706
                if ( wattempt || rattempt )
707
                begin
708
 
709
                `ifdef PCI_WB_SLAVE_S_DEC2
710
                    n_state = S_DEC2 ;
711
                `else
712
                    decode_en = 1'b1 ;
713
                    n_state = S_START ;
714
                `endif
715
 
716
                end
717
                else
718
                    n_state = S_IDLE ;
719
            end
720
`endif
721
`ifdef PCI_WB_SLAVE_S_DEC2
722
    S_DEC2: begin
723
 
724
                if ( wattempt || rattempt )
725
                begin
726
                    decode_en = 1'b1 ;
727
                    n_state = S_START ;
728
                end
729
                else
730
                    n_state = S_IDLE ;
731
            end
732
`endif
733
    S_START:begin
734
                if (wb_conf_hit) // configuration space hit
735
                begin
736
                    `ifdef HOST
737
                        wbw_data_out_sel = SEL_CCYC_ADDR ;
738
                    `endif
739
 
740
                    if ( wattempt )
741
                        n_state = S_CONF_WRITE ; // go to conf. write state
742
                    else
743
                    if ( rattempt )
744
                    begin
745
                        n_state     = S_CONF_READ ; // go to conf. read state
746
                    end
747
                    else
748
                        n_state = S_IDLE ; // master terminated - go back to idle state
749
 
750
                end // wb_conf_hit
751
                else
752
                if( wb_hit && (wattempt || rattempt) )
753
                begin
754
                    wbw_data_out_sel = SEL_DATA_IN ;
755
 
756
                    // check error conditions for image writes or reads
757
                    if ( image_access_error )
758
                    begin
759
                        n_state = S_IDLE ; // go back to idle state because of an error condition
760
                        err     = 1'b1 ;
761
                    end // error conditions
762
                    else
763
                    // check for retry conditions for image writes or reads
764
                    if ( (wattempt && ~img_wallow) ||
765
                         (rattempt && ~do_dread_completion) // write to image not allowed, no read ready yet - retry
766
                       )
767
                    begin
768
                        n_state = S_IDLE ; // go back to IDLE
769
 
770
                        rty     = 1'b1 ;
771
 
772
                        del_req = do_del_request && rattempt ;
773
 
774
                    end //retry
775
                    else // everything OK - proceed
776
                    if ( wattempt )
777
                    begin
778
                        n_state = S_W_ADDR_DATA ; // goto write transfer state
779
 
780
                        // respond with acknowledge
781
                        ack              = 1'b1 ;
782
 
783
                        wbw_fifo_wenable = 1'b1 ;
784
 
785
                        // data is latched to data incoming intermidiate stage - it will be put in FIFO later
786
                        d_incoming_ena   = 1'b1 ;
787
                    end
788
                    else
789
                    begin
790
                        err = wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT] ;
791
                        ack = ~wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT] ;
792
                        wbr_fifo_renable    = 1'b1 ;
793
                        del_in_progress = 1'b1 ;
794
 
795
                        if ( wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT] || wbr_fifo_control_in[`LAST_CTRL_BIT] )
796
                        begin
797
 
798
                            n_state = S_IDLE ; // go back to idle state
799
                            // respond that read is finished
800
                            del_done     = 1'b1 ;
801
 
802
                        end // end read
803
                        else
804
                            n_state = S_READ ; // go to read state
805
                    end
806
                end
807
                else
808
                    n_state = S_IDLE ;
809
 
810
            end
811
 
812
    S_W_ADDR_DATA: begin
813
                        wbw_data_out_sel = SEL_DATA_IN ;
814 132 mihad
                        err = 1'b0 ;
815 77 mihad
                        rty = burst_transfer && wattempt && (wbw_fifo_almost_full_in || wbw_fifo_full_in) ;
816
 
817 132 mihad
                        if ( ~burst_transfer || wattempt && ( wbw_fifo_almost_full_in || wbw_fifo_full_in ) )
818 77 mihad
                        begin
819
                            n_state = S_IDLE ;
820
 
821
                            // write last data to FIFO and don't latch new data
822
                            wbw_fifo_control[`ADDR_CTRL_BIT] = 1'b0 ;
823
                            wbw_fifo_control[`LAST_CTRL_BIT] = 1'b1 ;
824
                            wbw_fifo_wenable = 1'b1 ;
825
                        end
826
                        else
827
                        begin
828
                            n_state = S_W_ADDR_DATA ;
829
                            wbw_fifo_control[`ADDR_CTRL_BIT] = 1'b0 ;
830
                            wbw_fifo_control[`LAST_CTRL_BIT] = 1'b0 ;
831
                            ack              = wattempt ;
832
                            wbw_fifo_wenable = wattempt ;
833
                            d_incoming_ena   = wattempt ;
834
                        end
835
                    end // S_W_ADDR_DATA
836
 
837
    S_READ:begin
838
                // this state is for reads only - in this state read is in progress all the time
839
                del_in_progress = 1'b1 ;
840
 
841 132 mihad
                ack = burst_transfer && rattempt && ~wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT] && ~wbr_fifo_empty_in ;
842
                err = burst_transfer && rattempt && wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT]  && ~wbr_fifo_empty_in  ;
843 77 mihad
 
844
                // if acknowledge is beeing signalled then enable read from wbr fifo
845 132 mihad
                wbr_fifo_renable = burst_transfer && rattempt && ~wbr_fifo_empty_in ;
846 77 mihad
 
847 132 mihad
                if ( ~burst_transfer || rattempt && (wbr_fifo_empty_in || wbr_fifo_control_in[`DATA_ERROR_CTRL_BIT] || wbr_fifo_control_in[`LAST_CTRL_BIT]) )
848 77 mihad
                begin
849
                    n_state = S_IDLE ;
850
                    del_done = 1'b1 ;
851
                    wbr_fifo_flush = ~wbr_fifo_empty_in ;
852
                end
853
                else
854
                begin
855
                    n_state          = S_READ ;
856
                end
857
            end // S_READ
858
 
859
    S_CONF_WRITE:  begin
860
                        `ifdef HOST
861
                            wbw_data_out_sel = SEL_CCYC_ADDR ;
862 132 mihad
                            del_req          = do_ccyc_req && ~burst_transfer  ;
863
                            del_done         = do_ccyc_comp && ~burst_transfer ;
864
                            del_in_progress  = do_ccyc_comp && ~burst_transfer ;
865 77 mihad
                        `endif
866
 
867
                        n_state         = S_IDLE ; // next state after configuration access is always idle
868
 
869 132 mihad
                        if ( burst_transfer )
870 77 mihad
                        begin
871
                            err = 1'b1 ;
872
                        end
873
                        else
874
                        begin
875
                            `ifdef HOST
876
                            if ( do_ccyc_req || (ccyc_hit && ~do_ccyc_comp))
877
                            begin
878
                                rty = 1'b1 ;
879
                            end
880
                            else
881
                            if ( do_ccyc_comp )
882
                            begin
883
                                err = del_error_in ;
884
                                ack = ~del_error_in ;
885
                            end
886
                            else
887
                            begin
888
                                ack = ~ccyc_hit ;
889
                                conf_wenable = ~ccyc_hit ;
890
                            end
891
                            `else
892
                            ack = 1'b1 ;
893
                            conf_wenable = 1'b1 ;
894
                            `endif
895
                        end
896
                    end // S_CONF_WRITE
897
 
898
    S_CONF_READ:   begin
899
                        `ifdef HOST
900
                            wbw_data_out_sel = SEL_CCYC_ADDR ;
901 132 mihad
                            del_req          = ~burst_transfer && ( do_ccyc_req  || do_iack_req  ) ;
902
                            del_done         = ~burst_transfer && ( do_ccyc_comp || do_iack_comp ) ;
903
                            del_in_progress  = ~burst_transfer && ( do_ccyc_comp || do_iack_comp ) ;
904
                            wbr_fifo_renable = ~burst_transfer && ( do_ccyc_comp || do_iack_comp ) ;
905 77 mihad
                        `endif
906
 
907
                        n_state = S_IDLE ; // next state after configuration access is always idle
908
 
909 132 mihad
                        if ( burst_transfer )
910 77 mihad
                        begin
911
                            err = 1'b1 ;
912
                        end
913
                        else
914
                        begin
915
                            `ifdef HOST
916
                            if ( do_ccyc_req || ( ccyc_hit && ~do_ccyc_comp ))
917
                            begin
918
                                rty = 1'b1 ;
919
                            end
920
                            else
921
                            if ( do_iack_req || ( iack_hit && ~do_iack_comp ))
922
                            begin
923
                                rty = 1'b1 ;
924
                            end
925
                            else
926
                            if ( do_iack_comp || do_ccyc_comp )
927
                            begin
928
                                err = del_error_in ;
929
                                ack = ~del_error_in ;
930
                            end
931
                            else
932
                            begin
933
                                ack = ~( ccyc_hit || iack_hit ) ;
934
                                conf_renable = ~( ccyc_hit || iack_hit ) ;
935
                            end
936
                            `else
937
                            ack = 1'b1 ;
938
                            conf_renable = 1'b1 ;
939
                            `endif
940
                        end
941
                    end //S_CONF_READ
942
    default:begin
943
                n_state = S_IDLE ; // return to idle state
944
            end //default
945
    endcase
946
end
947
 
948
// configuration space offset output assignment
949
assign wb_conf_offset_out = {wb_addr_in[11:2], 2'b00} ; // upper 10 bits of address input and two zeros
950
 
951
// data output assignment - for image writes, first data is address, subsequent data comes from intermediate register
952
reg [31:0] wb_data ;
953
`ifdef HOST
954
reg [1:0] wbw_data_out_sel_reg ;
955
always@(posedge wb_clock_in or posedge reset_in)
956
begin
957
    if ( reset_in )
958
        wbw_data_out_sel_reg <= #`FF_DELAY SEL_ADDR_IN ;
959
    else
960
        wbw_data_out_sel_reg <= #`FF_DELAY wbw_data_out_sel ;
961
end
962
 
963
always@(wbw_data_out_sel_reg or wb_addr_in or ccyc_addr_in or d_incoming)
964
begin
965
    case ( wbw_data_out_sel_reg )
966
        SEL_CCYC_ADDR:  wb_data = ccyc_addr_in ;
967
        SEL_DATA_IN:    wb_data = d_incoming ;
968
        default: wb_data        = wb_addr_in ;
969
    endcase
970
end
971
`else
972
`ifdef GUEST
973
reg wbw_data_out_sel_reg ;
974
always@(posedge wb_clock_in or posedge reset_in)
975
begin
976
    if ( reset_in )
977
        wbw_data_out_sel_reg <= #`FF_DELAY SEL_ADDR_IN ;
978
    else
979
        wbw_data_out_sel_reg <= #`FF_DELAY wbw_data_out_sel ;
980
end
981
 
982
always@(wbw_data_out_sel_reg or wb_addr_in or d_incoming)
983
begin
984
    if ( wbw_data_out_sel_reg )
985
        wb_data = wb_addr_in ;
986
    else
987
        wb_data = d_incoming ;
988
end
989
`endif
990
`endif
991
 
992
// command / byte enable assignment - with address, bus command is provided, with data - byte enables are provided
993
reg [3:0] wb_cbe ;
994
 
995
always@(wbw_data_out_sel_reg or d_incoming or map)
996
begin
997
    if (wbw_data_out_sel_reg && map)
998
        wb_cbe = `BC_IO_WRITE ;
999
    else
1000
    if (wbw_data_out_sel_reg)
1001
        wb_cbe = `BC_MEM_WRITE ;
1002
    else
1003
        wb_cbe = ~(d_incoming[35:32]) ;
1004
end
1005
 
1006
// for configuration writes, data output is always data from WISHBONE - in guest implementation data is all 0.
1007
`ifdef GUEST
1008
    assign wb_conf_data_out = 32'h00000000 ;
1009
`endif
1010
 
1011
`ifdef GUEST
1012
    `ifdef NO_CNF_IMAGE
1013
    `else
1014
        `define PCI_WB_SLAVE_DO_OUT_MUX
1015
    `endif
1016
`else
1017
`ifdef HOST
1018
    `define PCI_WB_SLAVE_DO_OUT_MUX ;
1019
`endif
1020
`endif
1021
 
1022
`ifdef PCI_WB_SLAVE_DO_OUT_MUX
1023
    reg [31:0] sdata_source ;
1024
 
1025
    // WISHBONE data output select lines for output multiplexor
1026
    wire sdata_o_sel_new = ( wb_conf_hit_in && ~wiack_hit && ~wccyc_hit ) ? CONF_SEL : WBR_SEL ;
1027
    reg sdata_o_sel ;
1028
 
1029
    always@(posedge wb_clock_in or posedge reset_in)
1030
    begin
1031
        if ( reset_in )
1032
            sdata_o_sel <= #`FF_DELAY WBR_SEL ;
1033
        else
1034
        if ( decode_en )
1035
            sdata_o_sel <= #`FF_DELAY sdata_o_sel_new ;
1036
    end
1037
 
1038
    always@(sdata_o_sel or wbr_fifo_data_in or wb_conf_data_in)
1039
    begin
1040
        case (sdata_o_sel)
1041
            WBR_SEL :sdata_source = wbr_fifo_data_in ;
1042
            CONF_SEL:sdata_source = wb_conf_data_in ;
1043
        endcase
1044
    end
1045
`else
1046
    wire [31:0] sdata_source = wbr_fifo_data_in ;
1047
`endif
1048
 
1049
`ifdef REGISTER_WBS_OUTPUTS
1050
 
1051
always@(posedge wb_clock_in or posedge reset_in)
1052
begin
1053
    if ( reset_in )
1054
    begin
1055
        ACK_O         <= #`FF_DELAY 1'b0 ;
1056
        RTY_O         <= #`FF_DELAY 1'b0 ;
1057
        ERR_O         <= #`FF_DELAY 1'b0 ;
1058
        SDATA_O       <= #`FF_DELAY 0 ;
1059
        del_write_out <= #`FF_DELAY 1'b0 ;
1060
 
1061
        `ifdef HOST
1062
        wb_conf_wenable_out <= #`FF_DELAY 1'b0 ;
1063
        wb_conf_data_out    <= #`FF_DELAY 0 ;
1064
        `endif
1065
 
1066
        del_bc_out    <= #`FF_DELAY `BC_RESERVED0 ;
1067
        del_req_out <= #`FF_DELAY 1'b0 ;
1068
        del_done_out <= #`FF_DELAY 1'b0 ;
1069
        del_burst_out <= #`FF_DELAY 1'b0 ;
1070
        del_in_progress_out <= #`FF_DELAY 1'b0 ;
1071
        wb_conf_be_out <= #`FF_DELAY 0 ;
1072
        wb_data_out    <= #`FF_DELAY 0 ;
1073
        wb_cbe_out <= #`FF_DELAY 0 ;
1074
        wbw_fifo_wenable_out <= #`FF_DELAY 0 ;
1075
        wbw_fifo_control_out <= #`FF_DELAY 0 ;
1076
        wbr_fifo_renable_out <= #`FF_DELAY 0 ;
1077
    end
1078
    else
1079
    begin
1080
        ACK_O   <= #`FF_DELAY ack && !ACK_O ;
1081
        RTY_O   <= #`FF_DELAY rty && !RTY_O ;
1082
        ERR_O    <= #`FF_DELAY err && !ERR_O ;
1083
        SDATA_O       <= #`FF_DELAY sdata_source ;
1084
        del_write_out <= #`FF_DELAY WE_I ;
1085
 
1086
        `ifdef HOST
1087
        wb_conf_wenable_out <= #`FF_DELAY conf_wenable ;
1088
        wb_conf_data_out    <= #`FF_DELAY SDATA_I ;
1089
        `endif
1090
 
1091
        del_bc_out <= #`FF_DELAY del_bc ;
1092
        del_req_out <= #`FF_DELAY del_req ;
1093
        del_done_out <= #`FF_DELAY del_done ;
1094
        del_burst_out <= #`FF_DELAY del_burst ;
1095
        del_in_progress_out <= #`FF_DELAY del_in_progress ;
1096
        wb_conf_be_out <= #`FF_DELAY SEL_I ;
1097
        wb_data_out <= #`FF_DELAY wb_data ;
1098
        wb_cbe_out <= #`FF_DELAY wb_cbe ;
1099
        wbw_fifo_wenable_out <= #`FF_DELAY wbw_fifo_wenable ;
1100
        wbw_fifo_control_out <= #`FF_DELAY wbw_fifo_control ;
1101
        wbr_fifo_renable_out <= #`FF_DELAY wbr_fifo_renable ;
1102
    end
1103
end
1104
 
1105
`else
1106
 
1107
assign SDATA_O = sdata_source ;
1108
 
1109
assign ACK_O = ack ;
1110
assign RTY_O = rty ;
1111
assign ERR_O = err ;
1112
 
1113
// write operation indicator for delayed transaction requests
1114
assign del_write_out = WE_I ;
1115
assign del_bc_out = del_bc ;
1116
assign del_req_out  = del_req ; // read request
1117
assign del_done_out = del_done ; // read done
1118
assign del_burst_out = del_burst ;
1119
assign del_in_progress_out = del_in_progress ;
1120
`ifdef HOST
1121
assign wb_conf_data_out = SDATA_I ;
1122
assign wb_conf_wenable_out = conf_wenable ;
1123
`endif
1124
// Configuration space byte enables output
1125
assign wb_conf_be_out = SEL_I ; // just route select lines from WISHBONE to conf space
1126
assign wb_data_out    = wb_data ;
1127
assign wb_cbe_out = wb_cbe ;
1128
assign wbw_fifo_wenable_out = wbw_fifo_wenable ; //write enable for WBW_FIFO
1129
assign wbw_fifo_control_out = wbw_fifo_control ; //control bus output for WBW_FIFO
1130
assign wbr_fifo_renable_out = wbr_fifo_renable ; //read enable for wbr_fifo
1131
`endif
1132
 
1133
endmodule //WB_SLAVE

powered by: WebSVN 2.1.0

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