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

Subversion Repositories pci

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

powered by: WebSVN 2.1.0

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