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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_7/] [rtl/] [verilog/] [pci_target32_interface.v] - Blame information for rev 21

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

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name: pci_target32_interface.v                         ////
4
////                                                              ////
5
////  This file is part of the "PCI bridge" project               ////
6
////  http://www.opencores.org/cores/pci/                         ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Tadej Markovic, tadej@opencores.org                   ////
10
////                                                              ////
11
////  All additional information is avaliable in the README.txt   ////
12
////  file.                                                       ////
13
////                                                              ////
14
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2000 Tadej Markovic, tadej@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 21 mihad
// Revision 1.2  2001/10/05 08:14:30  mihad
46
// Updated all files with inclusion of timescale file for simulation purposes.
47
//
48 6 mihad
// Revision 1.1.1.1  2001/10/02 15:33:47  mihad
49
// New project directory structure
50 2 mihad
//
51 6 mihad
//
52 2 mihad
 
53
`include "bus_commands.v"
54 21 mihad
`include "pci_constants.v"
55
 
56
// synopsys translate_off
57 6 mihad
`include "timescale.v"
58 21 mihad
// synopsys translate_on
59 2 mihad
 
60
module PCI_TARGET32_INTERFACE
61
(
62
    // system inputs
63
    clk_in,
64
    reset_in,
65 21 mihad
 
66 2 mihad
    // PCI Target side of INTERFACE
67
    address_in,
68
    addr_claim_out,
69
    bc_in,
70
    bc0_in,
71
    data_in,
72
    data_out,
73
    be_in,
74
    req_in,
75
    rdy_in,
76
    addr_phase_in,
77 21 mihad
    bckp_devsel_in,
78 2 mihad
    bckp_trdy_in,
79 21 mihad
    bckp_stop_in,
80 2 mihad
    last_reg_in,
81
    frame_reg_in,
82
    fetch_pcir_fifo_in,
83
    load_medium_reg_in,
84
    sel_fifo_mreg_in,
85
    sel_conf_fifo_in,
86
    fetch_conf_in,
87
    load_to_pciw_fifo_in,
88
    load_to_conf_in,
89
    same_read_out,
90
 
91
        norm_access_to_config_out,
92
        read_completed_out,
93
        read_processing_out,
94
        target_abort_out,
95
        disconect_wo_data_out,
96 21 mihad
        disconect_w_data_out,
97 2 mihad
        pciw_fifo_full_out,
98
        pcir_fifo_data_err_out,
99
        wbw_fifo_empty_out,
100 21 mihad
        wbu_del_read_comp_pending_out,
101
 
102 2 mihad
        // Delayed synchronizacion module signals
103 21 mihad
        req_out,
104
    done_out,
105 2 mihad
    in_progress_out,
106 21 mihad
        req_req_pending_in,
107 2 mihad
    req_comp_pending_in,
108 21 mihad
        addr_out,
109
    be_out,
110
    we_out,
111
    bc_out,
112
    burst_ok_out,
113 2 mihad
        strd_addr_in,
114
        strd_bc_in,
115
    status_in,
116
    comp_flush_in,
117
 
118
        // FIFO signals
119 21 mihad
        pcir_fifo_renable_out,
120
        pcir_fifo_data_in,
121
        pcir_fifo_be_in,
122 2 mihad
        pcir_fifo_control_in,
123 21 mihad
        pcir_fifo_flush_out,
124
        pcir_fifo_almost_empty_in,
125 2 mihad
        pcir_fifo_empty_in,
126 21 mihad
        pciw_fifo_wenable_out,
127
        pciw_fifo_addr_data_out,
128
        pciw_fifo_cbe_out,
129
        pciw_fifo_control_out,
130
        pciw_fifo_two_left_in,
131 2 mihad
        pciw_fifo_almost_full_in,
132
        pciw_fifo_full_in,
133
        wbw_fifo_empty_in,
134 21 mihad
        wbu_del_read_comp_pending_in,
135
 
136 2 mihad
        // Configuration space signals
137
        conf_hit_out,
138
        conf_addr_out,
139
        conf_data_out,
140
        conf_data_in,
141
        conf_be_out,
142
        conf_we_out,
143
        conf_re_out,
144
        mem_enable_in,
145
        io_enable_in,
146
        mem_io_addr_space0_in,
147
        mem_io_addr_space1_in,
148
        mem_io_addr_space2_in,
149
        mem_io_addr_space3_in,
150
        mem_io_addr_space4_in,
151
        mem_io_addr_space5_in,
152
        pre_fetch_en0_in,
153
        pre_fetch_en1_in,
154
        pre_fetch_en2_in,
155
        pre_fetch_en3_in,
156
        pre_fetch_en4_in,
157
        pre_fetch_en5_in,
158
        pci_base_addr0_in,
159
        pci_base_addr1_in,
160
        pci_base_addr2_in,
161
        pci_base_addr3_in,
162
        pci_base_addr4_in,
163
        pci_base_addr5_in,
164
        pci_addr_mask0_in,
165
        pci_addr_mask1_in,
166
        pci_addr_mask2_in,
167
        pci_addr_mask3_in,
168
        pci_addr_mask4_in,
169
        pci_addr_mask5_in,
170
        pci_tran_addr0_in,
171
        pci_tran_addr1_in,
172
        pci_tran_addr2_in,
173
        pci_tran_addr3_in,
174
        pci_tran_addr4_in,
175
        pci_tran_addr5_in,
176
        addr_tran_en0_in,
177
        addr_tran_en1_in,
178
        addr_tran_en2_in,
179
        addr_tran_en3_in,
180
        addr_tran_en4_in,
181
        addr_tran_en5_in
182
) ;
183
 
184
/*==================================================================================================================
185
System inputs.
186
==================================================================================================================*/
187
// PCI side clock and reset
188
input   clk_in,
189
        reset_in ;
190
 
191
 
192
/*==================================================================================================================
193 21 mihad
Side of the PCI Target state machine
194 2 mihad
==================================================================================================================*/
195
// Data, byte enables, bus commands and address ports
196
input   [31:0]   address_in ;            // current request address input - registered
197
output          addr_claim_out ;        // current request address claim output
198
input   [3:0]   bc_in ;                          // current request bus command input - registered
199
input                   bc0_in ;                        // current cycle RW signal
200
output  [31:0]  data_out ;                       // for read operations - current dataphase data output
201
input   [31:0]  data_in ;                        // for write operations - current request data input - registered
202
input   [3:0]    be_in ;                         // current dataphase byte enable inputs - registered
203
// Port connection control signals from PCI FSM
204
input           req_in ;                // Read is requested to WB master from PCI side
205
input           rdy_in ;                // DATA / ADDRESS selection from PCI side when read or write - registered
206
input                   addr_phase_in ;         // Indicates address phase and also fast-back-to-back address phase - registered
207 21 mihad
input                   bckp_devsel_in ;        // DEVSEL input (which is registered) equivalent
208
input                   bckp_trdy_in ;          // TRDY input (which is registered) equivalent
209
input                   bckp_stop_in ;          // STOP input (which is registered) equivalent
210 2 mihad
input               last_reg_in ;               // Indicates last data phase - registered
211
input                   frame_reg_in ;          // FRAME input signal - registered
212
input               fetch_pcir_fifo_in ;// Read enable for PCIR_FIFO when when read is finishen on WB side
213
input               load_medium_reg_in ;// Load data from PCIR_FIFO to medium register (first data must be prepared on time)
214
input               sel_fifo_mreg_in ;  // Read data selection between PCIR_FIFO and medium register
215
input               sel_conf_fifo_in ;  // Read data selection between Configuration registers and "FIFO"
216
input               fetch_conf_in ;             // Read enable for configuration space registers
217
input               load_to_pciw_fifo_in ;// Write enable to PCIW_FIFO
218
input               load_to_conf_in ;   // Write enable to Configuration space registers
219
 
220
 
221
/*==================================================================================================================
222
Status outputs to PCI side (FSM)
223
==================================================================================================================*/
224
output                  same_read_out ;                         // Indicates the same read request (important when read is finished on WB side)
225
output                  norm_access_to_config_out ;     // Indicates the access to Configuration space with MEMORY commands
226
output                  read_completed_out ;            // Indicates that read request is completed on WB side
227
output                  read_processing_out ;           // Indicates that read request is processing on WB side
228
output                  target_abort_out ;                      // Indicates target abort termination
229 21 mihad
output                  disconect_wo_data_out ;         // Indicates disconnect without data termination
230
output                  disconect_w_data_out ;          // Indicates disconnect with data termination
231 2 mihad
output                  pciw_fifo_full_out ;            // Indicates that write PCIW_FIFO is full
232
output                  pcir_fifo_data_err_out ;        // Indicates data error on current data read from PCIR_FIFO
233
output                  wbw_fifo_empty_out ;            // Indicates that WB SLAVE has no data to be written to PCI bus
234 21 mihad
output                  wbu_del_read_comp_pending_out ; // Indicates that WB Unit has a delayed read poending!
235 2 mihad
 
236
/*==================================================================================================================
237
Read request interface through Delayed sinchronization module to WB Master
238
==================================================================================================================*/
239
// request, completion, done and progress indicator outputs for delayed_sync module where they are synchronized
240
output                  req_out,                // request qualifier - when 1 it indicates that valid data is provided on outputs
241
                        done_out,               // done output - when 1 indicates that PCI Target has completed a cycle on its bus
242 21 mihad
                        in_progress_out ;       // out progress indicator - indicates that current completion is in progress on
243 2 mihad
                                                                        //   PCI Target side
244
// pending indication inputs - PCI Target side must know about requests and completions
245
input                   req_req_pending_in ;    // request pending input for PCI Target side
246
input                   req_comp_pending_in ;   // completion pending input for PCI Target side - it indicates when completion
247
                                                                                //   is ready for completing on PCI Target bus
248
// various data outputs - PCI Target sets address, bus command, byte enables, write enable and burst
249
output  [31:0]   addr_out ;   // address bus output
250
output  [3:0]    be_out ;     // byte enable output
251
output          we_out ;     // write enable output - read/write request indication 1 = write request / 0 = read request
252
output  [3:0]    bc_out ;     // bus command output
253 21 mihad
output                  burst_ok_out ;  // pre-fetch enable & burst read - qualifies pre-fetch for access to current image space
254 2 mihad
 
255
// completion side signals encoded termination status - 0 = normal completion / 1 = error terminated completion
256
input   [31:0]   strd_addr_in ;  // Stored requested read access address
257
input   [3:0]    strd_bc_in ;    // Stored requested read access bus command
258
input                   status_in ;     // Error status reported - NOT USED because FIFO control bits determin data error status
259
input               comp_flush_in ;     // If completition counter (2^16 clk periods) has expired, PCIR_FIFO must flush data
260
 
261
 
262
/*==================================================================================================================
263
PCIR_PCIW_FIFO signals from pci side
264
==================================================================================================================*/
265 21 mihad
// PCIR_FIFO control signals used for fetching data from PCIR_FIFO
266 2 mihad
output                  pcir_fifo_renable_out ;                 // read enable output to PCIR_FIFO
267
input   [31:0]   pcir_fifo_data_in ;                             // data input from PCIR_FIFO
268
input   [3:0]    pcir_fifo_be_in ;                               // byte enable input from PCIR_FIFO
269
input   [3:0]    pcir_fifo_control_in ;                  // control signals input from PCIR_FIFO
270
output                  pcir_fifo_flush_out ;                   // flush PCIR_FIFO
271
input                   pcir_fifo_almost_empty_in ;             // almost empty indicator from PCIR_FIFO
272
input                   pcir_fifo_empty_in ;                    // empty indicator
273
 
274
// PCIW_FIFO control signals used for sinking data into PCIW_FIFO and status monitoring
275
output                  pciw_fifo_wenable_out ;         // write enable output to PCIW_FIFO
276
output  [31:0]   pciw_fifo_addr_data_out ;       // address / data output signals to PCIW_FIFO
277
output  [3:0]    pciw_fifo_cbe_out ;                     // command / byte enable signals to PCIW_FIFO
278
output  [3:0]    pciw_fifo_control_out ;         // control signals to PCIW_FIFO
279 21 mihad
input                   pciw_fifo_two_left_in ;         // two data spaces left in PCIW_FIFO
280 2 mihad
input                   pciw_fifo_almost_full_in ;      // almost full indicator from PCIW_FIFO
281
input                   pciw_fifo_full_in ;                     // full indicator from PCIW_FIFO
282
 
283
// WBW_FIFO empy control signal used when delayed read is complete in PCIR_FIFO
284
input                   wbw_fifo_empty_in ;                     // empty indicator from WBW_FIFO
285 21 mihad
input                   wbu_del_read_comp_pending_in ; // delayed read pending indicator from WB Unit
286 2 mihad
 
287
 
288
/*==================================================================================================================
289
Configuration space signals - from and to registers
290
==================================================================================================================*/
291
// BUS for reading and writing to configuration space registers
292
output                  conf_hit_out ;  // like "chip select" for configuration space
293
output  [11:0]   conf_addr_out ; // address to configuration space when there is access to it
294
output  [31:0]   conf_data_out ; // data to configuration space - for writing to registers
295
input   [31:0]   conf_data_in ;  // data from configuration space - for reading from registers
296
output  [3:0]    conf_be_out ;   // byte enables used for correct writing to configuration space
297
output                  conf_we_out ;   // write enable control signal - 1 for writing / 0 for nothing
298
output                  conf_re_out ;   // read enable control signal - 1 for reading / 0 for nothing
299
 
300
// Inputs for image control registers
301
input                   mem_enable_in ; // allowed access to memory mapped image
302
input                   io_enable_in ;  // allowed access to io mapped image
303
 
304
// Inputs needed for determining if image is assigned to memory or io space with pre-fetch and address translation
305 21 mihad
input                   mem_io_addr_space0_in ; // bit-0 in pci_base_addr0 register
306
input                   mem_io_addr_space1_in ; // bit-0 in pci_base_addr1 register
307
input                   mem_io_addr_space2_in ; // bit-0 in pci_base_addr2 register
308
input                   mem_io_addr_space3_in ; // bit-0 in pci_base_addr3 register
309
input                   mem_io_addr_space4_in ; // bit-0 in pci_base_addr4 register
310 2 mihad
input                   mem_io_addr_space5_in ; // bit-0 in pci_base_addr5 register
311
input                   pre_fetch_en0_in ;      // bit-1 in pci_image_ctr0 register
312
input                   pre_fetch_en1_in ;      // bit-1 in pci_image_ctr1 register
313
input                   pre_fetch_en2_in ;      // bit-1 in pci_image_ctr2 register
314
input                   pre_fetch_en3_in ;      // bit-1 in pci_image_ctr3 register
315
input                   pre_fetch_en4_in ;      // bit-1 in pci_image_ctr4 register
316
input                   pre_fetch_en5_in ;      // bit-1 in pci_image_ctr5 register
317
 
318
// Input from image registers - register values needed for decoder to work properly
319
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr0_in ;     // base address from base address register
320
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr1_in ; // base address from base address register
321
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr2_in ; // base address from base address register
322
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr3_in ; // base address from base address register
323
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr4_in ; // base address from base address register
324
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_base_addr5_in ; // base address from base address register
325
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask0_in ; // masking of base address from address mask register
326
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask1_in ; // masking of base address from address mask register
327
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask2_in ; // masking of base address from address mask register
328
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask3_in ; // masking of base address from address mask register
329
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask4_in ; // masking of base address from address mask register
330
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_addr_mask5_in ; // masking of base address from address mask register
331
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr0_in ; // translation address from address translation register
332
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr1_in ; // translation address from address translation register
333
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr2_in ; // translation address from address translation register
334
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr3_in ; // translation address from address translation register
335
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr4_in ; // translation address from address translation register
336
input   [31:(32-`PCI_NUM_OF_DEC_ADDR_LINES)]    pci_tran_addr5_in ; // translation address from address translation register
337
 
338
input                   addr_tran_en0_in ;      // address translation enable bit
339
input                   addr_tran_en1_in ;      // address translation enable bit
340
input                   addr_tran_en2_in ;      // address translation enable bit
341
input                   addr_tran_en3_in ;      // address translation enable bit
342
input                   addr_tran_en4_in ;      // address translation enable bit
343
input                   addr_tran_en5_in ;      // address translation enable bit
344
 
345
/*==================================================================================================================
346
END of input / output PORT DEFINITONS !!!
347
==================================================================================================================*/
348
 
349
// address output from address multiplexer
350
reg             [31:0]   address ;
351
// prefetch enable for access to selected image space
352
reg                             pre_fetch_en ;
353
 
354
// Input addresses and image hits from address decoders - addresses are multiplexed to address
355 21 mihad
`ifdef                  HOST
356
        `ifdef          NO_CNF_IMAGE
357
                `ifdef  PCI_IMAGE0      // if PCI bridge is HOST and IMAGE0 is assigned as general image space
358 2 mihad
wire                    hit0_in ;
359
wire    [31:0]   address0_in ;
360 21 mihad
wire                    pre_fetch_en0 = pre_fetch_en0_in ;
361
                `else
362
wire                    hit0_in         = 1'b0 ;
363
wire    [31:0]   address0_in     = 32'h0 ;
364
wire                    pre_fetch_en0 = 1'b0 ;
365
                `endif
366
        `else
367
wire                    hit0_in ;
368
wire    [31:0]   address0_in ;
369
wire                    pre_fetch_en0 = pre_fetch_en0_in ;
370
        `endif
371
`else // GUEST
372
wire                    hit0_in ;
373
wire    [31:0]   address0_in ;
374
wire                    pre_fetch_en0 = pre_fetch_en0_in ;
375
`endif
376
 
377 2 mihad
wire                    hit1_in ;
378
wire    [31:0]   address1_in ;
379 21 mihad
wire                    pre_fetch_en1 = pre_fetch_en1_in ;
380
 
381
`ifdef          PCI_IMAGE2
382 2 mihad
wire                    hit2_in ;
383
wire    [31:0]   address2_in ;
384 21 mihad
wire                    pre_fetch_en2 = pre_fetch_en2_in ;
385
`else
386
wire                    hit2_in         = 1'b0 ;
387
wire    [31:0]   address2_in     = 32'h0 ;
388
wire                    pre_fetch_en2 = 1'b0 ;
389 2 mihad
`endif
390 21 mihad
 
391 2 mihad
`ifdef          PCI_IMAGE3
392
wire                    hit3_in ;
393
wire    [31:0]   address3_in ;
394 21 mihad
wire                    pre_fetch_en3 = pre_fetch_en3_in ;
395
`else
396
wire                    hit3_in         = 1'b0 ;
397
wire    [31:0]   address3_in     = 32'h0 ;
398
wire                    pre_fetch_en3 = 1'b0 ;
399 2 mihad
`endif
400 21 mihad
 
401 2 mihad
`ifdef          PCI_IMAGE4
402
wire                    hit4_in ;
403
wire    [31:0]   address4_in ;
404 21 mihad
wire                    pre_fetch_en4 = pre_fetch_en4_in ;
405
`else
406
wire                    hit4_in         = 1'b0 ;
407
wire    [31:0]   address4_in     = 32'h0 ;
408
wire                    pre_fetch_en4 = 1'b0 ;
409 2 mihad
`endif
410 21 mihad
 
411 2 mihad
`ifdef          PCI_IMAGE5
412
wire                    hit5_in ;
413
wire    [31:0]   address5_in ;
414 21 mihad
wire                    pre_fetch_en5 = pre_fetch_en5_in ;
415
`else
416
wire                    hit5_in         = 1'b0 ;
417
wire    [31:0]   address5_in     = 32'h0 ;
418
wire                    pre_fetch_en5 = 1'b0 ;
419 2 mihad
`endif
420
 
421
// Include address decoders
422 21 mihad
`ifdef                  HOST
423
        `ifdef          NO_CNF_IMAGE
424
                `ifdef  PCI_IMAGE0      // if PCI bridge is HOST and IMAGE0 is assigned as general image space
425
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder0
426
                                   (.hit                        (hit0_in),
427
                                        .addr_out               (address0_in),
428
                                        .addr_in                (address_in),
429
                                        .bc_in                  (bc_in),
430 2 mihad
                                        .base_addr              (pci_base_addr0_in),
431 21 mihad
                                        .mask_addr              (pci_addr_mask0_in),
432
                                        .tran_addr              (pci_tran_addr0_in),
433 2 mihad
                                        .at_en                  (addr_tran_en0_in),
434 21 mihad
                                        .mem_io_space   (mem_io_addr_space0_in),
435
                                        .mem_en                 (mem_enable_in),
436 2 mihad
                                        .io_en                  (io_enable_in)
437
                                        ) ;
438 21 mihad
                `endif
439
        `else
440
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder0
441
                                   (.hit                        (hit0_in),
442
                                        .addr_out               (address0_in),
443
                                        .addr_in                (address_in),
444
                                        .bc_in                  (bc_in),
445
                                        .base_addr              (pci_base_addr0_in),
446
                                        .mask_addr              (pci_addr_mask0_in),
447
                                        .tran_addr              (pci_tran_addr0_in),
448
                                        .at_en                  (addr_tran_en0_in),
449
                                        .mem_io_space   (mem_io_addr_space0_in),
450
                                        .mem_en                 (mem_enable_in),
451
                                        .io_en                  (io_enable_in)
452
                                        ) ;
453
        `endif
454
`else // GUEST
455
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder0
456
                                   (.hit                        (hit0_in),
457
                                        .addr_out               (address0_in),
458
                                        .addr_in                (address_in),
459
                                        .bc_in                  (bc_in),
460
                                        .base_addr              (pci_base_addr0_in),
461
                                        .mask_addr              (pci_addr_mask0_in),
462
                                        .tran_addr              (pci_tran_addr0_in),
463
                                        .at_en                  (addr_tran_en0_in),
464
                                        .mem_io_space   (mem_io_addr_space0_in),
465
                                        .mem_en                 (mem_enable_in),
466
                                        .io_en                  (io_enable_in)
467
                                        ) ;
468
`endif
469
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder1
470
                                   (.hit                        (hit1_in),
471
                                        .addr_out               (address1_in),
472
                                        .addr_in                (address_in),
473
                                        .bc_in                  (bc_in),
474 2 mihad
                                        .base_addr              (pci_base_addr1_in),
475 21 mihad
                                        .mask_addr              (pci_addr_mask1_in),
476
                                        .tran_addr              (pci_tran_addr1_in),
477
                                        .at_en                  (addr_tran_en1_in),
478
                                        .mem_io_space   (mem_io_addr_space1_in),
479
                                        .mem_en                 (mem_enable_in),
480 2 mihad
                                        .io_en                  (io_enable_in)
481
                                        ) ;
482 21 mihad
`ifdef          PCI_IMAGE2
483 2 mihad
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder2
484 21 mihad
                                   (.hit                        (hit2_in),
485
                                        .addr_out               (address2_in),
486
                                        .addr_in                (address_in),
487
                                        .bc_in                  (bc_in),
488 2 mihad
                                        .base_addr              (pci_base_addr2_in),
489 21 mihad
                                        .mask_addr              (pci_addr_mask2_in),
490
                                        .tran_addr              (pci_tran_addr2_in),
491
                                        .at_en                  (addr_tran_en2_in),
492
                                        .mem_io_space   (mem_io_addr_space2_in),
493
                                        .mem_en                 (mem_enable_in),
494 2 mihad
                                        .io_en                  (io_enable_in)
495
                                        ) ;
496
`endif
497
`ifdef          PCI_IMAGE3
498 21 mihad
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder3
499
                                   (.hit                        (hit3_in),
500
                                        .addr_out               (address3_in),
501
                                        .addr_in                (address_in),
502
                                        .bc_in                  (bc_in),
503 2 mihad
                                        .base_addr              (pci_base_addr3_in),
504 21 mihad
                                        .mask_addr              (pci_addr_mask3_in),
505
                                        .tran_addr              (pci_tran_addr3_in),
506
                                        .at_en                  (addr_tran_en3_in),
507
                                        .mem_io_space   (mem_io_addr_space3_in),
508
                                        .mem_en                 (mem_enable_in),
509 2 mihad
                                        .io_en                  (io_enable_in)
510
                                        ) ;
511
`endif
512
`ifdef          PCI_IMAGE4
513 21 mihad
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder4
514
                                   (.hit                        (hit4_in),
515
                                        .addr_out               (address4_in),
516
                                        .addr_in                (address_in),
517
                                        .bc_in                  (bc_in),
518 2 mihad
                                        .base_addr              (pci_base_addr4_in),
519 21 mihad
                                        .mask_addr              (pci_addr_mask4_in),
520
                                        .tran_addr              (pci_tran_addr4_in),
521
                                        .at_en                  (addr_tran_en4_in),
522
                                        .mem_io_space   (mem_io_addr_space4_in),
523
                                        .mem_en                 (mem_enable_in),
524 2 mihad
                                        .io_en                  (io_enable_in)
525
                                        ) ;
526
`endif
527
`ifdef          PCI_IMAGE5
528 21 mihad
        PCI_DECODER   #(`PCI_NUM_OF_DEC_ADDR_LINES) decoder5
529
                                   (.hit                        (hit5_in),
530
                                        .addr_out               (address5_in),
531
                                        .addr_in                (address_in),
532
                                        .bc_in                  (bc_in),
533 2 mihad
                                        .base_addr              (pci_base_addr5_in),
534 21 mihad
                                        .mask_addr              (pci_addr_mask5_in),
535
                                        .tran_addr              (pci_tran_addr5_in),
536
                                        .at_en                  (addr_tran_en5_in),
537
                                        .mem_io_space   (mem_io_addr_space5_in),
538
                                        .mem_en                 (mem_enable_in),
539 2 mihad
                                        .io_en                  (io_enable_in)
540
                                        ) ;
541
`endif
542
 
543
// Internal signals for image hit determination
544
reg                             addr_claim ;// address claim signal is asinchronous set for addr_claim_out signal to PCI Target SM
545
 
546
// Determining if image 0 is assigned to configuration space or as normal pci to wb access!
547
//   if normal access is allowed to configuration space, then hit0 is hit0_conf
548
`ifdef          HOST
549 21 mihad
        `ifdef  NO_CNF_IMAGE
550
                        parameter       hit0_conf = 1'b0 ;
551 2 mihad
        `else
552 21 mihad
                        parameter       hit0_conf = 1'b1 ;      // if normal access is allowed to configuration space, then hit0 is hit0_conf
553 2 mihad
        `endif
554 21 mihad
`else // GUEST
555
                        parameter       hit0_conf = 1'b1 ;      // if normal access is allowed to configuration space, then hit0 is hit0_conf
556 2 mihad
`endif
557
 
558
// Logic with address mux, determining if address is still in the same image space and if it is prefetced or not
559 21 mihad
always@(hit5_in or     hit4_in or     hit3_in or     hit2_in or     hit1_in or     hit0_in or
560
                address5_in or address4_in or address3_in or address2_in or address1_in or address0_in or
561
                pre_fetch_en5 or
562
                pre_fetch_en4 or
563
                pre_fetch_en3 or
564
                pre_fetch_en2 or
565
                pre_fetch_en1 or
566
                pre_fetch_en0
567
                )
568
begin
569
        addr_claim <= (hit5_in || hit4_in) || (hit3_in || hit2_in || hit1_in || hit0_in) ;
570
        case ({hit5_in, hit4_in, hit3_in, hit2_in, hit0_in})
571
        5'b10000 :
572 2 mihad
        begin
573 21 mihad
                address <= address5_in ;
574
                pre_fetch_en <= pre_fetch_en5 ;
575 2 mihad
        end
576 21 mihad
        5'b01000 :
577
        begin
578
                address <= address4_in ;
579
                pre_fetch_en <= pre_fetch_en4 ;
580
        end
581
        5'b00100 :
582
        begin
583
                address <= address3_in ;
584
                pre_fetch_en <= pre_fetch_en3 ;
585
        end
586
        5'b00010 :
587
        begin
588
                address <= address2_in ;
589
                pre_fetch_en <= pre_fetch_en2 ;
590
        end
591
        5'b00001 :
592
        begin
593
                address <= address0_in ;
594
                pre_fetch_en <= pre_fetch_en0 ;
595
        end
596
        default : // IMAGE 1 is always included into PCI bridge
597
        begin
598
                address <= address1_in ;
599
                pre_fetch_en <= pre_fetch_en1 ;
600
        end
601
        endcase
602
end
603 2 mihad
 
604
// Address claim output to PCI Target SM
605
assign  addr_claim_out = addr_claim ;
606
 
607
reg             [31:0]   norm_address ;          // stored normal address (decoded and translated) for access to WB
608
reg                             norm_prf_en ;           // stored pre-fetch enable
609
reg             [3:0]    norm_bc ;                       // stored bus-command
610
reg                             same_read_reg ;         // stored SAME_READ information
611 21 mihad
reg                             target_rd ;             // delayed registered TRDY output equivalent signal
612 2 mihad
 
613
always@(posedge clk_in or posedge reset_in)
614
begin
615 21 mihad
    if (reset_in)
616 2 mihad
        begin
617 21 mihad
                norm_address <= #`FF_DELAY 32'h0000_0000 ;
618
                norm_prf_en <= #`FF_DELAY 1'b0 ;
619
                norm_bc <= #`FF_DELAY 4'h0 ;
620
                same_read_reg <= #`FF_DELAY 1'b0 ;
621 2 mihad
        end
622
        else
623
        begin
624
                if (addr_phase_in)
625
                begin
626 21 mihad
                        norm_address <= #`FF_DELAY address ;
627
                        norm_prf_en <= #`FF_DELAY pre_fetch_en ;
628
                        norm_bc <= #`FF_DELAY bc_in ;
629
                        same_read_reg <= #`FF_DELAY same_read_out ;
630 2 mihad
                end
631
        end
632
end
633 21 mihad
 
634
`ifdef          HOST
635
  `ifdef        NO_CNF_IMAGE
636
                        reg              [1:0]   strd_address ;          // stored INPUT address for accessing Configuration space registers
637
  `else
638
                        reg             [11:0]   strd_address ;          // stored INPUT address for accessing Configuration space registers
639
  `endif
640
`else
641
                        reg             [11:0]   strd_address ;          // stored INPUT address for accessing Configuration space registers
642
`endif
643 2 mihad
always@(posedge clk_in or posedge reset_in)
644
begin
645 21 mihad
    if (reset_in)
646 2 mihad
        begin
647 21 mihad
                strd_address <= #`FF_DELAY 0 ;
648 2 mihad
        end
649
        else
650
        begin
651 21 mihad
                if (addr_phase_in)
652
                begin
653
`ifdef          HOST
654
  `ifdef        NO_CNF_IMAGE
655
                        strd_address <= #`FF_DELAY address_in[1:0] ;
656
  `else
657
                        strd_address <= #`FF_DELAY address_in[11:0] ;
658
  `endif
659
`else
660
                        strd_address <= #`FF_DELAY address_in[11:0] ;
661
`endif
662
                end
663 2 mihad
        end
664
end
665
 
666 21 mihad
always@(posedge clk_in or posedge reset_in)
667
begin
668
    if (reset_in)
669
        begin
670
                target_rd               <= #`FF_DELAY 1'b0 ;
671
        end
672
        else
673
        begin
674
                if (same_read_reg && !bckp_trdy_in)
675
                        target_rd       <= #`FF_DELAY 1'b1 ;// Signal indicates when target ready is deaserted on PCI bus
676
                else if (same_read_reg && bckp_devsel_in && !bckp_stop_in)
677
                        target_rd       <= #`FF_DELAY 1'b1 ;// Signal indicates when target ready is deaserted on PCI bus
678
                else if (!same_read_reg)
679
                        target_rd       <= #`FF_DELAY 1'b0 ;// Signal indicates when target ready is deaserted on PCI bus
680
        end
681
end
682
// '1' indicates asserted TRDY signal when same read operation is performed
683
wire    target_rd_completed     = target_rd ;
684
 
685 2 mihad
reg                             same_read_request ;
686
 
687 21 mihad
// When delayed read is completed on WB, addres and bc must be compered, if there is the same read request
688 2 mihad
always@(address or strd_addr_in or bc_in or strd_bc_in)
689
begin
690
        if ((address == strd_addr_in) & (bc_in == strd_bc_in))
691
                same_read_request <= 1'b1 ;
692
        else
693
                same_read_request <= 1'b0 ;
694
end
695
 
696
assign  same_read_out = (same_read_request) ; // && ~pcir_fifo_empty_in) ;
697
 
698
// Signals for byte enable checking
699
reg                             addr_burst_ok ;
700
reg                             io_be_ok ;
701
reg                             conf_be_ok ;
702
 
703
// Byte enable checking for IO, MEMORY and CONFIGURATION spaces - be_in is active low!
704
always@(strd_address or be_in)
705
begin
706
        case (strd_address[1:0])
707
        2'b11 :
708
        begin
709
                addr_burst_ok <= 1'b0 ;
710
                io_be_ok <= (be_in[2] && be_in[1] && be_in[0]) ; // only be3 can be active
711
                conf_be_ok <= 1'b0 ;
712
        end
713
        2'b10 :
714
        begin
715
                addr_burst_ok <= 1'b0 ;
716
                io_be_ok <= (~be_in[2] && be_in[1] && be_in[0]) || (be_in[3] && be_in[2] && be_in[1] && be_in[0]) ;
717
                conf_be_ok <= 1'b0 ;
718
        end
719
        2'b01 :
720
        begin
721
                addr_burst_ok <= 1'b0 ;
722
                io_be_ok <= (~be_in[1] && be_in[0]) || (be_in[3] && be_in[2] && be_in[1] && be_in[0]) ;
723
                conf_be_ok <= 1'b0 ;
724
        end
725
        default :       // 2'b00
726
        begin
727
                addr_burst_ok <= 1'b1 ;
728
                io_be_ok <= (~be_in[0]) || (be_in[3] && be_in[2] && be_in[1] && be_in[0]) ;
729
                conf_be_ok <= 1'b1 ;
730
        end
731
        endcase
732
end
733
 
734
reg                             calc_target_abort ;
735
// Target abort indication regarding the registered bus command and current signals for byte enable checking
736 21 mihad
always@(norm_bc or hit0_in or io_be_ok or conf_be_ok)
737 2 mihad
begin
738 21 mihad
        case (norm_bc)
739
        // READ COMMANDS
740 2 mihad
        `BC_IO_READ :
741
        begin
742
                case ({hit0_in, hit0_conf})
743 21 mihad
`ifdef          HOST
744
        `ifdef  NO_CNF_IMAGE
745
        `else
746 2 mihad
                2'b11 :
747
                begin
748
                        calc_target_abort <= 1'b1 ;
749
                end
750 21 mihad
        `endif
751
`else
752
                2'b11 :
753
                begin
754
                        calc_target_abort <= 1'b1 ;
755
                end
756
`endif
757 2 mihad
                default :
758
                begin
759
                        if (io_be_ok)
760
                        begin
761
                                calc_target_abort <= 1'b0 ;
762
                        end
763
                        else
764
                        begin
765
                                calc_target_abort <= 1'b1 ;
766
                        end
767
                end
768
                endcase
769
        end
770
        `BC_MEM_READ :
771
        begin
772 21 mihad
                calc_target_abort <= 1'b0 ;
773 2 mihad
        end
774
        `BC_CONF_READ :
775
        begin
776
                case (conf_be_ok)
777
                1'b1 :
778
                begin
779
                        calc_target_abort <= 1'b0 ;
780
                end
781
                default :
782
                begin
783
                        calc_target_abort <= 1'b1 ;
784
                end
785
                endcase
786
        end
787
        `BC_MEM_READ_LN,
788
        `BC_MEM_READ_MUL :
789
        begin
790
                case ({hit0_in, hit0_conf})
791 21 mihad
`ifdef          HOST
792
        `ifdef  NO_CNF_IMAGE
793
        `else
794 2 mihad
                2'b11 :
795
                begin
796
                        calc_target_abort <= 1'b1 ;
797
                end
798 21 mihad
        `endif
799
`else
800
                2'b11 :
801
                begin
802
                        calc_target_abort <= 1'b1 ;
803
                end
804
`endif
805 2 mihad
                default :
806
                begin
807
                        calc_target_abort <= 1'b0 ;
808
                end
809
                endcase
810
        end
811 21 mihad
        // WRITE COMMANDS
812 2 mihad
        `BC_IO_WRITE :
813
        begin
814
                case ({hit0_in, hit0_conf})
815 21 mihad
`ifdef          HOST
816
        `ifdef  NO_CNF_IMAGE
817
        `else
818 2 mihad
                2'b11 :
819
                begin
820
                        calc_target_abort <= 1'b1 ;
821
                end
822 21 mihad
        `endif
823
`else
824
                2'b11 :
825
                begin
826
                        calc_target_abort <= 1'b1 ;
827
                end
828
`endif
829 2 mihad
                default :
830
                begin
831
                        if (io_be_ok)
832
                        begin
833
                                calc_target_abort <= 1'b0 ;
834
                        end
835
                        else
836
                        begin
837
                                calc_target_abort <= 1'b1 ;
838
                        end
839
                end
840
                endcase
841
        end
842
        `BC_MEM_WRITE :
843
        begin
844 21 mihad
                calc_target_abort <= 1'b0 ;
845 2 mihad
        end
846
        `BC_CONF_WRITE :
847
        begin
848
                case (conf_be_ok)
849
                1'b1 :
850
                begin
851
                        calc_target_abort <= 1'b0 ;
852
                end
853
                default :
854
                begin
855
                        calc_target_abort <= 1'b1 ;
856
                end
857
                endcase
858
        end
859
        `BC_MEM_WRITE_INVAL :
860
        begin
861
                case ({hit0_in, hit0_conf})
862 21 mihad
`ifdef          HOST
863
        `ifdef  NO_CNF_IMAGE
864
        `else
865 2 mihad
                2'b11 :
866
                begin
867
                        calc_target_abort <= 1'b1 ;
868
                end
869 21 mihad
        `endif
870
`else
871
                2'b11 :
872
                begin
873
                        calc_target_abort <= 1'b1 ;
874
                end
875
`endif
876 2 mihad
                default :
877
                begin
878
                        calc_target_abort <= 1'b0 ;
879
                end
880
                endcase
881
        end
882
        default :
883
        begin
884
                calc_target_abort <= 1'b0 ;
885
        end
886
        endcase
887
end
888
 
889 21 mihad
wire [3:0]       pcir_fifo_control_input = pcir_fifo_empty_in ? 4'h0 : pcir_fifo_control_in ;
890
 
891 2 mihad
// Medium registers for data and control busses from PCIR_FIFO
892
reg             [31:0]   pcir_fifo_data_reg ;
893
reg             [3:0]    pcir_fifo_ctrl_reg ;
894
 
895
always@(posedge clk_in or posedge reset_in)
896
begin
897 21 mihad
    if (reset_in)
898 2 mihad
    begin
899 21 mihad
        pcir_fifo_data_reg <= #`FF_DELAY 32'h0000_0000 ;
900
        pcir_fifo_ctrl_reg <=  #`FF_DELAY 4'h0 ;
901 2 mihad
    end
902
    else
903
    begin
904
        if (load_medium_reg_in)
905
        begin
906 21 mihad
                pcir_fifo_data_reg <= #`FF_DELAY pcir_fifo_data_in ;
907
                pcir_fifo_ctrl_reg <= #`FF_DELAY pcir_fifo_control_input ;
908 2 mihad
        end
909
    end
910
end
911
 
912
// selecting "fifo data" from medium registers or from PCIR_FIFO
913 21 mihad
wire [31:0]      pcir_fifo_data = (sel_fifo_mreg_in && !pcir_fifo_empty_in) ? pcir_fifo_data_in : pcir_fifo_data_reg ;
914
wire [3:0]       pcir_fifo_ctrl = (sel_fifo_mreg_in && !pcir_fifo_empty_in) ? pcir_fifo_control_input : pcir_fifo_ctrl_reg ;
915 2 mihad
 
916
// signal assignments to PCI Target FSM
917 21 mihad
assign  read_completed_out = req_comp_pending_in ; // completion pending input for requesting side of the bridge
918 2 mihad
assign  read_processing_out = req_req_pending_in ; // request pending input for requesting side
919 21 mihad
  // when '1', the bus command is IO command - not supported commands are checked in pci_decoder modules
920
  wire  io_memory_bus_command = !norm_bc[3] && !norm_bc[2] ;
921 2 mihad
assign  disconect_wo_data_out = (
922 21 mihad
        ((/*pcir_fifo_ctrl[`LAST_CTRL_BIT] ||*/ pcir_fifo_empty_in || ~burst_ok_out/*addr_burst_ok*/ || io_memory_bus_command) &&
923
                ~bc0_in && ~frame_reg_in) ||
924
        ((pciw_fifo_full_in || pciw_fifo_almost_full_in || pciw_fifo_two_left_in || ~addr_burst_ok || io_memory_bus_command) &&
925
                bc0_in && ~frame_reg_in)
926 2 mihad
                                                                ) ;
927 21 mihad
assign  disconect_w_data_out =  (
928
        ( burst_ok_out  && !io_memory_bus_command && ~bc0_in ) ||
929
        ( addr_burst_ok && !io_memory_bus_command && bc0_in )
930
                                                                ) ;
931
assign  target_abort_out = ( ~addr_phase_in && calc_target_abort ) ;
932 2 mihad
 
933 21 mihad
`ifdef          HOST
934
        `ifdef  NO_CNF_IMAGE
935
                        // signal assignments to PCI Target FSM
936
                        assign  norm_access_to_config_out = 1'b0 ;
937
                        // control signal assignments to read request sinchronization module
938
                        assign  done_out =  (target_rd_completed && last_reg_in) ;
939
                        assign  in_progress_out = (same_read_reg && ~bckp_trdy_in) ;
940
                        // signal used for PCIR_FIFO flush (with comp_flush_in signal)
941
                        wire    pcir_fifo_flush = (target_rd_completed && last_reg_in && ~pcir_fifo_empty_in) ;
942
        `else
943
                        // signal assignments to PCI Target FSM
944
                        assign  norm_access_to_config_out = (hit0_in && hit0_conf) ;
945
                        // control signal assignments to read request sinchronization module
946
                        assign  done_out =  (~sel_conf_fifo_in && target_rd_completed && last_reg_in) ;
947
                        assign  in_progress_out = (~sel_conf_fifo_in && same_read_reg && ~bckp_trdy_in) ;
948
                        // signal used for PCIR_FIFO flush (with comp_flush_in signal)
949
                        wire    pcir_fifo_flush = (~sel_conf_fifo_in && target_rd_completed && last_reg_in && ~pcir_fifo_empty_in) ;
950
        `endif
951
`else
952
                        // signal assignments to PCI Target FSM
953
                        assign  norm_access_to_config_out = (hit0_in && hit0_conf) ;
954
                        // control signal assignments to read request sinchronization module
955
                        assign  done_out =  (~sel_conf_fifo_in && target_rd_completed && last_reg_in) ;
956
                        assign  in_progress_out = (~sel_conf_fifo_in && same_read_reg && ~bckp_trdy_in) ;
957
                        // signal used for PCIR_FIFO flush (with comp_flush_in signal)
958
                        wire    pcir_fifo_flush = (~sel_conf_fifo_in && target_rd_completed && last_reg_in && ~pcir_fifo_empty_in) ;
959
`endif
960 2 mihad
 
961
// flush signal for PCIR_FIFO must be registered, since it asinchronously resets some status registers
962 21 mihad
wire            pcir_fifo_flush_reg ;
963
async_reset_flop                  async_reset_as_pcir_flush
964
(
965
    .data_in              (comp_flush_in || pcir_fifo_flush),
966
    .clk_in               (clk_in),
967
    .async_reset_data_out (pcir_fifo_flush_reg),
968
    .reset_in                     (reset_in)
969
) ;
970 2 mihad
 
971
// signal assignments from fifo to PCI Target FSM
972
assign  wbw_fifo_empty_out = wbw_fifo_empty_in ;
973 21 mihad
assign  wbu_del_read_comp_pending_out = wbu_del_read_comp_pending_in ;
974 2 mihad
assign  pciw_fifo_full_out = (pciw_fifo_full_in || pciw_fifo_almost_full_in || pciw_fifo_two_left_in) ;
975 21 mihad
assign  pcir_fifo_data_err_out = pcir_fifo_ctrl[`DATA_ERROR_CTRL_BIT] && !sel_conf_fifo_in ;
976 2 mihad
// signal assignments to fifo
977
assign  pcir_fifo_flush_out                                                     = pcir_fifo_flush_reg ;
978 21 mihad
assign  pcir_fifo_renable_out                                           = fetch_pcir_fifo_in && !pcir_fifo_empty_in ;
979 2 mihad
assign  pciw_fifo_wenable_out                                           = load_to_pciw_fifo_in ;
980 21 mihad
assign  pciw_fifo_control_out[`ADDR_CTRL_BIT]           = ~rdy_in ;
981
assign  pciw_fifo_control_out[`BURST_BIT]                       = rdy_in ? ~frame_reg_in : 1'b0 ;
982 2 mihad
assign  pciw_fifo_control_out[`DATA_ERROR_CTRL_BIT]     = 1'b0 ;
983 21 mihad
assign  pciw_fifo_control_out[`LAST_CTRL_BIT]           = rdy_in ?
984
                (last_reg_in || pciw_fifo_almost_full_in || ~addr_burst_ok || io_memory_bus_command) : 1'b0 ;
985 2 mihad
 
986 21 mihad
`ifdef          HOST
987
        `ifdef  NO_CNF_IMAGE
988
                        // data and address outputs assignments to PCI Target FSM
989
                        assign  data_out = pcir_fifo_data ;
990
        `else
991
                        // data and address outputs assignments to PCI Target FSM
992
                        assign  data_out = sel_conf_fifo_in ? conf_data_in : pcir_fifo_data ;
993
        `endif
994
`else
995
                        // data and address outputs assignments to PCI Target FSM
996
                        assign  data_out = sel_conf_fifo_in ? conf_data_in : pcir_fifo_data ;
997
`endif
998
 
999 2 mihad
// data and address outputs assignments to read request sinchronization module
1000
assign  req_out = req_in ;
1001 21 mihad
        // this address is stored in delayed_sync module and is connected back as strd_addr_in 
1002
assign  addr_out = norm_address[31:0] ; // correction of 2 LSBits is done in wb_master module, original address must be saved
1003 2 mihad
assign  be_out = be_in ;
1004
assign  we_out = 1'b0 ;
1005
assign  bc_out = norm_bc ;
1006 21 mihad
// burst is OK for reads when there is ((MEM_READ_LN or MEM_READ_MUL) and AD[1:0]==2'b00) OR
1007
//   (MEM_READ and Prefetchable_IMAGE and AD[1:0]==2'b00)
1008
assign  burst_ok_out = (norm_bc[3] && addr_burst_ok) || (norm_bc[2] && norm_prf_en && addr_burst_ok) ;
1009
// data and address outputs assignments to PCIW_FIFO - correction of 2 LSBits 
1010
assign  pciw_fifo_addr_data_out = rdy_in ? data_in : {norm_address[31:2], norm_address[1] && io_memory_bus_command,
1011
                                                                                                                                                  norm_address[0] && io_memory_bus_command} ;
1012 2 mihad
assign  pciw_fifo_cbe_out = rdy_in ? be_in : norm_bc ;
1013
// data and address outputs assignments to Configuration space
1014 21 mihad
`ifdef          HOST
1015
        `ifdef  NO_CNF_IMAGE
1016
                        assign  conf_data_out   = 32'h0 ;
1017
                        assign  conf_addr_out   = 12'h0 ;
1018
                        assign  conf_be_out             = 4'b0 ;
1019
                        assign  conf_we_out             = 1'h0 ;
1020
        `else
1021
                        assign  conf_data_out   = data_in ;
1022
                        assign  conf_addr_out   = strd_address[11:0] ;
1023
                        assign  conf_be_out             = be_in ;
1024
                        assign  conf_we_out             = load_to_conf_in ;
1025
        `endif
1026
`else
1027
                        assign  conf_data_out   = data_in ;
1028
                        assign  conf_addr_out   = strd_address[11:0] ;
1029
                        assign  conf_be_out             = be_in ;
1030
                        assign  conf_we_out             = load_to_conf_in ;
1031
`endif
1032
// NOT USED NOW, SONCE READ IS ASYNCHRONOUS
1033
//assign        conf_re_out = fetch_conf_in ;
1034
assign  conf_re_out = 1'b0 ;
1035 2 mihad
 
1036 21 mihad
endmodule

powered by: WebSVN 2.1.0

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