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

Subversion Repositories pci

[/] [pci/] [tags/] [rel_00/] [rtl/] [verilog/] [wb_addr_mux.v] - Blame information for rev 21

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

powered by: WebSVN 2.1.0

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