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