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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_6/] [rtl/] [verilog/] [pci_target32_interface.v] - Blame information for rev 26

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

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

powered by: WebSVN 2.1.0

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