1 |
2 |
olivier.gi |
//----------------------------------------------------------------------------
|
2 |
|
|
// Copyright (C) 2001 Authors
|
3 |
|
|
//
|
4 |
|
|
// This source file may be used and distributed without restriction provided
|
5 |
|
|
// that this copyright statement is not removed from the file and that any
|
6 |
|
|
// derivative work contains the original copyright notice and the associated
|
7 |
|
|
// disclaimer.
|
8 |
|
|
//
|
9 |
|
|
// This source file is free software; you can redistribute it and/or modify
|
10 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
11 |
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
12 |
|
|
// (at your option) any later version.
|
13 |
|
|
//
|
14 |
|
|
// This source is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
17 |
|
|
// License for more details.
|
18 |
|
|
//
|
19 |
|
|
// You should have received a copy of the GNU Lesser General Public License
|
20 |
|
|
// along with this source; if not, write to the Free Software Foundation,
|
21 |
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22 |
|
|
//
|
23 |
|
|
//----------------------------------------------------------------------------
|
24 |
|
|
//
|
25 |
|
|
// *File Name: registers.v
|
26 |
|
|
//
|
27 |
|
|
// *Module Description:
|
28 |
|
|
// Direct connections to internal registers & memory.
|
29 |
|
|
//
|
30 |
|
|
//
|
31 |
|
|
// *Author(s):
|
32 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
33 |
|
|
//
|
34 |
|
|
//----------------------------------------------------------------------------
|
35 |
17 |
olivier.gi |
// $Rev: 145 $
|
36 |
|
|
// $LastChangedBy: olivier.girard $
|
37 |
|
|
// $LastChangedDate: 2012-05-30 23:03:05 +0200 (Wed, 30 May 2012) $
|
38 |
|
|
//----------------------------------------------------------------------------
|
39 |
2 |
olivier.gi |
|
40 |
|
|
// CPU registers
|
41 |
|
|
//======================
|
42 |
|
|
|
43 |
|
|
wire [15:0] r0 = dut.execution_unit_0.register_file_0.r0;
|
44 |
|
|
wire [15:0] r1 = dut.execution_unit_0.register_file_0.r1;
|
45 |
|
|
wire [15:0] r2 = dut.execution_unit_0.register_file_0.r2;
|
46 |
|
|
wire [15:0] r3 = dut.execution_unit_0.register_file_0.r3;
|
47 |
|
|
wire [15:0] r4 = dut.execution_unit_0.register_file_0.r4;
|
48 |
|
|
wire [15:0] r5 = dut.execution_unit_0.register_file_0.r5;
|
49 |
|
|
wire [15:0] r6 = dut.execution_unit_0.register_file_0.r6;
|
50 |
|
|
wire [15:0] r7 = dut.execution_unit_0.register_file_0.r7;
|
51 |
|
|
wire [15:0] r8 = dut.execution_unit_0.register_file_0.r8;
|
52 |
|
|
wire [15:0] r9 = dut.execution_unit_0.register_file_0.r9;
|
53 |
|
|
wire [15:0] r10 = dut.execution_unit_0.register_file_0.r10;
|
54 |
|
|
wire [15:0] r11 = dut.execution_unit_0.register_file_0.r11;
|
55 |
|
|
wire [15:0] r12 = dut.execution_unit_0.register_file_0.r12;
|
56 |
|
|
wire [15:0] r13 = dut.execution_unit_0.register_file_0.r13;
|
57 |
|
|
wire [15:0] r14 = dut.execution_unit_0.register_file_0.r14;
|
58 |
|
|
wire [15:0] r15 = dut.execution_unit_0.register_file_0.r15;
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
// RAM cells
|
62 |
|
|
//======================
|
63 |
|
|
|
64 |
33 |
olivier.gi |
wire [15:0] mem200 = dmem_0.mem[0];
|
65 |
|
|
wire [15:0] mem202 = dmem_0.mem[1];
|
66 |
|
|
wire [15:0] mem204 = dmem_0.mem[2];
|
67 |
|
|
wire [15:0] mem206 = dmem_0.mem[3];
|
68 |
|
|
wire [15:0] mem208 = dmem_0.mem[4];
|
69 |
|
|
wire [15:0] mem20A = dmem_0.mem[5];
|
70 |
|
|
wire [15:0] mem20C = dmem_0.mem[6];
|
71 |
|
|
wire [15:0] mem20E = dmem_0.mem[7];
|
72 |
|
|
wire [15:0] mem210 = dmem_0.mem[8];
|
73 |
|
|
wire [15:0] mem212 = dmem_0.mem[9];
|
74 |
|
|
wire [15:0] mem214 = dmem_0.mem[10];
|
75 |
|
|
wire [15:0] mem216 = dmem_0.mem[11];
|
76 |
|
|
wire [15:0] mem218 = dmem_0.mem[12];
|
77 |
|
|
wire [15:0] mem21A = dmem_0.mem[13];
|
78 |
|
|
wire [15:0] mem21C = dmem_0.mem[14];
|
79 |
|
|
wire [15:0] mem21E = dmem_0.mem[15];
|
80 |
|
|
wire [15:0] mem220 = dmem_0.mem[16];
|
81 |
|
|
wire [15:0] mem222 = dmem_0.mem[17];
|
82 |
|
|
wire [15:0] mem224 = dmem_0.mem[18];
|
83 |
|
|
wire [15:0] mem226 = dmem_0.mem[19];
|
84 |
|
|
wire [15:0] mem228 = dmem_0.mem[20];
|
85 |
|
|
wire [15:0] mem22A = dmem_0.mem[21];
|
86 |
|
|
wire [15:0] mem22C = dmem_0.mem[22];
|
87 |
|
|
wire [15:0] mem22E = dmem_0.mem[23];
|
88 |
|
|
wire [15:0] mem230 = dmem_0.mem[24];
|
89 |
|
|
wire [15:0] mem232 = dmem_0.mem[25];
|
90 |
|
|
wire [15:0] mem234 = dmem_0.mem[26];
|
91 |
|
|
wire [15:0] mem236 = dmem_0.mem[27];
|
92 |
|
|
wire [15:0] mem238 = dmem_0.mem[28];
|
93 |
|
|
wire [15:0] mem23A = dmem_0.mem[29];
|
94 |
|
|
wire [15:0] mem23C = dmem_0.mem[30];
|
95 |
|
|
wire [15:0] mem23E = dmem_0.mem[31];
|
96 |
|
|
wire [15:0] mem240 = dmem_0.mem[32];
|
97 |
|
|
wire [15:0] mem242 = dmem_0.mem[33];
|
98 |
|
|
wire [15:0] mem244 = dmem_0.mem[34];
|
99 |
|
|
wire [15:0] mem246 = dmem_0.mem[35];
|
100 |
|
|
wire [15:0] mem248 = dmem_0.mem[36];
|
101 |
|
|
wire [15:0] mem24A = dmem_0.mem[37];
|
102 |
|
|
wire [15:0] mem24C = dmem_0.mem[38];
|
103 |
|
|
wire [15:0] mem24E = dmem_0.mem[39];
|
104 |
|
|
wire [15:0] mem250 = dmem_0.mem[40];
|
105 |
|
|
wire [15:0] mem252 = dmem_0.mem[41];
|
106 |
|
|
wire [15:0] mem254 = dmem_0.mem[42];
|
107 |
|
|
wire [15:0] mem256 = dmem_0.mem[43];
|
108 |
|
|
wire [15:0] mem258 = dmem_0.mem[44];
|
109 |
|
|
wire [15:0] mem25A = dmem_0.mem[45];
|
110 |
|
|
wire [15:0] mem25C = dmem_0.mem[46];
|
111 |
|
|
wire [15:0] mem25E = dmem_0.mem[47];
|
112 |
|
|
wire [15:0] mem260 = dmem_0.mem[48];
|
113 |
|
|
wire [15:0] mem262 = dmem_0.mem[49];
|
114 |
|
|
wire [15:0] mem264 = dmem_0.mem[50];
|
115 |
|
|
wire [15:0] mem266 = dmem_0.mem[51];
|
116 |
|
|
wire [15:0] mem268 = dmem_0.mem[52];
|
117 |
|
|
wire [15:0] mem26A = dmem_0.mem[53];
|
118 |
|
|
wire [15:0] mem26C = dmem_0.mem[54];
|
119 |
|
|
wire [15:0] mem26E = dmem_0.mem[55];
|
120 |
|
|
wire [15:0] mem270 = dmem_0.mem[56];
|
121 |
|
|
wire [15:0] mem272 = dmem_0.mem[57];
|
122 |
|
|
wire [15:0] mem274 = dmem_0.mem[58];
|
123 |
|
|
wire [15:0] mem276 = dmem_0.mem[59];
|
124 |
|
|
wire [15:0] mem278 = dmem_0.mem[60];
|
125 |
|
|
wire [15:0] mem27A = dmem_0.mem[61];
|
126 |
|
|
wire [15:0] mem27C = dmem_0.mem[62];
|
127 |
|
|
wire [15:0] mem27E = dmem_0.mem[63];
|
128 |
2 |
olivier.gi |
|
129 |
|
|
|
130 |
|
|
// Interrupt vectors
|
131 |
|
|
//======================
|
132 |
|
|
|
133 |
145 |
olivier.gi |
wire [15:0] irq_vect_15 = pmem_0.mem[(`PMEM_SIZE>>1)-1]; // RESET Vector
|
134 |
|
|
wire [15:0] irq_vect_14 = pmem_0.mem[(`PMEM_SIZE>>1)-2]; // NMI
|
135 |
|
|
wire [15:0] irq_vect_13 = pmem_0.mem[(`PMEM_SIZE>>1)-3]; // IRQ 13
|
136 |
|
|
wire [15:0] irq_vect_12 = pmem_0.mem[(`PMEM_SIZE>>1)-4]; // IRQ 12
|
137 |
|
|
wire [15:0] irq_vect_11 = pmem_0.mem[(`PMEM_SIZE>>1)-5]; // IRQ 11
|
138 |
|
|
wire [15:0] irq_vect_10 = pmem_0.mem[(`PMEM_SIZE>>1)-6]; // IRQ 10
|
139 |
|
|
wire [15:0] irq_vect_09 = pmem_0.mem[(`PMEM_SIZE>>1)-7]; // IRQ 9
|
140 |
|
|
wire [15:0] irq_vect_08 = pmem_0.mem[(`PMEM_SIZE>>1)-8]; // IRQ 8
|
141 |
|
|
wire [15:0] irq_vect_07 = pmem_0.mem[(`PMEM_SIZE>>1)-9]; // IRQ 7
|
142 |
|
|
wire [15:0] irq_vect_06 = pmem_0.mem[(`PMEM_SIZE>>1)-10]; // IRQ 6
|
143 |
|
|
wire [15:0] irq_vect_05 = pmem_0.mem[(`PMEM_SIZE>>1)-11]; // IRQ 5
|
144 |
|
|
wire [15:0] irq_vect_04 = pmem_0.mem[(`PMEM_SIZE>>1)-12]; // IRQ 4
|
145 |
|
|
wire [15:0] irq_vect_03 = pmem_0.mem[(`PMEM_SIZE>>1)-13]; // IRQ 3
|
146 |
|
|
wire [15:0] irq_vect_02 = pmem_0.mem[(`PMEM_SIZE>>1)-14]; // IRQ 2
|
147 |
|
|
wire [15:0] irq_vect_01 = pmem_0.mem[(`PMEM_SIZE>>1)-15]; // IRQ 1
|
148 |
|
|
wire [15:0] irq_vect_00 = pmem_0.mem[(`PMEM_SIZE>>1)-16]; // IRQ 0
|
149 |
94 |
olivier.gi |
|
150 |
|
|
// Interrupt detection
|
151 |
134 |
olivier.gi |
wire nmi_detect = dut.frontend_0.nmi_pnd;
|
152 |
|
|
wire irq_detect = dut.frontend_0.irq_detect;
|
153 |
|
|
|
154 |
|
|
// Debug interface
|
155 |
|
|
wire dbg_clk = dut.clock_module_0.dbg_clk;
|
156 |
|
|
wire dbg_rst = dut.clock_module_0.dbg_rst;
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
// CPU ID
|
160 |
|
|
//======================
|
161 |
|
|
|
162 |
|
|
wire [2:0] dbg_cpu_version = `CPU_VERSION;
|
163 |
|
|
`ifdef ASIC
|
164 |
|
|
wire dbg_cpu_asic = 1'b1;
|
165 |
|
|
`else
|
166 |
|
|
wire dbg_cpu_asic = 1'b0;
|
167 |
|
|
`endif
|
168 |
|
|
wire [4:0] dbg_user_version = `USER_VERSION;
|
169 |
|
|
wire [6:0] dbg_per_space = (`PER_SIZE >> 9);
|
170 |
|
|
`ifdef MULTIPLIER
|
171 |
|
|
wire dbg_mpy_info = 1'b1;
|
172 |
|
|
`else
|
173 |
|
|
wire dbg_mpy_info = 1'b0;
|
174 |
|
|
`endif
|
175 |
|
|
wire [8:0] dbg_dmem_size = (`DMEM_SIZE >> 7);
|
176 |
|
|
wire [5:0] dbg_pmem_size = (`PMEM_SIZE >> 10);
|
177 |
|
|
|
178 |
|
|
wire [31:0] dbg_cpu_id = {dbg_pmem_size,
|
179 |
|
|
dbg_dmem_size,
|
180 |
|
|
dbg_mpy_info,
|
181 |
|
|
dbg_per_space,
|
182 |
|
|
dbg_user_version,
|
183 |
|
|
dbg_cpu_asic,
|
184 |
|
|
dbg_cpu_version};
|