1 |
80 |
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 |
|
|
// openMSP430 testbench
|
29 |
|
|
//
|
30 |
|
|
// *Author(s):
|
31 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
32 |
|
|
//
|
33 |
|
|
//----------------------------------------------------------------------------
|
34 |
|
|
// $Rev: 37 $
|
35 |
|
|
// $LastChangedBy: olivier.girard $
|
36 |
|
|
// $LastChangedDate: 2009-12-29 21:58:14 +0100 (Tue, 29 Dec 2009) $
|
37 |
|
|
//----------------------------------------------------------------------------
|
38 |
|
|
|
39 |
|
|
// CPU registers
|
40 |
|
|
//======================
|
41 |
|
|
|
42 |
|
|
wire [15:0] r0 = dut.openMSP430_0.execution_unit_0.register_file_0.r0;
|
43 |
|
|
wire [15:0] r1 = dut.openMSP430_0.execution_unit_0.register_file_0.r1;
|
44 |
|
|
wire [15:0] r2 = dut.openMSP430_0.execution_unit_0.register_file_0.r2;
|
45 |
|
|
wire [15:0] r3 = dut.openMSP430_0.execution_unit_0.register_file_0.r3;
|
46 |
|
|
wire [15:0] r4 = dut.openMSP430_0.execution_unit_0.register_file_0.r4;
|
47 |
|
|
wire [15:0] r5 = dut.openMSP430_0.execution_unit_0.register_file_0.r5;
|
48 |
|
|
wire [15:0] r6 = dut.openMSP430_0.execution_unit_0.register_file_0.r6;
|
49 |
|
|
wire [15:0] r7 = dut.openMSP430_0.execution_unit_0.register_file_0.r7;
|
50 |
|
|
wire [15:0] r8 = dut.openMSP430_0.execution_unit_0.register_file_0.r8;
|
51 |
|
|
wire [15:0] r9 = dut.openMSP430_0.execution_unit_0.register_file_0.r9;
|
52 |
|
|
wire [15:0] r10 = dut.openMSP430_0.execution_unit_0.register_file_0.r10;
|
53 |
|
|
wire [15:0] r11 = dut.openMSP430_0.execution_unit_0.register_file_0.r11;
|
54 |
|
|
wire [15:0] r12 = dut.openMSP430_0.execution_unit_0.register_file_0.r12;
|
55 |
|
|
wire [15:0] r13 = dut.openMSP430_0.execution_unit_0.register_file_0.r13;
|
56 |
|
|
wire [15:0] r14 = dut.openMSP430_0.execution_unit_0.register_file_0.r14;
|
57 |
|
|
wire [15:0] r15 = dut.openMSP430_0.execution_unit_0.register_file_0.r15;
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
// Data Memory cells
|
61 |
|
|
//======================
|
62 |
|
|
|
63 |
|
|
wire [15:0] mem200 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[0], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[0]};
|
64 |
|
|
wire [15:0] mem202 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[1], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[1]};
|
65 |
|
|
wire [15:0] mem204 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[2], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[2]};
|
66 |
|
|
wire [15:0] mem206 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[3], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[3]};
|
67 |
|
|
wire [15:0] mem208 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[4], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[4]};
|
68 |
|
|
wire [15:0] mem20A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[5], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[5]};
|
69 |
|
|
wire [15:0] mem20C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[6], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[6]};
|
70 |
|
|
wire [15:0] mem20E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[7], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[7]};
|
71 |
|
|
wire [15:0] mem210 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[8], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[8]};
|
72 |
|
|
wire [15:0] mem212 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[9], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[9]};
|
73 |
|
|
wire [15:0] mem214 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[10], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[10]};
|
74 |
|
|
wire [15:0] mem216 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[11], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[11]};
|
75 |
|
|
wire [15:0] mem218 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[12], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[12]};
|
76 |
|
|
wire [15:0] mem21A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[13], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[13]};
|
77 |
|
|
wire [15:0] mem21C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[14], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[14]};
|
78 |
|
|
wire [15:0] mem21E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[15], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[15]};
|
79 |
|
|
wire [15:0] mem220 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[16], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[16]};
|
80 |
|
|
wire [15:0] mem222 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[17], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[17]};
|
81 |
|
|
wire [15:0] mem224 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[18], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[18]};
|
82 |
|
|
wire [15:0] mem226 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[19], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[19]};
|
83 |
|
|
wire [15:0] mem228 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[20], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[20]};
|
84 |
|
|
wire [15:0] mem22A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[21], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[21]};
|
85 |
|
|
wire [15:0] mem22C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[22], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[22]};
|
86 |
|
|
wire [15:0] mem22E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[23], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[23]};
|
87 |
|
|
wire [15:0] mem230 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[24], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[24]};
|
88 |
|
|
wire [15:0] mem232 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[25], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[25]};
|
89 |
|
|
wire [15:0] mem234 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[26], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[26]};
|
90 |
|
|
wire [15:0] mem236 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[27], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[27]};
|
91 |
|
|
wire [15:0] mem238 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[28], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[28]};
|
92 |
|
|
wire [15:0] mem23A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[29], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[29]};
|
93 |
|
|
wire [15:0] mem23C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[30], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[30]};
|
94 |
|
|
wire [15:0] mem23E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[31], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[31]};
|
95 |
|
|
wire [15:0] mem240 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[32], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[32]};
|
96 |
|
|
wire [15:0] mem242 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[33], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[33]};
|
97 |
|
|
wire [15:0] mem244 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[34], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[34]};
|
98 |
|
|
wire [15:0] mem246 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[35], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[35]};
|
99 |
|
|
wire [15:0] mem248 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[36], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[36]};
|
100 |
|
|
wire [15:0] mem24A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[37], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[37]};
|
101 |
|
|
wire [15:0] mem24C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[38], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[38]};
|
102 |
|
|
wire [15:0] mem24E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[39], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[39]};
|
103 |
|
|
wire [15:0] mem250 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[40], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[40]};
|
104 |
|
|
wire [15:0] mem252 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[41], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[41]};
|
105 |
|
|
wire [15:0] mem254 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[42], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[42]};
|
106 |
|
|
wire [15:0] mem256 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[43], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[43]};
|
107 |
|
|
wire [15:0] mem258 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[44], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[44]};
|
108 |
|
|
wire [15:0] mem25A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[45], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[45]};
|
109 |
|
|
wire [15:0] mem25C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[46], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[46]};
|
110 |
|
|
wire [15:0] mem25E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[47], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[47]};
|
111 |
|
|
wire [15:0] mem260 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[48], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[48]};
|
112 |
|
|
wire [15:0] mem262 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[49], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[49]};
|
113 |
|
|
wire [15:0] mem264 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[50], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[50]};
|
114 |
|
|
wire [15:0] mem266 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[51], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[51]};
|
115 |
|
|
wire [15:0] mem268 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[52], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[52]};
|
116 |
|
|
wire [15:0] mem26A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[53], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[53]};
|
117 |
|
|
wire [15:0] mem26C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[54], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[54]};
|
118 |
|
|
wire [15:0] mem26E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[55], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[55]};
|
119 |
|
|
wire [15:0] mem270 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[56], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[56]};
|
120 |
|
|
wire [15:0] mem272 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[57], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[57]};
|
121 |
|
|
wire [15:0] mem274 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[58], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[58]};
|
122 |
|
|
wire [15:0] mem276 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[59], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[59]};
|
123 |
|
|
wire [15:0] mem278 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[60], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[60]};
|
124 |
|
|
wire [15:0] mem27A = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[61], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[61]};
|
125 |
|
|
wire [15:0] mem27C = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[62], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[62]};
|
126 |
|
|
wire [15:0] mem27E = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[63], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[63]};
|
127 |
|
|
wire [15:0] mem280 = {dut.pmem_hi.pmem_2kB_R0C0.MEM_512_9[64], dut.pmem_lo.pmem_2kB_R0C0.MEM_512_9[64]};
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
// Program Memory cells
|
131 |
|
|
//======================
|
132 |
|
|
reg [15:0] pmem [2047:0];
|
133 |
|
|
|
134 |
|
|
// Interrupt vectors
|
135 |
|
|
wire [15:0] irq_vect_15 = pmem[(1<<(`PMEM_MSB+1))-1]; // RESET Vector
|
136 |
|
|
wire [15:0] irq_vect_14 = pmem[(1<<(`PMEM_MSB+1))-2]; // NMI
|
137 |
|
|
wire [15:0] irq_vect_13 = pmem[(1<<(`PMEM_MSB+1))-3]; // IRQ 13
|
138 |
|
|
wire [15:0] irq_vect_12 = pmem[(1<<(`PMEM_MSB+1))-4]; // IRQ 12
|
139 |
|
|
wire [15:0] irq_vect_11 = pmem[(1<<(`PMEM_MSB+1))-5]; // IRQ 11
|
140 |
|
|
wire [15:0] irq_vect_10 = pmem[(1<<(`PMEM_MSB+1))-6]; // IRQ 10
|
141 |
|
|
wire [15:0] irq_vect_09 = pmem[(1<<(`PMEM_MSB+1))-7]; // IRQ 9
|
142 |
|
|
wire [15:0] irq_vect_08 = pmem[(1<<(`PMEM_MSB+1))-8]; // IRQ 8
|
143 |
|
|
wire [15:0] irq_vect_07 = pmem[(1<<(`PMEM_MSB+1))-9]; // IRQ 7
|
144 |
|
|
wire [15:0] irq_vect_06 = pmem[(1<<(`PMEM_MSB+1))-10]; // IRQ 6
|
145 |
|
|
wire [15:0] irq_vect_05 = pmem[(1<<(`PMEM_MSB+1))-11]; // IRQ 5
|
146 |
|
|
wire [15:0] irq_vect_04 = pmem[(1<<(`PMEM_MSB+1))-12]; // IRQ 4
|
147 |
|
|
wire [15:0] irq_vect_03 = pmem[(1<<(`PMEM_MSB+1))-13]; // IRQ 3
|
148 |
|
|
wire [15:0] irq_vect_02 = pmem[(1<<(`PMEM_MSB+1))-14]; // IRQ 2
|
149 |
|
|
wire [15:0] irq_vect_01 = pmem[(1<<(`PMEM_MSB+1))-15]; // IRQ 1
|
150 |
|
|
wire [15:0] irq_vect_00 = pmem[(1<<(`PMEM_MSB+1))-16]; // IRQ 0
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
// CPU internals
|
154 |
|
|
//======================
|
155 |
|
|
|
156 |
|
|
wire mclk = dut.openMSP430_0.mclk;
|
157 |
|
|
wire puc = dut.openMSP430_0.puc;
|