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

Subversion Repositories pci

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

powered by: WebSVN 2.1.0

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