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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_3/] [rtl/] [verilog/] [wb_addr_mux.v] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 mihad
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  File name "wb_addr_mux.v"                                   ////
4
////                                                              ////
5
////  This file is part of the "PCI bridge" project               ////
6
////  http://www.opencores.org/cores/pci/                         ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Miha Dolenc (mihad@opencores.org)                     ////
10
////                                                              ////
11
////  All additional information is avaliable in the README       ////
12
////  file.                                                       ////
13
////                                                              ////
14
////                                                              ////
15
//////////////////////////////////////////////////////////////////////
16
////                                                              ////
17
//// Copyright (C) 2000 Miha Dolenc, mihad@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 50 mihad
// Revision 1.3  2002/02/01 15:25:13  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
// module provides instantiation of address decoders and address multiplexer for various number of implemented wishbone images
57 21 mihad
`include "pci_constants.v"
58
// synopsys translate_off
59 6 mihad
`include "timescale.v"
60 21 mihad
// synopsys translate_on
61 2 mihad
 
62
module WB_ADDR_MUX
63
(
64 21 mihad
    `ifdef REGISTER_WBS_OUTPUTS
65
    clk_in,
66
    reset_in,
67
    sample_address_in,
68
    `endif
69 2 mihad
    address_in,
70
    bar0_in,
71
    bar1_in,
72
    bar2_in,
73
    bar3_in,
74
    bar4_in,
75
    bar5_in,
76
    am0_in,
77
    am1_in,
78
    am2_in,
79
    am3_in,
80
    am4_in,
81
    am5_in,
82
    ta0_in,
83
    ta1_in,
84
    ta2_in,
85
    ta3_in,
86
    ta4_in,
87
    ta5_in,
88
    at_en_in,
89
    hit_out,
90
    address_out
91
);
92
 
93
input [31:0] address_in ;
94
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar0_in  ;
95
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar1_in  ;
96
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar2_in  ;
97
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar3_in  ;
98
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar4_in  ;
99
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] bar5_in  ;
100
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am0_in   ;
101
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am1_in   ;
102
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am2_in   ;
103
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am3_in   ;
104
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am4_in   ;
105
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] am5_in   ;
106
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta0_in   ;
107
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta1_in   ;
108
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta2_in   ;
109
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta3_in   ;
110
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta4_in   ;
111
input [(`WB_NUM_OF_DEC_ADDR_LINES - 1):0] ta5_in   ;
112
input [5:0]  at_en_in ;
113
output [5:0] hit_out  ;
114
output [31:0] address_out ;
115
reg    [31:0] address_out ;
116
 
117
wire [31:0] addr0 ;
118
wire [31:0] addr1 ;
119
wire [31:0] addr2 ;
120
wire [31:0] addr3 ;
121
wire [31:0] addr4 ;
122
wire [31:0] addr5 ;
123
 
124
wire [5:0] hit ;
125
assign hit_out = hit ;
126
 
127 21 mihad
`ifdef REGISTER_WBS_OUTPUTS
128
    input clk_in, reset_in, sample_address_in ;
129
 
130
    reg [31:0] address ;
131
    always@(posedge clk_in or posedge reset_in)
132
    begin
133
       if ( reset_in )
134
           address <= #`FF_DELAY 0 ;
135
       else
136
       if ( sample_address_in )
137
           address <= #`FF_DELAY address_in ;
138
    end
139
`else
140
    wire [31:0] address = address_in ;
141
`endif
142
 
143 2 mihad
`ifdef GUEST
144 21 mihad
    `ifdef NO_CNF_IMAGE
145 2 mihad
    `else
146 50 mihad
        `define PCI_WB_ADDR_MUX_DEC0_INCLUDE
147 2 mihad
    `endif
148
`else
149 21 mihad
`ifdef HOST
150 50 mihad
    `define PCI_WB_ADDR_MUX_DEC0_INCLUDE
151 2 mihad
`endif
152 21 mihad
`endif
153 2 mihad
 
154 50 mihad
`ifdef PCI_WB_ADDR_MUX_DEC0_INCLUDE
155 21 mihad
    DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec0
156
    (
157
     .hit       (hit[0]),
158
     .addr_out  (addr0),
159
     .addr_in   (address),
160
     .base_addr (bar0_in),
161
     .mask_addr (am0_in),
162
     .tran_addr (ta0_in),
163
     .at_en     (1'b0)
164
    ) ;
165
`else
166
    // configuration image not implemented
167
    assign hit[0] = 1'b0 ;
168
    assign addr0  = 32'h0000_0000 ;
169
`endif
170
 
171 2 mihad
// one image is always implemented
172 21 mihad
DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec1
173
(
174
 .hit       (hit[1]),
175
 .addr_out  (addr1),
176
 .addr_in   (address),
177
 .base_addr (bar1_in),
178
 .mask_addr (am1_in),
179
 .tran_addr (ta1_in),
180
 .at_en     (at_en_in[1])
181
) ;
182 2 mihad
 
183
`ifdef WB_IMAGE2
184 21 mihad
    DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec2
185
    (
186
     .hit       (hit[2]),
187
     .addr_out  (addr2),
188
     .addr_in   (address),
189
     .base_addr (bar2_in),
190
     .mask_addr (am2_in),
191
     .tran_addr (ta2_in),
192
     .at_en     (at_en_in[2])
193
    ) ;
194 2 mihad
 
195
`else
196 21 mihad
    assign hit[2] = 1'b0 ;
197
    assign addr2  = 0 ;
198 2 mihad
`endif
199
 
200
`ifdef WB_IMAGE3
201 21 mihad
    DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec3
202
    (
203
     .hit       (hit[3]),
204
     .addr_out  (addr3),
205
     .addr_in   (address),
206
     .base_addr (bar3_in),
207
     .mask_addr (am3_in),
208
     .tran_addr (ta3_in),
209
     .at_en     (at_en_in[3])
210
    ) ;
211
`else
212
    assign hit[3] = 1'b0 ;
213
    assign addr3  = 0 ;
214 2 mihad
`endif
215
 
216
`ifdef WB_IMAGE4
217 21 mihad
    DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec4
218
    (
219
     .hit       (hit[4]),
220
     .addr_out  (addr4),
221
     .addr_in   (address),
222
     .base_addr (bar4_in),
223
     .mask_addr (am4_in),
224
     .tran_addr (ta4_in),
225
     .at_en     (at_en_in[4])
226
    ) ;
227
`else
228
    assign hit[4] = 1'b0 ;
229
    assign addr4  = 0 ;
230 2 mihad
`endif
231
 
232
`ifdef WB_IMAGE5
233 21 mihad
    DECODER #(`WB_NUM_OF_DEC_ADDR_LINES) dec5
234
    (
235
     .hit       (hit[5]),
236
     .addr_out  (addr5),
237
     .addr_in   (address),
238
     .base_addr (bar5_in),
239
     .mask_addr (am5_in),
240
     .tran_addr (ta5_in),
241
     .at_en     (at_en_in[5])
242
    ) ;
243
`else
244
    assign hit[5] = 1'b0 ;
245
    assign addr5  = 0 ;
246
`endif
247 2 mihad
 
248 21 mihad
// address multiplexer
249
always@
250
(
251
 hit or
252
 addr0 or
253
 addr1 or
254
 addr2 or
255
 addr3 or
256
 addr4 or
257
 addr5
258
)
259
begin
260
    case ( {hit[5:2], hit[0]} )
261
        5'b0_0_0_0_1: address_out = addr0 ;
262
        5'b0_0_0_1_0: address_out = addr2 ;
263
        5'b0_0_1_0_0: address_out = addr3 ;
264
        5'b0_1_0_0_0: address_out = addr4 ;
265
        5'b1_0_0_0_0: address_out = addr5 ;
266 2 mihad
 
267 21 mihad
        // default address is address from decoder 1 - it is always implemented - in case of stripped down core to only one image
268
        // this multiplexer can be completely removed during synthesys
269
        default:      address_out = addr1 ;
270
    endcase
271
end
272 2 mihad
 
273 21 mihad
endmodule

powered by: WebSVN 2.1.0

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