1 |
10 |
unneback |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// OR1200's VR, UPR and Configuration Registers ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the OpenRISC 1200 project ////
|
6 |
|
|
//// http://www.opencores.org/cores/or1k/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// According to OR1K architectural and OR1200 specifications. ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// To Do: ////
|
12 |
|
|
//// - done ////
|
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 |
141 |
marcus.erl |
// $Log: or1200_cfgr.v,v $
|
47 |
|
|
// Revision 2.0 2010/06/30 11:00:00 ORSoC
|
48 |
|
|
// No update
|
49 |
|
|
//
|
50 |
|
|
// Revision 1.4 2004/06/08 18:17:36 lampret
|
51 |
|
|
// Non-functional changes. Coding style fixes.
|
52 |
|
|
//
|
53 |
10 |
unneback |
// Revision 1.3 2002/03/29 15:16:54 lampret
|
54 |
|
|
// Some of the warnings fixed.
|
55 |
|
|
//
|
56 |
|
|
// Revision 1.2 2002/01/14 06:18:22 lampret
|
57 |
|
|
// Fixed mem2reg bug in FAST implementation. Updated debug unit to work with new genpc/if.
|
58 |
|
|
//
|
59 |
|
|
// Revision 1.1 2002/01/03 08:16:15 lampret
|
60 |
|
|
// New prefixes for RTL files, prefixed module names. Updated cache controllers and MMUs.
|
61 |
|
|
//
|
62 |
|
|
// Revision 1.7 2001/10/21 17:57:16 lampret
|
63 |
|
|
// Removed params from generic_XX.v. Added translate_off/on in sprs.v and id.v. Removed spr_addr from dc.v and ic.v. Fixed CR+LF.
|
64 |
|
|
//
|
65 |
|
|
// Revision 1.6 2001/10/14 13:12:09 lampret
|
66 |
|
|
// MP3 version.
|
67 |
|
|
//
|
68 |
|
|
// Revision 1.1.1.1 2001/10/06 10:18:35 igorm
|
69 |
|
|
// no message
|
70 |
|
|
//
|
71 |
|
|
// Revision 1.1 2001/08/09 13:39:33 lampret
|
72 |
|
|
// Major clean-up.
|
73 |
|
|
//
|
74 |
|
|
// Revision 1.1 2001/07/20 00:46:21 lampret
|
75 |
|
|
// Development version of RTL. Libraries are missing.
|
76 |
|
|
//
|
77 |
|
|
//
|
78 |
|
|
|
79 |
|
|
// synopsys translate_off
|
80 |
|
|
`include "timescale.v"
|
81 |
|
|
// synopsys translate_on
|
82 |
|
|
`include "or1200_defines.v"
|
83 |
|
|
|
84 |
|
|
module or1200_cfgr(
|
85 |
|
|
// RISC Internal Interface
|
86 |
|
|
spr_addr, spr_dat_o
|
87 |
|
|
);
|
88 |
|
|
|
89 |
|
|
//
|
90 |
|
|
// RISC Internal Interface
|
91 |
|
|
//
|
92 |
|
|
input [31:0] spr_addr; // SPR Address
|
93 |
|
|
output [31:0] spr_dat_o; // SPR Read Data
|
94 |
|
|
|
95 |
|
|
//
|
96 |
|
|
// Internal wires & registers
|
97 |
|
|
//
|
98 |
|
|
reg [31:0] spr_dat_o; // SPR Read Data
|
99 |
|
|
|
100 |
|
|
`ifdef OR1200_CFGR_IMPLEMENTED
|
101 |
|
|
|
102 |
|
|
//
|
103 |
|
|
// Implementation of VR, UPR and configuration registers
|
104 |
|
|
//
|
105 |
|
|
always @(spr_addr)
|
106 |
|
|
`ifdef OR1200_SYS_FULL_DECODE
|
107 |
|
|
if (~|spr_addr[31:4])
|
108 |
|
|
`endif
|
109 |
|
|
case(spr_addr[3:0]) // synopsys parallel_case
|
110 |
|
|
`OR1200_SPRGRP_SYS_VR: begin
|
111 |
|
|
spr_dat_o[`OR1200_VR_REV_BITS] = `OR1200_VR_REV;
|
112 |
|
|
spr_dat_o[`OR1200_VR_RES1_BITS] = `OR1200_VR_RES1;
|
113 |
|
|
spr_dat_o[`OR1200_VR_CFG_BITS] = `OR1200_VR_CFG;
|
114 |
|
|
spr_dat_o[`OR1200_VR_VER_BITS] = `OR1200_VR_VER;
|
115 |
|
|
end
|
116 |
|
|
`OR1200_SPRGRP_SYS_UPR: begin
|
117 |
|
|
spr_dat_o[`OR1200_UPR_UP_BITS] = `OR1200_UPR_UP;
|
118 |
|
|
spr_dat_o[`OR1200_UPR_DCP_BITS] = `OR1200_UPR_DCP;
|
119 |
|
|
spr_dat_o[`OR1200_UPR_ICP_BITS] = `OR1200_UPR_ICP;
|
120 |
|
|
spr_dat_o[`OR1200_UPR_DMP_BITS] = `OR1200_UPR_DMP;
|
121 |
|
|
spr_dat_o[`OR1200_UPR_IMP_BITS] = `OR1200_UPR_IMP;
|
122 |
|
|
spr_dat_o[`OR1200_UPR_MP_BITS] = `OR1200_UPR_MP;
|
123 |
|
|
spr_dat_o[`OR1200_UPR_DUP_BITS] = `OR1200_UPR_DUP;
|
124 |
|
|
spr_dat_o[`OR1200_UPR_PCUP_BITS] = `OR1200_UPR_PCUP;
|
125 |
|
|
spr_dat_o[`OR1200_UPR_PMP_BITS] = `OR1200_UPR_PMP;
|
126 |
|
|
spr_dat_o[`OR1200_UPR_PICP_BITS] = `OR1200_UPR_PICP;
|
127 |
|
|
spr_dat_o[`OR1200_UPR_TTP_BITS] = `OR1200_UPR_TTP;
|
128 |
|
|
spr_dat_o[`OR1200_UPR_RES1_BITS] = `OR1200_UPR_RES1;
|
129 |
|
|
spr_dat_o[`OR1200_UPR_CUP_BITS] = `OR1200_UPR_CUP;
|
130 |
|
|
end
|
131 |
|
|
`OR1200_SPRGRP_SYS_CPUCFGR: begin
|
132 |
|
|
spr_dat_o[`OR1200_CPUCFGR_NSGF_BITS] = `OR1200_CPUCFGR_NSGF;
|
133 |
|
|
spr_dat_o[`OR1200_CPUCFGR_HGF_BITS] = `OR1200_CPUCFGR_HGF;
|
134 |
|
|
spr_dat_o[`OR1200_CPUCFGR_OB32S_BITS] = `OR1200_CPUCFGR_OB32S;
|
135 |
|
|
spr_dat_o[`OR1200_CPUCFGR_OB64S_BITS] = `OR1200_CPUCFGR_OB64S;
|
136 |
|
|
spr_dat_o[`OR1200_CPUCFGR_OF32S_BITS] = `OR1200_CPUCFGR_OF32S;
|
137 |
|
|
spr_dat_o[`OR1200_CPUCFGR_OF64S_BITS] = `OR1200_CPUCFGR_OF64S;
|
138 |
|
|
spr_dat_o[`OR1200_CPUCFGR_OV64S_BITS] = `OR1200_CPUCFGR_OV64S;
|
139 |
|
|
spr_dat_o[`OR1200_CPUCFGR_RES1_BITS] = `OR1200_CPUCFGR_RES1;
|
140 |
|
|
end
|
141 |
|
|
`OR1200_SPRGRP_SYS_DMMUCFGR: begin
|
142 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_NTW_BITS] = `OR1200_DMMUCFGR_NTW;
|
143 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_NTS_BITS] = `OR1200_DMMUCFGR_NTS;
|
144 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_NAE_BITS] = `OR1200_DMMUCFGR_NAE;
|
145 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_CRI_BITS] = `OR1200_DMMUCFGR_CRI;
|
146 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_PRI_BITS] = `OR1200_DMMUCFGR_PRI;
|
147 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_TEIRI_BITS] = `OR1200_DMMUCFGR_TEIRI;
|
148 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_HTR_BITS] = `OR1200_DMMUCFGR_HTR;
|
149 |
|
|
spr_dat_o[`OR1200_DMMUCFGR_RES1_BITS] = `OR1200_DMMUCFGR_RES1;
|
150 |
|
|
end
|
151 |
|
|
`OR1200_SPRGRP_SYS_IMMUCFGR: begin
|
152 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_NTW_BITS] = `OR1200_IMMUCFGR_NTW;
|
153 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_NTS_BITS] = `OR1200_IMMUCFGR_NTS;
|
154 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_NAE_BITS] = `OR1200_IMMUCFGR_NAE;
|
155 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_CRI_BITS] = `OR1200_IMMUCFGR_CRI;
|
156 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_PRI_BITS] = `OR1200_IMMUCFGR_PRI;
|
157 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_TEIRI_BITS] = `OR1200_IMMUCFGR_TEIRI;
|
158 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_HTR_BITS] = `OR1200_IMMUCFGR_HTR;
|
159 |
|
|
spr_dat_o[`OR1200_IMMUCFGR_RES1_BITS] = `OR1200_IMMUCFGR_RES1;
|
160 |
|
|
end
|
161 |
|
|
`OR1200_SPRGRP_SYS_DCCFGR: begin
|
162 |
|
|
spr_dat_o[`OR1200_DCCFGR_NCW_BITS] = `OR1200_DCCFGR_NCW;
|
163 |
|
|
spr_dat_o[`OR1200_DCCFGR_NCS_BITS] = `OR1200_DCCFGR_NCS;
|
164 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBS_BITS] = `OR1200_DCCFGR_CBS;
|
165 |
|
|
spr_dat_o[`OR1200_DCCFGR_CWS_BITS] = `OR1200_DCCFGR_CWS;
|
166 |
|
|
spr_dat_o[`OR1200_DCCFGR_CCRI_BITS] = `OR1200_DCCFGR_CCRI;
|
167 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBIRI_BITS] = `OR1200_DCCFGR_CBIRI;
|
168 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBPRI_BITS] = `OR1200_DCCFGR_CBPRI;
|
169 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBLRI_BITS] = `OR1200_DCCFGR_CBLRI;
|
170 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBFRI_BITS] = `OR1200_DCCFGR_CBFRI;
|
171 |
|
|
spr_dat_o[`OR1200_DCCFGR_CBWBRI_BITS] = `OR1200_DCCFGR_CBWBRI;
|
172 |
|
|
spr_dat_o[`OR1200_DCCFGR_RES1_BITS] = `OR1200_DCCFGR_RES1;
|
173 |
|
|
end
|
174 |
|
|
`OR1200_SPRGRP_SYS_ICCFGR: begin
|
175 |
|
|
spr_dat_o[`OR1200_ICCFGR_NCW_BITS] = `OR1200_ICCFGR_NCW;
|
176 |
|
|
spr_dat_o[`OR1200_ICCFGR_NCS_BITS] = `OR1200_ICCFGR_NCS;
|
177 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBS_BITS] = `OR1200_ICCFGR_CBS;
|
178 |
|
|
spr_dat_o[`OR1200_ICCFGR_CWS_BITS] = `OR1200_ICCFGR_CWS;
|
179 |
|
|
spr_dat_o[`OR1200_ICCFGR_CCRI_BITS] = `OR1200_ICCFGR_CCRI;
|
180 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBIRI_BITS] = `OR1200_ICCFGR_CBIRI;
|
181 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBPRI_BITS] = `OR1200_ICCFGR_CBPRI;
|
182 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBLRI_BITS] = `OR1200_ICCFGR_CBLRI;
|
183 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBFRI_BITS] = `OR1200_ICCFGR_CBFRI;
|
184 |
|
|
spr_dat_o[`OR1200_ICCFGR_CBWBRI_BITS] = `OR1200_ICCFGR_CBWBRI;
|
185 |
|
|
spr_dat_o[`OR1200_ICCFGR_RES1_BITS] = `OR1200_ICCFGR_RES1;
|
186 |
|
|
end
|
187 |
|
|
`OR1200_SPRGRP_SYS_DCFGR: begin
|
188 |
|
|
spr_dat_o[`OR1200_DCFGR_NDP_BITS] = `OR1200_DCFGR_NDP;
|
189 |
|
|
spr_dat_o[`OR1200_DCFGR_WPCI_BITS] = `OR1200_DCFGR_WPCI;
|
190 |
|
|
spr_dat_o[`OR1200_DCFGR_RES1_BITS] = `OR1200_DCFGR_RES1;
|
191 |
|
|
end
|
192 |
|
|
default: spr_dat_o = 32'h0000_0000;
|
193 |
|
|
endcase
|
194 |
|
|
`ifdef OR1200_SYS_FULL_DECODE
|
195 |
|
|
else
|
196 |
|
|
spr_dat_o = 32'h0000_0000;
|
197 |
|
|
`endif
|
198 |
|
|
|
199 |
|
|
`else
|
200 |
|
|
|
201 |
|
|
//
|
202 |
|
|
// When configuration registers are not implemented, only
|
203 |
|
|
// implement VR and UPR
|
204 |
|
|
//
|
205 |
|
|
always @(spr_addr)
|
206 |
|
|
`ifdef OR1200_SYS_FULL_DECODE
|
207 |
141 |
marcus.erl |
if (spr_addr[31:4] == 28'h0)
|
208 |
10 |
unneback |
`endif
|
209 |
|
|
case(spr_addr[3:0])
|
210 |
|
|
`OR1200_SPRGRP_SYS_VR: begin
|
211 |
|
|
spr_dat_o[`OR1200_VR_REV_BITS] = `OR1200_VR_REV;
|
212 |
|
|
spr_dat_o[`OR1200_VR_RES1_BITS] = `OR1200_VR_RES1;
|
213 |
|
|
spr_dat_o[`OR1200_VR_CFG_BITS] = `OR1200_VR_CFG;
|
214 |
|
|
spr_dat_o[`OR1200_VR_VER_BITS] = `OR1200_VR_VER;
|
215 |
|
|
end
|
216 |
|
|
`OR1200_SPRGRP_SYS_UPR: begin
|
217 |
|
|
spr_dat_o[`OR1200_UPR_UP_BITS] = `OR1200_UPR_UP;
|
218 |
|
|
spr_dat_o[`OR1200_UPR_DCP_BITS] = `OR1200_UPR_DCP;
|
219 |
|
|
spr_dat_o[`OR1200_UPR_ICP_BITS] = `OR1200_UPR_ICP;
|
220 |
|
|
spr_dat_o[`OR1200_UPR_DMP_BITS] = `OR1200_UPR_DMP;
|
221 |
|
|
spr_dat_o[`OR1200_UPR_IMP_BITS] = `OR1200_UPR_IMP;
|
222 |
|
|
spr_dat_o[`OR1200_UPR_MP_BITS] = `OR1200_UPR_MP;
|
223 |
|
|
spr_dat_o[`OR1200_UPR_DUP_BITS] = `OR1200_UPR_DUP;
|
224 |
|
|
spr_dat_o[`OR1200_UPR_PCUP_BITS] = `OR1200_UPR_PCUP;
|
225 |
|
|
spr_dat_o[`OR1200_UPR_PMP_BITS] = `OR1200_UPR_PMP;
|
226 |
|
|
spr_dat_o[`OR1200_UPR_PICP_BITS] = `OR1200_UPR_PICP;
|
227 |
|
|
spr_dat_o[`OR1200_UPR_TTP_BITS] = `OR1200_UPR_TTP;
|
228 |
|
|
spr_dat_o[`OR1200_UPR_RES1_BITS] = `OR1200_UPR_RES1;
|
229 |
|
|
spr_dat_o[`OR1200_UPR_CUP_BITS] = `OR1200_UPR_CUP;
|
230 |
|
|
end
|
231 |
|
|
default: spr_dat_o = 32'h0000_0000;
|
232 |
|
|
endcase
|
233 |
|
|
`ifdef OR1200_SYS_FULL_DECODE
|
234 |
|
|
else
|
235 |
|
|
spr_dat_o = 32'h0000_0000;
|
236 |
|
|
`endif
|
237 |
|
|
|
238 |
|
|
`endif
|
239 |
|
|
|
240 |
|
|
endmodule
|