1 |
168 |
lampret |
//////////////////////////////////////////////////////////////////////
|
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 |
203 |
lampret |
// Revision 1.1 2001/08/09 13:39:33 lampret
|
48 |
|
|
// Major clean-up.
|
49 |
|
|
//
|
50 |
168 |
lampret |
// Revision 1.1 2001/07/20 00:46:21 lampret
|
51 |
|
|
// Development version of RTL. Libraries are missing.
|
52 |
|
|
//
|
53 |
|
|
//
|
54 |
|
|
|
55 |
203 |
lampret |
// synopsys translate_off
|
56 |
168 |
lampret |
`include "timescale.v"
|
57 |
203 |
lampret |
// synopsys translate_on
|
58 |
168 |
lampret |
`include "defines.v"
|
59 |
|
|
|
60 |
|
|
module cfgr(
|
61 |
|
|
// RISC Internal Interface
|
62 |
|
|
clk, rst, spr_addr, spr_dat_o
|
63 |
|
|
);
|
64 |
|
|
|
65 |
|
|
//
|
66 |
|
|
// RISC Internal Interface
|
67 |
|
|
//
|
68 |
|
|
input clk; // Clock
|
69 |
|
|
input rst; // Reset
|
70 |
|
|
input [31:0] spr_addr; // SPR Address
|
71 |
|
|
output [31:0] spr_dat_o; // SPR Read Data
|
72 |
|
|
|
73 |
|
|
//
|
74 |
|
|
// Internal wires & registers
|
75 |
|
|
//
|
76 |
|
|
reg [31:0] spr_dat_o; // SPR Read Data
|
77 |
|
|
|
78 |
|
|
`ifdef CFGR_IMPLEMENTED
|
79 |
|
|
|
80 |
|
|
//
|
81 |
|
|
// Implementation of VR, UPR and configuration registers
|
82 |
|
|
//
|
83 |
|
|
always @(spr_addr)
|
84 |
|
|
`ifdef SYS_FULL_DECODE
|
85 |
|
|
if (!spr_addr[31:4])
|
86 |
|
|
`endif
|
87 |
|
|
case(spr_addr[3:0])
|
88 |
|
|
`SPRGRP_SYS_VR: begin
|
89 |
203 |
lampret |
spr_dat_o[`VR_REV_BITS] = `VR_REV;
|
90 |
|
|
spr_dat_o[`VR_RES1_BITS] = `VR_RES1;
|
91 |
|
|
spr_dat_o[`VR_CFG_BITS] = `VR_CFG;
|
92 |
|
|
spr_dat_o[`VR_VER_BITS] = `VR_VER;
|
93 |
168 |
lampret |
end
|
94 |
|
|
`SPRGRP_SYS_UPR: begin
|
95 |
203 |
lampret |
spr_dat_o[`UPR_UP_BITS] = `UPR_UP;
|
96 |
|
|
spr_dat_o[`UPR_DCP_BITS] = `UPR_DCP;
|
97 |
|
|
spr_dat_o[`UPR_ICP_BITS] = `UPR_ICP;
|
98 |
|
|
spr_dat_o[`UPR_DMP_BITS] = `UPR_DMP;
|
99 |
|
|
spr_dat_o[`UPR_IMP_BITS] = `UPR_IMP;
|
100 |
|
|
spr_dat_o[`UPR_MP_BITS] = `UPR_MP;
|
101 |
|
|
spr_dat_o[`UPR_DUP_BITS] = `UPR_DUP;
|
102 |
|
|
spr_dat_o[`UPR_PCUP_BITS] = `UPR_PCUP;
|
103 |
|
|
spr_dat_o[`UPR_PMP_BITS] = `UPR_PMP;
|
104 |
|
|
spr_dat_o[`UPR_PICP_BITS] = `UPR_PICP;
|
105 |
|
|
spr_dat_o[`UPR_TTP_BITS] = `UPR_TTP;
|
106 |
|
|
spr_dat_o[`UPR_RES1_BITS] = `UPR_RES1;
|
107 |
|
|
spr_dat_o[`UPR_CUP_BITS] = `UPR_CUP;
|
108 |
168 |
lampret |
end
|
109 |
|
|
`SPRGRP_SYS_CPUCFGR: begin
|
110 |
203 |
lampret |
spr_dat_o[`CPUCFGR_NSGF_BITS] = `CPUCFGR_NSGF;
|
111 |
|
|
spr_dat_o[`CPUCFGR_HGF_BITS] = `CPUCFGR_HGF;
|
112 |
|
|
spr_dat_o[`CPUCFGR_OB32S_BITS] = `CPUCFGR_OB32S;
|
113 |
|
|
spr_dat_o[`CPUCFGR_OB64S_BITS] = `CPUCFGR_OB64S;
|
114 |
|
|
spr_dat_o[`CPUCFGR_OF32S_BITS] = `CPUCFGR_OF32S;
|
115 |
|
|
spr_dat_o[`CPUCFGR_OF64S_BITS] = `CPUCFGR_OF64S;
|
116 |
|
|
spr_dat_o[`CPUCFGR_OV64S_BITS] = `CPUCFGR_OV64S;
|
117 |
|
|
spr_dat_o[`CPUCFGR_RES1_BITS] = `CPUCFGR_RES1;
|
118 |
168 |
lampret |
end
|
119 |
|
|
`SPRGRP_SYS_DMMUCFGR: begin
|
120 |
203 |
lampret |
spr_dat_o[`DMMUCFGR_NTW_BITS] = `DMMUCFGR_NTW;
|
121 |
|
|
spr_dat_o[`DMMUCFGR_NTS_BITS] = `DMMUCFGR_NTS;
|
122 |
|
|
spr_dat_o[`DMMUCFGR_NAE_BITS] = `DMMUCFGR_NAE;
|
123 |
|
|
spr_dat_o[`DMMUCFGR_CRI_BITS] = `DMMUCFGR_CRI;
|
124 |
|
|
spr_dat_o[`DMMUCFGR_PRI_BITS] = `DMMUCFGR_PRI;
|
125 |
|
|
spr_dat_o[`DMMUCFGR_TEIRI_BITS] = `DMMUCFGR_TEIRI;
|
126 |
|
|
spr_dat_o[`DMMUCFGR_HTR_BITS] = `DMMUCFGR_HTR;
|
127 |
|
|
spr_dat_o[`DMMUCFGR_RES1_BITS] = `DMMUCFGR_RES1;
|
128 |
168 |
lampret |
end
|
129 |
|
|
`SPRGRP_SYS_IMMUCFGR: begin
|
130 |
203 |
lampret |
spr_dat_o[`IMMUCFGR_NTW_BITS] = `IMMUCFGR_NTW;
|
131 |
|
|
spr_dat_o[`IMMUCFGR_NTS_BITS] = `IMMUCFGR_NTS;
|
132 |
|
|
spr_dat_o[`IMMUCFGR_NAE_BITS] = `IMMUCFGR_NAE;
|
133 |
|
|
spr_dat_o[`IMMUCFGR_CRI_BITS] = `IMMUCFGR_CRI;
|
134 |
|
|
spr_dat_o[`IMMUCFGR_PRI_BITS] = `IMMUCFGR_PRI;
|
135 |
|
|
spr_dat_o[`IMMUCFGR_TEIRI_BITS] = `IMMUCFGR_TEIRI;
|
136 |
|
|
spr_dat_o[`IMMUCFGR_HTR_BITS] = `IMMUCFGR_HTR;
|
137 |
|
|
spr_dat_o[`IMMUCFGR_RES1_BITS] = `IMMUCFGR_RES1;
|
138 |
168 |
lampret |
end
|
139 |
|
|
`SPRGRP_SYS_DCCFGR: begin
|
140 |
203 |
lampret |
spr_dat_o[`DCCFGR_NCW_BITS] = `DCCFGR_NCW;
|
141 |
|
|
spr_dat_o[`DCCFGR_NCS_BITS] = `DCCFGR_NCS;
|
142 |
|
|
spr_dat_o[`DCCFGR_CBS_BITS] = `DCCFGR_CBS;
|
143 |
|
|
spr_dat_o[`DCCFGR_CWS_BITS] = `DCCFGR_CWS;
|
144 |
|
|
spr_dat_o[`DCCFGR_CCRI_BITS] = `DCCFGR_CCRI;
|
145 |
|
|
spr_dat_o[`DCCFGR_CBIRI_BITS] = `DCCFGR_CBIRI;
|
146 |
|
|
spr_dat_o[`DCCFGR_CBPRI_BITS] = `DCCFGR_CBPRI;
|
147 |
|
|
spr_dat_o[`DCCFGR_CBLRI_BITS] = `DCCFGR_CBLRI;
|
148 |
|
|
spr_dat_o[`DCCFGR_CBFRI_BITS] = `DCCFGR_CBFRI;
|
149 |
|
|
spr_dat_o[`DCCFGR_CBWBRI_BITS] = `DCCFGR_CBWBRI;
|
150 |
|
|
spr_dat_o[`DCCFGR_RES1_BITS] = `DCCFGR_RES1;
|
151 |
168 |
lampret |
end
|
152 |
|
|
`SPRGRP_SYS_ICCFGR: begin
|
153 |
203 |
lampret |
spr_dat_o[`ICCFGR_NCW_BITS] = `ICCFGR_NCW;
|
154 |
|
|
spr_dat_o[`ICCFGR_NCS_BITS] = `ICCFGR_NCS;
|
155 |
|
|
spr_dat_o[`ICCFGR_CBS_BITS] = `ICCFGR_CBS;
|
156 |
|
|
spr_dat_o[`ICCFGR_CWS_BITS] = `ICCFGR_CWS;
|
157 |
|
|
spr_dat_o[`ICCFGR_CCRI_BITS] = `ICCFGR_CCRI;
|
158 |
|
|
spr_dat_o[`ICCFGR_CBIRI_BITS] = `ICCFGR_CBIRI;
|
159 |
|
|
spr_dat_o[`ICCFGR_CBPRI_BITS] = `ICCFGR_CBPRI;
|
160 |
|
|
spr_dat_o[`ICCFGR_CBLRI_BITS] = `ICCFGR_CBLRI;
|
161 |
|
|
spr_dat_o[`ICCFGR_CBFRI_BITS] = `ICCFGR_CBFRI;
|
162 |
|
|
spr_dat_o[`ICCFGR_CBWBRI_BITS] = `ICCFGR_CBWBRI;
|
163 |
|
|
spr_dat_o[`ICCFGR_RES1_BITS] = `ICCFGR_RES1;
|
164 |
168 |
lampret |
end
|
165 |
|
|
`SPRGRP_SYS_DCFGR: begin
|
166 |
203 |
lampret |
spr_dat_o[`DCFGR_NDP_BITS] = `DCFGR_NDP;
|
167 |
|
|
spr_dat_o[`DCFGR_WPCI_BITS] = `DCFGR_WPCI;
|
168 |
|
|
spr_dat_o[`DCFGR_RES1_BITS] = `DCFGR_RES1;
|
169 |
168 |
lampret |
end
|
170 |
203 |
lampret |
default: spr_dat_o = 32'h0000_0000;
|
171 |
168 |
lampret |
endcase
|
172 |
203 |
lampret |
`ifdef SYS_FULL_DECODE
|
173 |
|
|
else
|
174 |
|
|
spr_dat_o = 32'h0000_0000;
|
175 |
|
|
`endif
|
176 |
|
|
|
177 |
168 |
lampret |
`else
|
178 |
|
|
|
179 |
|
|
//
|
180 |
|
|
// When configuration registers are not implemented, only
|
181 |
|
|
// implement VR and UPR
|
182 |
|
|
//
|
183 |
|
|
always @(spr_addr)
|
184 |
|
|
`ifdef SYS_FULL_DECODE
|
185 |
|
|
if (!spr_addr[31:4])
|
186 |
|
|
`endif
|
187 |
|
|
case(spr_addr[3:0])
|
188 |
|
|
`SPRGRP_SYS_VR: begin
|
189 |
203 |
lampret |
spr_dat_o[`VR_REV_BITS] = `VR_REV;
|
190 |
|
|
spr_dat_o[`VR_RES1_BITS] = `VR_RES1;
|
191 |
|
|
spr_dat_o[`VR_CFG_BITS] = `VR_CFG;
|
192 |
|
|
spr_dat_o[`VR_VER_BITS] = `VR_VER;
|
193 |
168 |
lampret |
end
|
194 |
|
|
`SPRGRP_SYS_UPR: begin
|
195 |
203 |
lampret |
spr_dat_o[`UPR_UP_BITS] = `UPR_UP;
|
196 |
|
|
spr_dat_o[`UPR_DCP_BITS] = `UPR_DCP;
|
197 |
|
|
spr_dat_o[`UPR_ICP_BITS] = `UPR_ICP;
|
198 |
|
|
spr_dat_o[`UPR_DMP_BITS] = `UPR_DMP;
|
199 |
|
|
spr_dat_o[`UPR_IMP_BITS] = `UPR_IMP;
|
200 |
|
|
spr_dat_o[`UPR_MP_BITS] = `UPR_MP;
|
201 |
|
|
spr_dat_o[`UPR_DUP_BITS] = `UPR_DUP;
|
202 |
|
|
spr_dat_o[`UPR_PCUP_BITS] = `UPR_PCUP;
|
203 |
|
|
spr_dat_o[`UPR_PMP_BITS] = `UPR_PMP;
|
204 |
|
|
spr_dat_o[`UPR_PICP_BITS] = `UPR_PICP;
|
205 |
|
|
spr_dat_o[`UPR_TTP_BITS] = `UPR_TTP;
|
206 |
|
|
spr_dat_o[`UPR_RES1_BITS] = `UPR_RES1;
|
207 |
|
|
spr_dat_o[`UPR_CUP_BITS] = `UPR_CUP;
|
208 |
168 |
lampret |
end
|
209 |
203 |
lampret |
default: spr_dat_o = 32'h0000_0000;
|
210 |
168 |
lampret |
endcase
|
211 |
203 |
lampret |
`ifdef SYS_FULL_DECODE
|
212 |
|
|
else
|
213 |
|
|
spr_dat_o = 32'h0000_0000;
|
214 |
|
|
`endif
|
215 |
168 |
lampret |
|
216 |
|
|
`endif
|
217 |
|
|
|
218 |
|
|
endmodule
|