1 //////////////////////////////////////////////////////////////////////
3 //// File name "wb_addr_mux.v" ////
5 //// This file is part of the "PCI bridge" project ////
6 //// http://www.opencores.org/cores/pci/ ////
9 //// - Miha Dolenc (mihad@opencores.org) ////
11 //// All additional information is avaliable in the README ////
15 //////////////////////////////////////////////////////////////////////
17 //// Copyright (C) 2000 Miha Dolenc, mihad@opencores.org ////
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. ////
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. ////
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 ////
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 ////
40 //////////////////////////////////////////////////////////////////////
42 // CVS Revision History
44 // $Log: pci_wb_addr_mux.v,v $
45 // Revision 1.1 2007-03-20 17:50:56 sithglan
48 // Revision 1.1 2003/01/27 16:49:31 mihad
49 // Changed module and file names. Updated scripts accordingly. FIFO synchronizations changed.
51 // Revision 1.4 2002/08/19 16:54:25 mihad
52 // Got rid of undef directives
54 // Revision 1.3 2002/02/01 15:25:13 mihad
55 // Repaired a few bugs, updated specification, added test bench files and design document
57 // Revision 1.2 2001/10/05 08:14:30 mihad
58 // Updated all files with inclusion of timescale file for simulation purposes.
60 // Revision 1.1.1.1 2001/10/02 15:33:47 mihad
61 // New project directory structure
65 // module provides instantiation of address decoders and address multiplexer for various number of implemented wishbone images
66 `include "pci_constants.v"
67 // synopsys translate_off
68 `include "timescale.v"
69 // synopsys translate_on
71 module pci_wb_addr_mux
73 `ifdef REGISTER_WBS_OUTPUTS
102 input [31:0] address_in ;
103 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar0_in ;
104 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar1_in ;
105 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar2_in ;
106 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar3_in ;
107 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar4_in ;
108 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar5_in ;
109 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am0_in ;
110 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am1_in ;
111 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am2_in ;
112 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am3_in ;
113 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am4_in ;
114 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am5_in ;
115 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta0_in ;
116 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta1_in ;
117 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta2_in ;
118 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta3_in ;
119 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta4_in ;
120 input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta5_in ;
121 input [5:0] at_en_in ;
122 output [5:0] hit_out ;
123 output [31:0] address_out ;
124 reg [31:0] address_out ;
134 assign hit_out = hit ;
136 `ifdef REGISTER_WBS_OUTPUTS
137 input clk_in, reset_in, sample_address_in ;
140 always@(posedge clk_in or posedge reset_in)
143 address <= #`FF_DELAY 0 ;
145 if ( sample_address_in )
146 address <= #`FF_DELAY address_in ;
149 wire [31:0] address = address_in ;
155 `define PCI_WB_ADDR_MUX_DEC0_INCLUDE
159 `define PCI_WB_ADDR_MUX_DEC0_INCLUDE
163 `ifdef PCI_WB_ADDR_MUX_DEC0_INCLUDE
164 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec0
169 .base_addr (bar0_in),
175 // configuration image not implemented
176 assign hit[0] = 1'b0 ;
177 assign addr0 = 32'h0000_0000 ;
180 // one image is always implemented
181 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec1
186 .base_addr (bar1_in),
193 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec2
198 .base_addr (bar2_in),
205 assign hit[2] = 1'b0 ;
210 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec3
215 .base_addr (bar3_in),
221 assign hit[3] = 1'b0 ;
226 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec4
231 .base_addr (bar4_in),
237 assign hit[4] = 1'b0 ;
242 pci_wb_decoder #(`WB_NUM_OF_DEC_ADDR_LINES) dec5
247 .base_addr (bar5_in),
253 assign hit[5] = 1'b0 ;
257 // address multiplexer
269 case ( {hit[5:2], hit[0]} )
270 5'b0_0_0_0_1: address_out = addr0 ;
271 5'b0_0_0_1_0: address_out = addr2 ;
272 5'b0_0_1_0_0: address_out = addr3 ;
273 5'b0_1_0_0_0: address_out = addr4 ;
274 5'b1_0_0_0_0: address_out = addr5 ;
276 // default address is address from decoder 1 - it is always implemented - in case of stripped down core to only one image
277 // this multiplexer can be completely removed during synthesys
278 default: address_out = addr1 ;