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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_3/] [rtl/] [verilog/] [pci_master32_sm.v] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "pci_master32_sm.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 73 mihad
// Revision 1.3  2002/02/01 15:25:12  mihad
46
// Repaired a few bugs, updated specification, added test bench files and design document
47
//
48 21 mihad
// Revision 1.2  2001/10/05 08:14:29  mihad
49
// Updated all files with inclusion of timescale file for simulation purposes.
50
//
51 6 mihad
// Revision 1.1.1.1  2001/10/02 15:33:46  mihad
52
// New project directory structure
53 2 mihad
//
54 6 mihad
//
55 2 mihad
 
56
// module includes pci master state machine and surrounding logic
57 21 mihad
 
58
// synopsys translate_off
59 6 mihad
`include "timescale.v"
60 21 mihad
// synopsys translate_on
61
`include "pci_constants.v"
62 6 mihad
 
63 2 mihad
module PCI_MASTER32_SM
64
(
65
    // system inputs
66
    clk_in,
67
    reset_in,
68
    // arbitration
69
    pci_req_out,
70
    pci_gnt_in,
71
    // master in/outs
72
    pci_frame_in,
73
    pci_frame_out,
74
    pci_frame_out_in,
75
    pci_frame_load_out,
76
    pci_frame_en_in,
77
    pci_frame_en_out,
78
    pci_irdy_in,
79
    pci_irdy_out,
80
    pci_irdy_en_out,
81 21 mihad
 
82 2 mihad
    // target response inputs
83
    pci_trdy_in,
84
    pci_trdy_reg_in,
85
    pci_stop_in,
86
    pci_stop_reg_in,
87
    pci_devsel_in,
88
    pci_devsel_reg_in,
89
 
90
    // address, data, bus command, byte enable in/outs
91
    pci_ad_reg_in,
92
    pci_ad_out,
93
    pci_ad_en_out,
94
    pci_cbe_out,
95
    pci_cbe_en_out,
96
 
97
    // other side of state machine
98
    address_in,
99
    bc_in,
100
    data_in,
101
    data_out,
102
    be_in,
103
    req_in,
104
    rdy_in,
105
    last_in,
106
    next_data_in,
107
    next_be_in,
108
    next_last_in,
109 21 mihad
    ad_load_out,
110
    ad_load_on_transfer_out,
111 2 mihad
    wait_out,
112
    wtransfer_out,
113
    rtransfer_out,
114
    retry_out,
115
    rerror_out,
116
    first_out,
117
    mabort_out,
118
    latency_tim_val_in
119
) ;
120
 
121
// system inputs
122
input   clk_in,
123
        reset_in ;
124
 
125
/*==================================================================================================================
126
PCI interface signals - bidirectional signals are divided to inputs and outputs in I/O cells instantiation
127
module. Enables are separate signals.
128
==================================================================================================================*/
129
// arbitration
130
output  pci_req_out ;
131
 
132
input   pci_gnt_in ;
133
 
134
// master in/outs
135
input   pci_frame_in ;
136
input   pci_frame_en_in ;
137
input   pci_frame_out_in ;
138
 
139
output  pci_frame_out,
140
        pci_frame_en_out ;
141
 
142
output  pci_frame_load_out ;
143
 
144
input   pci_irdy_in ;
145
output  pci_irdy_out,
146
        pci_irdy_en_out;
147 21 mihad
 
148 2 mihad
// target response inputs
149
input   pci_trdy_in,
150
        pci_trdy_reg_in,
151
        pci_stop_in,
152
        pci_stop_reg_in,
153
        pci_devsel_in,
154
        pci_devsel_reg_in ;
155 21 mihad
 
156 2 mihad
// address, data, bus command, byte enable in/outs
157
input   [31:0]  pci_ad_reg_in ;
158
output  [31:0]  pci_ad_out ;
159
 
160
reg     [31:0]  pci_ad_out ;
161
 
162
output          pci_ad_en_out ;
163
 
164
output  [3:0]   pci_cbe_out ;
165
 
166
reg     [3:0]   pci_cbe_out ;
167
 
168
output          pci_cbe_en_out ;
169
 
170
input   [31:0]  address_in ; // current request address input
171
 
172
input   [3:0]   bc_in ;      // current request bus command input
173
 
174
input   [31:0]  data_in ;    // current dataphase data input
175
 
176
output  [31:0]  data_out ;    // for read operations - current request data output
177
 
178 21 mihad
reg     [31:0]  data_out ;
179 2 mihad
 
180
input   [3:0]   be_in ;      // current dataphase byte enable inputs
181
 
182
input           req_in ;     // initiator cycle is requested
183
input           rdy_in ;     // requestor indicates that data is ready to be sent for write transaction and ready to
184
                            // be received on read transaction
185
input           last_in ;    // last dataphase in current transaction indicator
186
 
187
// status outputs
188
output wait_out,            // wait indicates to the backend that dataphases are not in progress on PCI bus
189
       wtransfer_out,       // on any rising clock edge that this status is 1, data is transferred - heavy constraints here
190
       rtransfer_out,       // registered transfer indicator - when 1 indicates that data was transfered on previous clock cycle
191
       retry_out,           // retry status output - when target signals a retry
192
       rerror_out,          // registered error output - when 1 indicates that error was signalled by a target on previous clock cycle
193
       first_out ,          // indicates whether or not any data was transfered in current transaction
194
       mabort_out;          // master abort indicator
195
 
196
reg wait_out ;
197
 
198
// latency timer value input - state machine starts latency timer whenever it starts a transaction and last is not
199 21 mihad
// asserted ( meaning burst transfer ).
200 2 mihad
input [7:0] latency_tim_val_in ;
201
 
202
// next data, byte enable and last inputs
203
input [31:0] next_data_in ;
204
input [3:0]  next_be_in ;
205
input        next_last_in ;
206
 
207
// clock enable for data output flip-flops - whenever data is transfered, sm loads next data to those flip flops
208 21 mihad
output       ad_load_out,
209
             ad_load_on_transfer_out ;
210 2 mihad
 
211
// parameters - states - one hot
212
// idle state
213
parameter S_IDLE            = 4'h1 ;
214
 
215
// address state
216
parameter S_ADDRESS         = 4'h2 ;
217
 
218
// transfer state - dataphases
219
parameter S_TRANSFER        = 4'h4 ;
220
 
221
// turn arround state
222
parameter S_TA_END          = 4'h8 ;
223
 
224
// change state - clock enable for sm state register
225
wire change_state ;
226
// next state for state machine
227 73 mihad
reg [3:0] next_state ;
228 2 mihad
// SM state register
229 73 mihad
reg [3:0] cur_state ;
230 2 mihad
 
231
// variables for indicating which state state machine is in
232
// this variables are used to reduce logic levels in case of heavily constrained PCI signals
233
reg sm_idle            ;
234
reg sm_address         ;
235
reg sm_data_phases     ;
236
reg sm_turn_arround    ;
237
 
238
// state machine register control logic with clock enable
239
always@(posedge reset_in or posedge clk_in)
240
begin
241
    if (reset_in)
242
        cur_state <= #`FF_DELAY S_IDLE ;
243
    else
244
    if ( change_state )
245
        cur_state <= #`FF_DELAY next_state ;
246
end
247
 
248
// parameters - data selector - ad and bc lines switch between address/data and bus command/byte enable respectively
249
parameter SEL_ADDR_BC      = 2'b01 ;
250
parameter SEL_DATA_BE      = 2'b00 ;
251
parameter SEL_NEXT_DATA_BE = 2'b11 ;
252
 
253
reg [1:0] wdata_selector ;
254
 
255
wire u_dont_have_pci_bus = pci_gnt_in || ~pci_frame_in || ~pci_irdy_in ;    // pci master can't start a transaction when GNT is deasserted ( 1 ) or
256
                                                                            // bus is not in idle state ( FRAME and IRDY both 1 )
257
wire u_have_pci_bus      = ~pci_gnt_in && pci_frame_in && pci_irdy_in ;
258
 
259
// decode count enable - counter that counts cycles passed since address phase
260 21 mihad
wire        sm_decode_count_enable = sm_data_phases ;                                                               // counter is enabled when master wants to transfer
261 2 mihad
wire        decode_count_enable    = sm_decode_count_enable && pci_trdy_in && pci_stop_in && pci_devsel_in ;        // and target is not responding
262 21 mihad
wire        decode_count_load      = ~decode_count_enable ;
263 2 mihad
reg [2:0]   decode_count ;
264
 
265
wire decode_to = ~( decode_count[2] || decode_count[1]) ;
266
 
267
always@(posedge reset_in or posedge clk_in)
268
begin
269
    if ( reset_in )
270
        // initial value of counter is 4
271
        decode_count <= #`FF_DELAY 3'h4 ;
272
    else
273
    if ( decode_count_load )
274
        decode_count <= #`FF_DELAY 3'h4 ;
275
    else
276
    if ( decode_count_enable )
277
        decode_count <= #`FF_DELAY decode_count - 1'b1 ;
278
end
279
 
280
// Bus commands LSbit indicates whether operation is a read or a write
281
wire do_write = bc_in[0] ;
282
 
283
// latency timer
284
reg [7:0]   latency_timer ;
285
 
286 21 mihad
wire latency_time_out     = ~(
287
                               (latency_timer[7] || latency_timer[6] || latency_timer[5] || latency_timer[4]) ||
288
                               (latency_timer[3] || latency_timer[2] || latency_timer[1] )
289
                             ) ;
290 2 mihad
 
291 21 mihad
wire latency_timer_enable = (sm_address || sm_data_phases) && ~latency_time_out ;
292 2 mihad
wire latency_timer_load   = ~sm_address && ~sm_data_phases ;
293
 
294
always@(posedge clk_in or posedge reset_in)
295
begin
296
    if (reset_in)
297 21 mihad
        latency_timer <= #`FF_DELAY 8'h00 ;
298 2 mihad
    else
299
    if ( latency_timer_load )
300
        latency_timer <= #`FF_DELAY latency_tim_val_in ;
301
    else
302 21 mihad
    if ( latency_timer_enable)         // latency timer counts down until it expires - then it stops
303 2 mihad
        latency_timer <= #`FF_DELAY latency_timer - 1'b1 ;
304
end
305
 
306
// master abort indicators - when decode time out occurres and still no target response is received
307
wire do_master_abort = decode_to && pci_trdy_in && pci_stop_in && pci_devsel_in ;
308
reg mabort1 ;
309
always@(posedge reset_in or posedge clk_in)
310
begin
311
    if (reset_in)
312
        mabort1 <= #`FF_DELAY 1'b0 ;
313
    else
314
        mabort1 <= #`FF_DELAY do_master_abort ;
315
end
316
 
317
reg mabort2 ;
318
always@(posedge reset_in or posedge clk_in)
319
begin
320
    if ( reset_in )
321
        mabort2 <= #`FF_DELAY 1'b0 ;
322
    else
323
        mabort2 <= #`FF_DELAY mabort1 ;
324
end
325
 
326
// master abort is only asserted for one clock cycle
327
assign mabort_out = mabort1 && ~mabort2 ;
328
 
329
// register indicating when master should do timeout termination (latency timer expires)
330
reg timeout ;
331
always@(posedge reset_in or posedge clk_in)
332
begin
333
    if (reset_in)
334
        timeout <= #`FF_DELAY 1'b0 ;
335 21 mihad
    else
336 2 mihad
        timeout <= #`FF_DELAY (latency_time_out && ~pci_frame_out_in && pci_gnt_in || timeout ) && ~wait_out ;
337
end
338
 
339
wire timeout_termination = sm_turn_arround && timeout && pci_stop_reg_in ;
340
 
341
// frame control logic
342
// frame is forced to 0 (active) when state machine is in idle state, since only possible next state is address state which always drives frame active
343
wire force_frame = ~sm_idle ;
344
// slow signal for frame calculated from various registers in the core
345 21 mihad
wire slow_frame  = last_in || (latency_time_out && pci_gnt_in) || (next_last_in && sm_data_phases) || mabort1 ;
346 2 mihad
// critical timing frame logic in separate module - some combinations of target signals force frame to inactive state immediately after sampled asserted
347
// (STOP)
348
FRAME_CRIT frame_iob_feed
349
(
350
    .pci_frame_out      (pci_frame_out),
351
    .force_frame_in     (force_frame),
352
    .slow_frame_in      (slow_frame),
353
    .pci_stop_in        (pci_stop_in)
354
) ;
355
 
356
// frame IOB flip flop's clock enable signal
357
// slow clock enable - calculated from internal - non critical paths
358
wire frame_load_slow = sm_idle || sm_address || mabort1 ;
359
 
360
// critical clock enable for frame IOB in separate module - target response signals actually allow frame value change - critical timing
361
FRAME_LOAD_CRIT frame_iob_ce
362
(
363
    .pci_frame_load_out (pci_frame_load_out),
364
    .sm_data_phases_in  (sm_data_phases),
365
    .frame_load_slow_in (frame_load_slow),
366
    .pci_trdy_in        (pci_trdy_in),
367
    .pci_stop_in        (pci_stop_in)
368
) ;
369
 
370
// IRDY driving
371
// non critical path for IRDY calculation
372
wire irdy_slow = pci_frame_out_in && mabort1 || mabort2 ;
373
 
374
// critical path in separate module
375
IRDY_OUT_CRIT irdy_iob_feed
376
(
377
    .pci_irdy_out       (pci_irdy_out),
378
    .irdy_slow_in       (irdy_slow),
379
    .pci_frame_out_in   (pci_frame_out_in),
380
    .pci_trdy_in        (pci_trdy_in),
381
    .pci_stop_in        (pci_stop_in)
382
) ;
383 21 mihad
 
384 2 mihad
// transfer FF indicator - when first transfer occurs it is set to 1 so backend can distinguish between disconnects and retries.
385
wire sm_transfer = sm_data_phases ;
386
reg transfer ;
387
 
388
wire transfer_input = sm_transfer && (~(pci_trdy_in || pci_devsel_in) || transfer) ;
389
 
390
always@(posedge clk_in or posedge reset_in)
391
begin
392
    if (reset_in)
393
        transfer <= #`FF_DELAY 1'b0 ;
394
    else
395
        transfer <= #`FF_DELAY transfer_input ;
396
end
397
 
398
assign first_out = ~transfer ;
399
 
400
// fast transfer status output - it's only negated target ready, since wait indicator qualifies valid transfer
401
assign wtransfer_out = ~pci_trdy_in ;
402
 
403
// registered transfer status output - calculated from registered target response inputs
404
assign rtransfer_out = ~(pci_trdy_reg_in || pci_devsel_reg_in) ;
405
 
406
// registered error status - calculated from registered target response inputs
407
assign rerror_out    = (~pci_stop_reg_in && pci_devsel_reg_in) ;
408
 
409
// retry is signalled to backend depending on registered target response or when latency timer expires
410
assign retry_out = timeout_termination || (~pci_stop_reg_in && ~pci_devsel_reg_in) ;
411
 
412
// AD output flip flops' clock enable
413
// new data is loaded to AD outputs whenever state machine is idle, bus was granted and bus is in idle state or
414
// when address phase is about to be finished
415 21 mihad
wire ad_load_slow = sm_address ;
416
wire ad_load_on_grant = sm_idle && pci_frame_in && pci_irdy_in ;
417 2 mihad
 
418 21 mihad
MAS_AD_LOAD_CRIT mas_ad_load_feed
419
(
420
    .ad_load_out         (ad_load_out),
421
    .ad_load_in          (ad_load_slow),
422
    .ad_load_on_grant_in (ad_load_on_grant),
423
    .pci_gnt_in          (pci_gnt_in)
424
);
425
 
426 2 mihad
// next data loading is allowed when state machine is in transfer state and operation is a write
427 21 mihad
assign ad_load_on_transfer_out = sm_data_phases && do_write ;
428 2 mihad
 
429
// request for a bus is issued anytime when backend is requesting a transaction and state machine is in idle state
430
assign pci_req_out = ~(req_in && sm_idle) ;
431
 
432
// change state signal is actually clock enable for state register
433
// Non critical path for state change enable:
434
// state is always changed when:
435
// - address phase is finishing
436
// - state machine is in turn arround state
437
// - state machine is in transfer state and master abort termination is in progress
438
 
439
wire ch_state_slow = sm_address || sm_turn_arround || sm_data_phases && ( pci_frame_out_in && mabort1 || mabort2 ) ;
440
 
441
// a bit more critical change state enable is calculated with GNT signal
442
wire ch_state_med  = ch_state_slow || sm_idle && u_have_pci_bus && req_in && rdy_in ;
443
 
444
// most critical change state enable - calculated from target response signals
445
MAS_CH_STATE_CRIT state_machine_ce
446
(
447
    .change_state_out   (change_state),
448
    .ch_state_med_in    (ch_state_med),
449
    .sm_data_phases_in  (sm_data_phases),
450
    .pci_trdy_in        (pci_trdy_in),
451
    .pci_stop_in        (pci_stop_in)
452
) ;
453
 
454
// ad enable driving
455
// also divided in several categories - from less critical to most critical in separate module
456 21 mihad
//wire ad_en_slowest  = do_write && (sm_address || sm_data_phases && ~pci_frame_out_in) ;
457
//wire ad_en_on_grant = sm_idle && pci_frame_in && pci_irdy_in || sm_turn_arround ;
458
//wire ad_en_slow     = ad_en_on_grant && ~pci_gnt_in || ad_en_slowest ;
459
//wire ad_en_keep     = sm_data_phases && do_write && (pci_frame_out_in && ~mabort1 && ~mabort2) ;
460 2 mihad
 
461 21 mihad
wire ad_en_slow     = do_write && ( sm_address || ( sm_data_phases && !( ( pci_frame_out_in && mabort1 ) || mabort2 ) ) ) ;
462
wire ad_en_on_grant = ( sm_idle && pci_frame_in && pci_irdy_in ) || sm_turn_arround ;
463
 
464
// critical timing ad enable - calculated from grant input
465 2 mihad
MAS_AD_EN_CRIT ad_iob_oe_feed
466
(
467
    .pci_ad_en_out      (pci_ad_en_out),
468
    .ad_en_slow_in      (ad_en_slow),
469 21 mihad
    .ad_en_on_grant_in  (ad_en_on_grant),
470
    .pci_gnt_in         (pci_gnt_in)
471 2 mihad
) ;
472
 
473
// cbe enable driving
474
wire cbe_en_on_grant = sm_idle && pci_frame_in && pci_irdy_in || sm_turn_arround ;
475
wire cbe_en_slow     = cbe_en_on_grant && ~pci_gnt_in || sm_address || sm_data_phases && ~pci_frame_out_in ;
476
wire cbe_en_keep     = sm_data_phases && pci_frame_out_in && ~mabort1 && ~mabort2 ;
477
 
478
// most critical cbe enable in separate module - calculated with most critical target inputs
479
CBE_EN_CRIT cbe_iob_feed
480
(
481
    .pci_cbe_en_out     (pci_cbe_en_out),
482
    .cbe_en_slow_in     (cbe_en_slow),
483
    .cbe_en_keep_in     (cbe_en_keep),
484
    .pci_stop_in        (pci_stop_in),
485
    .pci_trdy_in        (pci_trdy_in)
486
 
487
) ;
488
 
489
// IRDY enable is equal to FRAME enable delayed for one clock
490
assign pci_irdy_en_out   = pci_frame_en_in ;
491
 
492
// frame enable driving - sometimes it's calculated from non critical paths
493
wire frame_en_slow = (sm_idle && u_have_pci_bus && req_in && rdy_in) || sm_address || (sm_data_phases && ~pci_frame_out_in) ;
494
wire frame_en_keep = sm_data_phases && pci_frame_out_in && ~mabort1 && ~mabort2 ;
495
 
496
// most critical frame enable - calculated from heavily constrained target inputs in separate module
497
FRAME_EN_CRIT frame_iob_en_feed
498
(
499
    .pci_frame_en_out   (pci_frame_en_out),
500
    .frame_en_slow_in   (frame_en_slow),
501
    .frame_en_keep_in   (frame_en_keep),
502
    .pci_stop_in        (pci_stop_in),
503 21 mihad
    .pci_trdy_in        (pci_trdy_in)
504 2 mihad
) ;
505
 
506
// state machine next state definitions
507
always@(
508
    cur_state or
509
    do_write or
510
    pci_frame_out_in
511
)
512
begin
513
    // default values for state machine outputs
514
    wait_out                = 1'b1 ;
515
    wdata_selector          = SEL_ADDR_BC ;
516
    sm_idle                 = 1'b0 ;
517
    sm_address              = 1'b0 ;
518
    sm_data_phases          = 1'b0 ;
519
    sm_turn_arround         = 1'b0 ;
520
 
521
    case ( cur_state )
522
 
523
        S_IDLE: begin
524
                    // indicate the state
525
                    sm_idle      = 1'b1 ;
526
                    // assign next state - only possible is address - if state machine is supposed to stay in idle state
527
                    // outside signals disable the clock
528 21 mihad
                    next_state     = S_ADDRESS ;
529
                    wdata_selector = SEL_DATA_BE ;
530 2 mihad
                end
531
 
532
        S_ADDRESS:  begin
533
                        // indicate the state
534
                        sm_address  = 1'b1 ;
535
                        // select appropriate data/be for outputs
536 21 mihad
                        wdata_selector = SEL_NEXT_DATA_BE ;
537 2 mihad
                        // only possible next state is transfer state
538
                        next_state = S_TRANSFER ;
539
                    end
540
 
541
        S_TRANSFER: begin
542
                        // during transfers wait indicator is inactive - all status signals are now valid
543
                        wait_out               = 1'b0 ;
544
                        // indicate the state
545
                        sm_data_phases         = 1'b1 ;
546
                        // select appropriate data/be for outputs
547
                        wdata_selector = SEL_NEXT_DATA_BE ;
548
                        if ( pci_frame_out_in )
549
                        begin
550
                            // when frame is inactive next state will be turn arround
551
                            next_state = S_TA_END ;
552
                        end
553
                        else
554
                            // while frame is active state cannot be anything else then transfer
555
                            next_state = S_TRANSFER ;
556
                    end
557 21 mihad
 
558 2 mihad
        S_TA_END:   begin
559
                        // wait is still inactive because of registered statuses
560
                        wait_out = 1'b0 ;
561
                        // indicate the state
562
                        sm_turn_arround = 1'b1 ;
563
                        // next state is always idle
564
                        next_state = S_IDLE ;
565
                    end
566
        default:    next_state = S_IDLE ;
567
    endcase
568
end
569
 
570
// ad and cbe lines multiplexer for write data
571 21 mihad
reg [1:0] rdata_selector ;
572
always@(posedge clk_in or posedge reset_in)
573 2 mihad
begin
574 21 mihad
    if ( reset_in )
575
        rdata_selector <= #`FF_DELAY SEL_ADDR_BC ;
576
    else
577
    if ( change_state )
578
        rdata_selector <= #`FF_DELAY wdata_selector ;
579
end
580
 
581
always@(rdata_selector or address_in or bc_in or data_in or be_in or next_data_in or next_be_in)
582
begin
583
    case ( rdata_selector )
584 2 mihad
        SEL_ADDR_BC:    begin
585
                            pci_ad_out  = address_in ;
586
                            pci_cbe_out = bc_in ;
587
                        end
588
 
589
        SEL_DATA_BE:    begin
590
                            pci_ad_out  = data_in ;
591
                            pci_cbe_out = be_in ;
592
                        end
593
        SEL_NEXT_DATA_BE,
594
        2'b10:              begin
595
                                pci_ad_out  = next_data_in ;
596
                                pci_cbe_out = next_be_in ;
597
                            end
598
    endcase
599
end
600
 
601
// data output mux for reads
602
always@(mabort_out or pci_ad_reg_in)
603
begin
604
    if ( mabort_out )
605
        data_out = 32'hFFFF_FFFF ;
606
    else
607
        data_out = pci_ad_reg_in ;
608
end
609 21 mihad
endmodule

powered by: WebSVN 2.1.0

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