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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [wb_biu.v] - Blame information for rev 203

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

Line No. Rev Author Line
1 161 lampret
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  OR1200's WISHBONE BIU                                       ////
4
////                                                              ////
5
////  This file is part of the OpenRISC 1200 project              ////
6
////  http://www.opencores.org/cores/or1k/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////  Implements WISHBONE interface                               ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   - add support for wb_err_i                                 ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Damjan Lampret, lampret@opencores.org                 ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47 203 lampret
// Revision 1.3  2001/08/09 13:39:33  lampret
48
// Major clean-up.
49
//
50 168 lampret
// Revision 1.2  2001/07/22 03:31:54  lampret
51
// Fixed RAM's oen bug. Cache bypass under development.
52
//
53 166 lampret
// Revision 1.1  2001/07/20 00:46:23  lampret
54
// Development version of RTL. Libraries are missing.
55 161 lampret
//
56 166 lampret
//
57 161 lampret
 
58 203 lampret
// synopsys translate_off
59 168 lampret
`include "timescale.v"
60 203 lampret
// synopsys translate_on
61 168 lampret
`include "defines.v"
62 161 lampret
 
63
module wb_biu(
64
        // WISHBONE interface
65
        wb_clk_i, wb_rst_i, wb_ack_i, wb_err_i, wb_rty_i, wb_dat_i,
66
        wb_cyc_o, wb_adr_o, wb_stb_o, wb_we_o, wb_sel_o, wb_dat_o,
67
 
68
        // Internal RISC bus
69 166 lampret
        biu_to_biu, biu_addr, biu_read, biu_write, biu_rdy, biu_from_biu, biu_sel
70 161 lampret
);
71
 
72
parameter dw = `OPERAND_WIDTH;
73
parameter aw = `OPERAND_WIDTH;
74
 
75
//
76
// WISHBONE interface
77
//
78 203 lampret
input                   wb_clk_i;       // clock input
79
input                   wb_rst_i;       // reset input
80
input                   wb_ack_i;       // normal termination
81
input                   wb_err_i;       // termination w/ error
82
input                   wb_rty_i;       // termination w/ retry
83
input   [dw-1:0] wb_dat_i;       // input data bus
84
output                  wb_cyc_o;       // cycle valid output
85
output  [aw-1:0] wb_adr_o;       // address bus outputs
86
output                  wb_stb_o;       // strobe output
87
output                  wb_we_o;        // indicates write transfer
88
output  [3:0]            wb_sel_o;       // byte select outputs
89
output  [dw-1:0] wb_dat_o;       // output data bus
90 161 lampret
 
91
//
92
// Internal RISC interface
93
//
94 203 lampret
input   [dw-1:0] biu_to_biu;     // input data bus
95
input   [aw-1:0] biu_addr;       // address bus
96
input                   biu_read;       // read request
97
input                   biu_write;      // write request
98
output                  biu_rdy;        // data valid
99
output  [dw-1:0] biu_from_biu;   // output data bus
100
input   [3:0]            biu_sel;        // byte select inputs
101 161 lampret
 
102
//
103 203 lampret
// Registers
104
//
105
`ifdef OR1200_REGISTERED_OUTPUTS
106
reg     [aw-1:0] wb_adr_o;       // address bus outputs
107
reg                     wb_stb_o;       // strobe output
108
reg                     wb_we_o;        // indicates write transfer
109
reg     [3:0]            wb_sel_o;       // byte select outputs
110
reg     [dw-1:0] wb_dat_o;       // output data bus
111
`endif
112
 
113
//
114 161 lampret
// WISHBONE I/F <-> Internal RISC I/F conversion
115
//
116
 
117 168 lampret
//
118 161 lampret
// Address bus
119 168 lampret
//
120 203 lampret
`ifdef OR1200_REGISTERED_OUTPUTS
121
always @(posedge wb_clk_i or posedge wb_rst_i)
122
        if (wb_rst_i)
123
                wb_adr_o <= #1 {aw{1'b0}};
124
        else
125
                wb_adr_o <= #1 biu_addr;
126
`else
127 161 lampret
assign wb_adr_o = biu_addr;
128 203 lampret
`endif
129 161 lampret
 
130 168 lampret
//
131 161 lampret
// Input data bus
132 168 lampret
//
133 161 lampret
assign biu_from_biu = wb_dat_i;
134
 
135 168 lampret
//
136 161 lampret
// Output data bus
137 168 lampret
//
138 203 lampret
`ifdef OR1200_REGISTERED_OUTPUTS
139
always @(posedge wb_clk_i or posedge wb_rst_i)
140
        if (wb_rst_i)
141
                wb_dat_o <= #1 {dw{1'b0}};
142
        else
143
                wb_dat_o <= #1 biu_to_biu;
144
`else
145 161 lampret
assign wb_dat_o = biu_to_biu;
146 203 lampret
`endif
147 161 lampret
 
148 168 lampret
//
149 161 lampret
// Acknowledgment of the data to the RISC
150 168 lampret
//
151 161 lampret
assign biu_rdy = wb_ack_i;
152
 
153 168 lampret
//
154 161 lampret
// WB cyc_o
155 168 lampret
//
156 161 lampret
assign wb_cyc_o = wb_stb_o;
157
 
158 168 lampret
//
159 161 lampret
// WB stb_o
160 168 lampret
//
161 203 lampret
`ifdef OR1200_REGISTERED_OUTPUTS
162
always @(posedge wb_clk_i or posedge wb_rst_i)
163
        if (wb_rst_i)
164
                wb_stb_o <= #1 1'b0;
165
        else
166
                wb_stb_o <= #1 (biu_read | biu_write);
167
`else
168
assign wb_stb_o = (biu_read | biu_write);
169
`endif
170 161 lampret
 
171 168 lampret
//
172 161 lampret
// WB we_o
173 168 lampret
//
174 203 lampret
`ifdef OR1200_REGISTERED_OUTPUTS
175
always @(posedge wb_clk_i or posedge wb_rst_i)
176
        if (wb_rst_i)
177
                wb_we_o <= #1 1'b0;
178
        else
179
                wb_we_o <= #1 biu_write;
180
`else
181 161 lampret
assign wb_we_o = biu_write;
182 203 lampret
`endif
183 161 lampret
 
184 168 lampret
//
185 161 lampret
// WB sel_o
186 168 lampret
//
187 203 lampret
`ifdef OR1200_REGISTERED_OUTPUTS
188
always @(posedge wb_clk_i or posedge wb_rst_i)
189
        if (wb_rst_i)
190
                wb_sel_o <= #1 4'b0000;
191
        else
192
                wb_sel_o <= #1 biu_sel;
193
`else
194 166 lampret
assign wb_sel_o = biu_sel;
195 203 lampret
`endif
196 161 lampret
 
197
endmodule

powered by: WebSVN 2.1.0

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