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 |
34 |
olivier.gi |
// *File Name: omsp_gpio.v
|
26 |
2 |
olivier.gi |
//
|
27 |
|
|
// *Module Description:
|
28 |
|
|
// Digital I/O interface
|
29 |
|
|
//
|
30 |
|
|
// *Author(s):
|
31 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
32 |
|
|
//
|
33 |
|
|
//----------------------------------------------------------------------------
|
34 |
17 |
olivier.gi |
// $Rev: 34 $
|
35 |
|
|
// $LastChangedBy: olivier.girard $
|
36 |
|
|
// $LastChangedDate: 2009-12-29 20:10:34 +0100 (Tue, 29 Dec 2009) $
|
37 |
|
|
//----------------------------------------------------------------------------
|
38 |
23 |
olivier.gi |
`include "timescale.v"
|
39 |
|
|
`include "openMSP430_defines.v"
|
40 |
2 |
olivier.gi |
|
41 |
34 |
olivier.gi |
module omsp_gpio (
|
42 |
2 |
olivier.gi |
|
43 |
|
|
// OUTPUTs
|
44 |
|
|
irq_port1, // Port 1 interrupt
|
45 |
|
|
irq_port2, // Port 2 interrupt
|
46 |
|
|
p1_dout, // Port 1 data output
|
47 |
|
|
p1_dout_en, // Port 1 data output enable
|
48 |
|
|
p1_sel, // Port 1 function select
|
49 |
|
|
p2_dout, // Port 2 data output
|
50 |
|
|
p2_dout_en, // Port 2 data output enable
|
51 |
|
|
p2_sel, // Port 2 function select
|
52 |
|
|
p3_dout, // Port 3 data output
|
53 |
|
|
p3_dout_en, // Port 3 data output enable
|
54 |
|
|
p3_sel, // Port 3 function select
|
55 |
|
|
p4_dout, // Port 4 data output
|
56 |
|
|
p4_dout_en, // Port 4 data output enable
|
57 |
|
|
p4_sel, // Port 4 function select
|
58 |
|
|
p5_dout, // Port 5 data output
|
59 |
|
|
p5_dout_en, // Port 5 data output enable
|
60 |
|
|
p5_sel, // Port 5 function select
|
61 |
|
|
p6_dout, // Port 6 data output
|
62 |
|
|
p6_dout_en, // Port 6 data output enable
|
63 |
|
|
p6_sel, // Port 6 function select
|
64 |
|
|
per_dout, // Peripheral data output
|
65 |
|
|
|
66 |
|
|
// INPUTs
|
67 |
|
|
mclk, // Main system clock
|
68 |
|
|
p1_din, // Port 1 data input
|
69 |
|
|
p2_din, // Port 2 data input
|
70 |
|
|
p3_din, // Port 3 data input
|
71 |
|
|
p4_din, // Port 4 data input
|
72 |
|
|
p5_din, // Port 5 data input
|
73 |
|
|
p6_din, // Port 6 data input
|
74 |
|
|
per_addr, // Peripheral address
|
75 |
|
|
per_din, // Peripheral data input
|
76 |
|
|
per_en, // Peripheral enable (high active)
|
77 |
|
|
per_wen, // Peripheral write enable (high active)
|
78 |
|
|
puc // Main system reset
|
79 |
|
|
);
|
80 |
|
|
|
81 |
|
|
// PARAMETERs
|
82 |
|
|
//============
|
83 |
|
|
parameter P1_EN = 1'b1; // Enable Port 1
|
84 |
|
|
parameter P2_EN = 1'b1; // Enable Port 2
|
85 |
|
|
parameter P3_EN = 1'b0; // Enable Port 3
|
86 |
|
|
parameter P4_EN = 1'b0; // Enable Port 4
|
87 |
|
|
parameter P5_EN = 1'b0; // Enable Port 5
|
88 |
|
|
parameter P6_EN = 1'b0; // Enable Port 6
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
// OUTPUTs
|
92 |
|
|
//=========
|
93 |
|
|
output irq_port1; // Port 1 interrupt
|
94 |
|
|
output irq_port2; // Port 2 interrupt
|
95 |
|
|
output [7:0] p1_dout; // Port 1 data output
|
96 |
|
|
output [7:0] p1_dout_en; // Port 1 data output enable
|
97 |
|
|
output [7:0] p1_sel; // Port 1 function select
|
98 |
|
|
output [7:0] p2_dout; // Port 2 data output
|
99 |
|
|
output [7:0] p2_dout_en; // Port 2 data output enable
|
100 |
|
|
output [7:0] p2_sel; // Port 2 function select
|
101 |
|
|
output [7:0] p3_dout; // Port 3 data output
|
102 |
|
|
output [7:0] p3_dout_en; // Port 3 data output enable
|
103 |
|
|
output [7:0] p3_sel; // Port 3 function select
|
104 |
|
|
output [7:0] p4_dout; // Port 4 data output
|
105 |
|
|
output [7:0] p4_dout_en; // Port 4 data output enable
|
106 |
|
|
output [7:0] p4_sel; // Port 4 function select
|
107 |
|
|
output [7:0] p5_dout; // Port 5 data output
|
108 |
|
|
output [7:0] p5_dout_en; // Port 5 data output enable
|
109 |
|
|
output [7:0] p5_sel; // Port 5 function select
|
110 |
|
|
output [7:0] p6_dout; // Port 6 data output
|
111 |
|
|
output [7:0] p6_dout_en; // Port 6 data output enable
|
112 |
|
|
output [7:0] p6_sel; // Port 6 function select
|
113 |
|
|
output [15:0] per_dout; // Peripheral data output
|
114 |
|
|
|
115 |
|
|
// INPUTs
|
116 |
|
|
//=========
|
117 |
|
|
input mclk; // Main system clock
|
118 |
|
|
input [7:0] p1_din; // Port 1 data input
|
119 |
|
|
input [7:0] p2_din; // Port 2 data input
|
120 |
|
|
input [7:0] p3_din; // Port 3 data input
|
121 |
|
|
input [7:0] p4_din; // Port 4 data input
|
122 |
|
|
input [7:0] p5_din; // Port 5 data input
|
123 |
|
|
input [7:0] p6_din; // Port 6 data input
|
124 |
|
|
input [7:0] per_addr; // Peripheral address
|
125 |
|
|
input [15:0] per_din; // Peripheral data input
|
126 |
|
|
input per_en; // Peripheral enable (high active)
|
127 |
|
|
input [1:0] per_wen; // Peripheral write enable (high active)
|
128 |
|
|
input puc; // Main system reset
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
//=============================================================================
|
132 |
|
|
// 1) PARAMETER DECLARATION
|
133 |
|
|
//=============================================================================
|
134 |
|
|
|
135 |
|
|
// Masks
|
136 |
|
|
parameter P1_EN_MSK = {8{P1_EN[0]}};
|
137 |
|
|
parameter P2_EN_MSK = {8{P2_EN[0]}};
|
138 |
|
|
parameter P3_EN_MSK = {8{P3_EN[0]}};
|
139 |
|
|
parameter P4_EN_MSK = {8{P4_EN[0]}};
|
140 |
|
|
parameter P5_EN_MSK = {8{P5_EN[0]}};
|
141 |
|
|
parameter P6_EN_MSK = {8{P6_EN[0]}};
|
142 |
|
|
|
143 |
|
|
// Register addresses
|
144 |
|
|
parameter P1IN = 9'h020; // Port 1
|
145 |
|
|
parameter P1OUT = 9'h021;
|
146 |
|
|
parameter P1DIR = 9'h022;
|
147 |
|
|
parameter P1IFG = 9'h023;
|
148 |
|
|
parameter P1IES = 9'h024;
|
149 |
|
|
parameter P1IE = 9'h025;
|
150 |
|
|
parameter P1SEL = 9'h026;
|
151 |
|
|
parameter P2IN = 9'h028; // Port 2
|
152 |
|
|
parameter P2OUT = 9'h029;
|
153 |
|
|
parameter P2DIR = 9'h02A;
|
154 |
|
|
parameter P2IFG = 9'h02B;
|
155 |
|
|
parameter P2IES = 9'h02C;
|
156 |
|
|
parameter P2IE = 9'h02D;
|
157 |
|
|
parameter P2SEL = 9'h02E;
|
158 |
|
|
parameter P3IN = 9'h018; // Port 3
|
159 |
|
|
parameter P3OUT = 9'h019;
|
160 |
|
|
parameter P3DIR = 9'h01A;
|
161 |
|
|
parameter P3SEL = 9'h01B;
|
162 |
|
|
parameter P4IN = 9'h01C; // Port 4
|
163 |
|
|
parameter P4OUT = 9'h01D;
|
164 |
|
|
parameter P4DIR = 9'h01E;
|
165 |
|
|
parameter P4SEL = 9'h01F;
|
166 |
|
|
parameter P5IN = 9'h030; // Port 5
|
167 |
|
|
parameter P5OUT = 9'h031;
|
168 |
|
|
parameter P5DIR = 9'h032;
|
169 |
|
|
parameter P5SEL = 9'h033;
|
170 |
|
|
parameter P6IN = 9'h034; // Port 6
|
171 |
|
|
parameter P6OUT = 9'h035;
|
172 |
|
|
parameter P6DIR = 9'h036;
|
173 |
|
|
parameter P6SEL = 9'h037;
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
// Register one-hot decoder
|
177 |
|
|
parameter P1IN_D = (256'h1 << (P1IN /2)); // Port 1
|
178 |
|
|
parameter P1OUT_D = (256'h1 << (P1OUT /2));
|
179 |
|
|
parameter P1DIR_D = (256'h1 << (P1DIR /2));
|
180 |
|
|
parameter P1IFG_D = (256'h1 << (P1IFG /2));
|
181 |
|
|
parameter P1IES_D = (256'h1 << (P1IES /2));
|
182 |
|
|
parameter P1IE_D = (256'h1 << (P1IE /2));
|
183 |
|
|
parameter P1SEL_D = (256'h1 << (P1SEL /2));
|
184 |
|
|
parameter P2IN_D = (256'h1 << (P2IN /2)); // Port 2
|
185 |
|
|
parameter P2OUT_D = (256'h1 << (P2OUT /2));
|
186 |
|
|
parameter P2DIR_D = (256'h1 << (P2DIR /2));
|
187 |
|
|
parameter P2IFG_D = (256'h1 << (P2IFG /2));
|
188 |
|
|
parameter P2IES_D = (256'h1 << (P2IES /2));
|
189 |
|
|
parameter P2IE_D = (256'h1 << (P2IE /2));
|
190 |
|
|
parameter P2SEL_D = (256'h1 << (P2SEL /2));
|
191 |
|
|
parameter P3IN_D = (256'h1 << (P3IN /2)); // Port 3
|
192 |
|
|
parameter P3OUT_D = (256'h1 << (P3OUT /2));
|
193 |
|
|
parameter P3DIR_D = (256'h1 << (P3DIR /2));
|
194 |
|
|
parameter P3SEL_D = (256'h1 << (P3SEL /2));
|
195 |
|
|
parameter P4IN_D = (256'h1 << (P4IN /2)); // Port 4
|
196 |
|
|
parameter P4OUT_D = (256'h1 << (P4OUT /2));
|
197 |
|
|
parameter P4DIR_D = (256'h1 << (P4DIR /2));
|
198 |
|
|
parameter P4SEL_D = (256'h1 << (P4SEL /2));
|
199 |
|
|
parameter P5IN_D = (256'h1 << (P5IN /2)); // Port 5
|
200 |
|
|
parameter P5OUT_D = (256'h1 << (P5OUT /2));
|
201 |
|
|
parameter P5DIR_D = (256'h1 << (P5DIR /2));
|
202 |
|
|
parameter P5SEL_D = (256'h1 << (P5SEL /2));
|
203 |
|
|
parameter P6IN_D = (256'h1 << (P6IN /2)); // Port 6
|
204 |
|
|
parameter P6OUT_D = (256'h1 << (P6OUT /2));
|
205 |
|
|
parameter P6DIR_D = (256'h1 << (P6DIR /2));
|
206 |
|
|
parameter P6SEL_D = (256'h1 << (P6SEL /2));
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
//============================================================================
|
210 |
|
|
// 2) REGISTER DECODER
|
211 |
|
|
//============================================================================
|
212 |
|
|
|
213 |
|
|
// Register address decode
|
214 |
|
|
reg [255:0] reg_dec;
|
215 |
|
|
always @(per_addr)
|
216 |
|
|
case (per_addr)
|
217 |
|
|
(P1IN /2): reg_dec = P1IN_D & {256{P1_EN[0]}};
|
218 |
|
|
(P1OUT /2): reg_dec = P1OUT_D & {256{P1_EN[0]}};
|
219 |
|
|
(P1DIR /2): reg_dec = P1DIR_D & {256{P1_EN[0]}};
|
220 |
|
|
(P1IFG /2): reg_dec = P1IFG_D & {256{P1_EN[0]}};
|
221 |
|
|
(P1IES /2): reg_dec = P1IES_D & {256{P1_EN[0]}};
|
222 |
|
|
(P1IE /2): reg_dec = P1IE_D & {256{P1_EN[0]}};
|
223 |
|
|
(P1SEL /2): reg_dec = P1SEL_D & {256{P1_EN[0]}};
|
224 |
|
|
(P2IN /2): reg_dec = P2IN_D & {256{P2_EN[0]}};
|
225 |
|
|
(P2OUT /2): reg_dec = P2OUT_D & {256{P2_EN[0]}};
|
226 |
|
|
(P2DIR /2): reg_dec = P2DIR_D & {256{P2_EN[0]}};
|
227 |
|
|
(P2IFG /2): reg_dec = P2IFG_D & {256{P2_EN[0]}};
|
228 |
|
|
(P2IES /2): reg_dec = P2IES_D & {256{P2_EN[0]}};
|
229 |
|
|
(P2IE /2): reg_dec = P2IE_D & {256{P2_EN[0]}};
|
230 |
|
|
(P2SEL /2): reg_dec = P2SEL_D & {256{P2_EN[0]}};
|
231 |
|
|
(P3IN /2): reg_dec = P3IN_D & {256{P3_EN[0]}};
|
232 |
|
|
(P3OUT /2): reg_dec = P3OUT_D & {256{P3_EN[0]}};
|
233 |
|
|
(P3DIR /2): reg_dec = P3DIR_D & {256{P3_EN[0]}};
|
234 |
|
|
(P3SEL /2): reg_dec = P3SEL_D & {256{P3_EN[0]}};
|
235 |
|
|
(P4IN /2): reg_dec = P4IN_D & {256{P4_EN[0]}};
|
236 |
|
|
(P4OUT /2): reg_dec = P4OUT_D & {256{P4_EN[0]}};
|
237 |
|
|
(P4DIR /2): reg_dec = P4DIR_D & {256{P4_EN[0]}};
|
238 |
|
|
(P4SEL /2): reg_dec = P4SEL_D & {256{P4_EN[0]}};
|
239 |
|
|
(P5IN /2): reg_dec = P5IN_D & {256{P5_EN[0]}};
|
240 |
|
|
(P5OUT /2): reg_dec = P5OUT_D & {256{P5_EN[0]}};
|
241 |
|
|
(P5DIR /2): reg_dec = P5DIR_D & {256{P5_EN[0]}};
|
242 |
|
|
(P5SEL /2): reg_dec = P5SEL_D & {256{P5_EN[0]}};
|
243 |
|
|
(P6IN /2): reg_dec = P6IN_D & {256{P6_EN[0]}};
|
244 |
|
|
(P6OUT /2): reg_dec = P6OUT_D & {256{P6_EN[0]}};
|
245 |
|
|
(P6DIR /2): reg_dec = P6DIR_D & {256{P6_EN[0]}};
|
246 |
|
|
(P6SEL /2): reg_dec = P6SEL_D & {256{P6_EN[0]}};
|
247 |
|
|
default : reg_dec = {256{1'b0}};
|
248 |
|
|
endcase
|
249 |
|
|
|
250 |
|
|
// Read/Write probes
|
251 |
|
|
wire reg_lo_write = per_wen[0] & per_en;
|
252 |
|
|
wire reg_hi_write = per_wen[1] & per_en;
|
253 |
|
|
wire reg_read = ~|per_wen & per_en;
|
254 |
|
|
|
255 |
|
|
// Read/Write vectors
|
256 |
|
|
wire [255:0] reg_hi_wr = reg_dec & {256{reg_hi_write}};
|
257 |
|
|
wire [255:0] reg_lo_wr = reg_dec & {256{reg_lo_write}};
|
258 |
|
|
wire [255:0] reg_rd = reg_dec & {256{reg_read}};
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
//============================================================================
|
262 |
|
|
// 3) REGISTERS
|
263 |
|
|
//============================================================================
|
264 |
|
|
|
265 |
|
|
// P1IN Register
|
266 |
|
|
//---------------
|
267 |
|
|
reg [7:0] p1in;
|
268 |
|
|
|
269 |
|
|
always @ (posedge mclk or posedge puc)
|
270 |
|
|
if (puc) p1in <= 8'h00;
|
271 |
|
|
else p1in <= p1_din & P1_EN_MSK;
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
// P1OUT Register
|
275 |
|
|
//----------------
|
276 |
|
|
reg [7:0] p1out;
|
277 |
|
|
|
278 |
|
|
wire p1out_wr = P1OUT[0] ? reg_hi_wr[P1OUT/2] : reg_lo_wr[P1OUT/2];
|
279 |
|
|
wire [7:0] p1out_nxt = P1OUT[0] ? per_din[15:8] : per_din[7:0];
|
280 |
|
|
|
281 |
|
|
always @ (posedge mclk or posedge puc)
|
282 |
|
|
if (puc) p1out <= 8'h00;
|
283 |
|
|
else if (p1out_wr) p1out <= p1out_nxt & P1_EN_MSK;
|
284 |
|
|
|
285 |
|
|
assign p1_dout = p1out;
|
286 |
|
|
|
287 |
|
|
|
288 |
|
|
// P1DIR Register
|
289 |
|
|
//----------------
|
290 |
|
|
reg [7:0] p1dir;
|
291 |
|
|
|
292 |
|
|
wire p1dir_wr = P1DIR[0] ? reg_hi_wr[P1DIR/2] : reg_lo_wr[P1DIR/2];
|
293 |
|
|
wire [7:0] p1dir_nxt = P1DIR[0] ? per_din[15:8] : per_din[7:0];
|
294 |
|
|
|
295 |
|
|
always @ (posedge mclk or posedge puc)
|
296 |
|
|
if (puc) p1dir <= 8'h00;
|
297 |
|
|
else if (p1dir_wr) p1dir <= p1dir_nxt & P1_EN_MSK;
|
298 |
|
|
|
299 |
|
|
assign p1_dout_en = p1dir;
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
// P1IFG Register
|
303 |
|
|
//----------------
|
304 |
|
|
reg [7:0] p1ifg;
|
305 |
|
|
|
306 |
|
|
wire p1ifg_wr = P1IFG[0] ? reg_hi_wr[P1IFG/2] : reg_lo_wr[P1IFG/2];
|
307 |
|
|
wire [7:0] p1ifg_nxt = P1IFG[0] ? per_din[15:8] : per_din[7:0];
|
308 |
|
|
wire [7:0] p1ifg_set;
|
309 |
|
|
|
310 |
|
|
always @ (posedge mclk or posedge puc)
|
311 |
|
|
if (puc) p1ifg <= 8'h00;
|
312 |
|
|
else if (p1ifg_wr) p1ifg <= (p1ifg_nxt | p1ifg_set) & P1_EN_MSK;
|
313 |
|
|
else p1ifg <= (p1ifg | p1ifg_set) & P1_EN_MSK;
|
314 |
|
|
|
315 |
|
|
// P1IES Register
|
316 |
|
|
//----------------
|
317 |
|
|
reg [7:0] p1ies;
|
318 |
|
|
|
319 |
|
|
wire p1ies_wr = P1IES[0] ? reg_hi_wr[P1IES/2] : reg_lo_wr[P1IES/2];
|
320 |
|
|
wire [7:0] p1ies_nxt = P1IES[0] ? per_din[15:8] : per_din[7:0];
|
321 |
|
|
|
322 |
|
|
always @ (posedge mclk or posedge puc)
|
323 |
|
|
if (puc) p1ies <= 8'h00;
|
324 |
|
|
else if (p1ies_wr) p1ies <= p1ies_nxt & P1_EN_MSK;
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
// P1IE Register
|
328 |
|
|
//----------------
|
329 |
|
|
reg [7:0] p1ie;
|
330 |
|
|
|
331 |
|
|
wire p1ie_wr = P1IE[0] ? reg_hi_wr[P1IE/2] : reg_lo_wr[P1IE/2];
|
332 |
|
|
wire [7:0] p1ie_nxt = P1IE[0] ? per_din[15:8] : per_din[7:0];
|
333 |
|
|
|
334 |
|
|
always @ (posedge mclk or posedge puc)
|
335 |
|
|
if (puc) p1ie <= 8'h00;
|
336 |
|
|
else if (p1ie_wr) p1ie <= p1ie_nxt & P1_EN_MSK;
|
337 |
|
|
|
338 |
|
|
|
339 |
|
|
// P1SEL Register
|
340 |
|
|
//----------------
|
341 |
|
|
reg [7:0] p1sel;
|
342 |
|
|
|
343 |
|
|
wire p1sel_wr = P1SEL[0] ? reg_hi_wr[P1SEL/2] : reg_lo_wr[P1SEL/2];
|
344 |
|
|
wire [7:0] p1sel_nxt = P1SEL[0] ? per_din[15:8] : per_din[7:0];
|
345 |
|
|
|
346 |
|
|
always @ (posedge mclk or posedge puc)
|
347 |
|
|
if (puc) p1sel <= 8'h00;
|
348 |
|
|
else if (p1sel_wr) p1sel <= p1sel_nxt & P1_EN_MSK;
|
349 |
|
|
|
350 |
|
|
assign p1_sel = p1sel;
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
// P2IN Register
|
354 |
|
|
//---------------
|
355 |
|
|
reg [7:0] p2in;
|
356 |
|
|
|
357 |
|
|
always @ (posedge mclk or posedge puc)
|
358 |
|
|
if (puc) p2in <= 8'h00;
|
359 |
|
|
else p2in <= p2_din & P2_EN_MSK;
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
// P2OUT Register
|
363 |
|
|
//----------------
|
364 |
|
|
reg [7:0] p2out;
|
365 |
|
|
|
366 |
|
|
wire p2out_wr = P2OUT[0] ? reg_hi_wr[P2OUT/2] : reg_lo_wr[P2OUT/2];
|
367 |
|
|
wire [7:0] p2out_nxt = P2OUT[0] ? per_din[15:8] : per_din[7:0];
|
368 |
|
|
|
369 |
|
|
always @ (posedge mclk or posedge puc)
|
370 |
|
|
if (puc) p2out <= 8'h00;
|
371 |
|
|
else if (p2out_wr) p2out <= p2out_nxt & P2_EN_MSK;
|
372 |
|
|
|
373 |
|
|
assign p2_dout = p2out;
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
// P2DIR Register
|
377 |
|
|
//----------------
|
378 |
|
|
reg [7:0] p2dir;
|
379 |
|
|
|
380 |
|
|
wire p2dir_wr = P2DIR[0] ? reg_hi_wr[P2DIR/2] : reg_lo_wr[P2DIR/2];
|
381 |
|
|
wire [7:0] p2dir_nxt = P2DIR[0] ? per_din[15:8] : per_din[7:0];
|
382 |
|
|
|
383 |
|
|
always @ (posedge mclk or posedge puc)
|
384 |
|
|
if (puc) p2dir <= 8'h00;
|
385 |
|
|
else if (p2dir_wr) p2dir <= p2dir_nxt & P2_EN_MSK;
|
386 |
|
|
|
387 |
|
|
assign p2_dout_en = p2dir;
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
// P2IFG Register
|
391 |
|
|
//----------------
|
392 |
|
|
reg [7:0] p2ifg;
|
393 |
|
|
|
394 |
|
|
wire p2ifg_wr = P2IFG[0] ? reg_hi_wr[P2IFG/2] : reg_lo_wr[P2IFG/2];
|
395 |
|
|
wire [7:0] p2ifg_nxt = P2IFG[0] ? per_din[15:8] : per_din[7:0];
|
396 |
|
|
wire [7:0] p2ifg_set;
|
397 |
|
|
|
398 |
|
|
always @ (posedge mclk or posedge puc)
|
399 |
|
|
if (puc) p2ifg <= 8'h00;
|
400 |
|
|
else if (p2ifg_wr) p2ifg <= (p2ifg_nxt | p2ifg_set) & P2_EN_MSK;
|
401 |
|
|
else p2ifg <= (p2ifg | p2ifg_set) & P2_EN_MSK;
|
402 |
|
|
|
403 |
|
|
|
404 |
|
|
// P2IES Register
|
405 |
|
|
//----------------
|
406 |
|
|
reg [7:0] p2ies;
|
407 |
|
|
|
408 |
|
|
wire p2ies_wr = P2IES[0] ? reg_hi_wr[P2IES/2] : reg_lo_wr[P2IES/2];
|
409 |
|
|
wire [7:0] p2ies_nxt = P2IES[0] ? per_din[15:8] : per_din[7:0];
|
410 |
|
|
|
411 |
|
|
always @ (posedge mclk or posedge puc)
|
412 |
|
|
if (puc) p2ies <= 8'h00;
|
413 |
|
|
else if (p2ies_wr) p2ies <= p2ies_nxt & P2_EN_MSK;
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
// P2IE Register
|
417 |
|
|
//----------------
|
418 |
|
|
reg [7:0] p2ie;
|
419 |
|
|
|
420 |
|
|
wire p2ie_wr = P2IE[0] ? reg_hi_wr[P2IE/2] : reg_lo_wr[P2IE/2];
|
421 |
|
|
wire [7:0] p2ie_nxt = P2IE[0] ? per_din[15:8] : per_din[7:0];
|
422 |
|
|
|
423 |
|
|
always @ (posedge mclk or posedge puc)
|
424 |
|
|
if (puc) p2ie <= 8'h00;
|
425 |
|
|
else if (p2ie_wr) p2ie <= p2ie_nxt & P2_EN_MSK;
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
// P2SEL Register
|
429 |
|
|
//----------------
|
430 |
|
|
reg [7:0] p2sel;
|
431 |
|
|
|
432 |
|
|
wire p2sel_wr = P2SEL[0] ? reg_hi_wr[P2SEL/2] : reg_lo_wr[P2SEL/2];
|
433 |
|
|
wire [7:0] p2sel_nxt = P2SEL[0] ? per_din[15:8] : per_din[7:0];
|
434 |
|
|
|
435 |
|
|
always @ (posedge mclk or posedge puc)
|
436 |
|
|
if (puc) p2sel <= 8'h00;
|
437 |
|
|
else if (p2sel_wr) p2sel <= p2sel_nxt & P2_EN_MSK;
|
438 |
|
|
|
439 |
|
|
assign p2_sel = p2sel;
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
// P3IN Register
|
443 |
|
|
//---------------
|
444 |
|
|
reg [7:0] p3in;
|
445 |
|
|
|
446 |
|
|
always @ (posedge mclk or posedge puc)
|
447 |
|
|
if (puc) p3in <= 8'h00;
|
448 |
|
|
else p3in <= p3_din & P3_EN_MSK;
|
449 |
|
|
|
450 |
|
|
|
451 |
|
|
// P3OUT Register
|
452 |
|
|
//----------------
|
453 |
|
|
reg [7:0] p3out;
|
454 |
|
|
|
455 |
|
|
wire p3out_wr = P3OUT[0] ? reg_hi_wr[P3OUT/2] : reg_lo_wr[P3OUT/2];
|
456 |
|
|
wire [7:0] p3out_nxt = P3OUT[0] ? per_din[15:8] : per_din[7:0];
|
457 |
|
|
|
458 |
|
|
always @ (posedge mclk or posedge puc)
|
459 |
|
|
if (puc) p3out <= 8'h00;
|
460 |
|
|
else if (p3out_wr) p3out <= p3out_nxt & P3_EN_MSK;
|
461 |
|
|
|
462 |
|
|
assign p3_dout = p3out;
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
// P3DIR Register
|
466 |
|
|
//----------------
|
467 |
|
|
reg [7:0] p3dir;
|
468 |
|
|
|
469 |
|
|
wire p3dir_wr = P3DIR[0] ? reg_hi_wr[P3DIR/2] : reg_lo_wr[P3DIR/2];
|
470 |
|
|
wire [7:0] p3dir_nxt = P3DIR[0] ? per_din[15:8] : per_din[7:0];
|
471 |
|
|
|
472 |
|
|
always @ (posedge mclk or posedge puc)
|
473 |
|
|
if (puc) p3dir <= 8'h00;
|
474 |
|
|
else if (p3dir_wr) p3dir <= p3dir_nxt & P3_EN_MSK;
|
475 |
|
|
|
476 |
|
|
assign p3_dout_en = p3dir;
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
// P3SEL Register
|
480 |
|
|
//----------------
|
481 |
|
|
reg [7:0] p3sel;
|
482 |
|
|
|
483 |
|
|
wire p3sel_wr = P3SEL[0] ? reg_hi_wr[P3SEL/2] : reg_lo_wr[P3SEL/2];
|
484 |
|
|
wire [7:0] p3sel_nxt = P3SEL[0] ? per_din[15:8] : per_din[7:0];
|
485 |
|
|
|
486 |
|
|
always @ (posedge mclk or posedge puc)
|
487 |
|
|
if (puc) p3sel <= 8'h00;
|
488 |
|
|
else if (p3sel_wr) p3sel <= p3sel_nxt & P3_EN_MSK;
|
489 |
|
|
|
490 |
|
|
assign p3_sel = p3sel;
|
491 |
|
|
|
492 |
|
|
|
493 |
|
|
// P4IN Register
|
494 |
|
|
//---------------
|
495 |
|
|
reg [7:0] p4in;
|
496 |
|
|
|
497 |
|
|
always @ (posedge mclk or posedge puc)
|
498 |
|
|
if (puc) p4in <= 8'h00;
|
499 |
|
|
else p4in <= p4_din & P4_EN_MSK;
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
// P4OUT Register
|
503 |
|
|
//----------------
|
504 |
|
|
reg [7:0] p4out;
|
505 |
|
|
|
506 |
|
|
wire p4out_wr = P4OUT[0] ? reg_hi_wr[P4OUT/2] : reg_lo_wr[P4OUT/2];
|
507 |
|
|
wire [7:0] p4out_nxt = P4OUT[0] ? per_din[15:8] : per_din[7:0];
|
508 |
|
|
|
509 |
|
|
always @ (posedge mclk or posedge puc)
|
510 |
|
|
if (puc) p4out <= 8'h00;
|
511 |
|
|
else if (p4out_wr) p4out <= p4out_nxt & P4_EN_MSK;
|
512 |
|
|
|
513 |
|
|
assign p4_dout = p4out;
|
514 |
|
|
|
515 |
|
|
|
516 |
|
|
// P4DIR Register
|
517 |
|
|
//----------------
|
518 |
|
|
reg [7:0] p4dir;
|
519 |
|
|
|
520 |
|
|
wire p4dir_wr = P4DIR[0] ? reg_hi_wr[P4DIR/2] : reg_lo_wr[P4DIR/2];
|
521 |
|
|
wire [7:0] p4dir_nxt = P4DIR[0] ? per_din[15:8] : per_din[7:0];
|
522 |
|
|
|
523 |
|
|
always @ (posedge mclk or posedge puc)
|
524 |
|
|
if (puc) p4dir <= 8'h00;
|
525 |
|
|
else if (p4dir_wr) p4dir <= p4dir_nxt & P4_EN_MSK;
|
526 |
|
|
|
527 |
|
|
assign p4_dout_en = p4dir;
|
528 |
|
|
|
529 |
|
|
|
530 |
|
|
// P4SEL Register
|
531 |
|
|
//----------------
|
532 |
|
|
reg [7:0] p4sel;
|
533 |
|
|
|
534 |
|
|
wire p4sel_wr = P4SEL[0] ? reg_hi_wr[P4SEL/2] : reg_lo_wr[P4SEL/2];
|
535 |
|
|
wire [7:0] p4sel_nxt = P4SEL[0] ? per_din[15:8] : per_din[7:0];
|
536 |
|
|
|
537 |
|
|
always @ (posedge mclk or posedge puc)
|
538 |
|
|
if (puc) p4sel <= 8'h00;
|
539 |
|
|
else if (p4sel_wr) p4sel <= p4sel_nxt & P4_EN_MSK;
|
540 |
|
|
|
541 |
|
|
assign p4_sel = p4sel;
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
// P5IN Register
|
545 |
|
|
//---------------
|
546 |
|
|
reg [7:0] p5in;
|
547 |
|
|
|
548 |
|
|
always @ (posedge mclk or posedge puc)
|
549 |
|
|
if (puc) p5in <= 8'h00;
|
550 |
|
|
else p5in <= p5_din & P5_EN_MSK;
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
// P5OUT Register
|
554 |
|
|
//----------------
|
555 |
|
|
reg [7:0] p5out;
|
556 |
|
|
|
557 |
|
|
wire p5out_wr = P5OUT[0] ? reg_hi_wr[P5OUT/2] : reg_lo_wr[P5OUT/2];
|
558 |
|
|
wire [7:0] p5out_nxt = P5OUT[0] ? per_din[15:8] : per_din[7:0];
|
559 |
|
|
|
560 |
|
|
always @ (posedge mclk or posedge puc)
|
561 |
|
|
if (puc) p5out <= 8'h00;
|
562 |
|
|
else if (p5out_wr) p5out <= p5out_nxt & P5_EN_MSK;
|
563 |
|
|
|
564 |
|
|
assign p5_dout = p5out;
|
565 |
|
|
|
566 |
|
|
|
567 |
|
|
// P5DIR Register
|
568 |
|
|
//----------------
|
569 |
|
|
reg [7:0] p5dir;
|
570 |
|
|
|
571 |
|
|
wire p5dir_wr = P5DIR[0] ? reg_hi_wr[P5DIR/2] : reg_lo_wr[P5DIR/2];
|
572 |
|
|
wire [7:0] p5dir_nxt = P5DIR[0] ? per_din[15:8] : per_din[7:0];
|
573 |
|
|
|
574 |
|
|
always @ (posedge mclk or posedge puc)
|
575 |
|
|
if (puc) p5dir <= 8'h00;
|
576 |
|
|
else if (p5dir_wr) p5dir <= p5dir_nxt & P5_EN_MSK;
|
577 |
|
|
|
578 |
|
|
assign p5_dout_en = p5dir;
|
579 |
|
|
|
580 |
|
|
|
581 |
|
|
// P5SEL Register
|
582 |
|
|
//----------------
|
583 |
|
|
reg [7:0] p5sel;
|
584 |
|
|
|
585 |
|
|
wire p5sel_wr = P5SEL[0] ? reg_hi_wr[P5SEL/2] : reg_lo_wr[P5SEL/2];
|
586 |
|
|
wire [7:0] p5sel_nxt = P5SEL[0] ? per_din[15:8] : per_din[7:0];
|
587 |
|
|
|
588 |
|
|
always @ (posedge mclk or posedge puc)
|
589 |
|
|
if (puc) p5sel <= 8'h00;
|
590 |
|
|
else if (p5sel_wr) p5sel <= p5sel_nxt & P5_EN_MSK;
|
591 |
|
|
|
592 |
|
|
assign p5_sel = p5sel;
|
593 |
|
|
|
594 |
|
|
|
595 |
|
|
// P6IN Register
|
596 |
|
|
//---------------
|
597 |
|
|
reg [7:0] p6in;
|
598 |
|
|
|
599 |
|
|
always @ (posedge mclk or posedge puc)
|
600 |
|
|
if (puc) p6in <= 8'h00;
|
601 |
|
|
else p6in <= p6_din & P6_EN_MSK;
|
602 |
|
|
|
603 |
|
|
|
604 |
|
|
// P6OUT Register
|
605 |
|
|
//----------------
|
606 |
|
|
reg [7:0] p6out;
|
607 |
|
|
|
608 |
|
|
wire p6out_wr = P6OUT[0] ? reg_hi_wr[P6OUT/2] : reg_lo_wr[P6OUT/2];
|
609 |
|
|
wire [7:0] p6out_nxt = P6OUT[0] ? per_din[15:8] : per_din[7:0];
|
610 |
|
|
|
611 |
|
|
always @ (posedge mclk or posedge puc)
|
612 |
|
|
if (puc) p6out <= 8'h00;
|
613 |
|
|
else if (p6out_wr) p6out <= p6out_nxt & P6_EN_MSK;
|
614 |
|
|
|
615 |
|
|
assign p6_dout = p6out;
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
// P6DIR Register
|
619 |
|
|
//----------------
|
620 |
|
|
reg [7:0] p6dir;
|
621 |
|
|
|
622 |
|
|
wire p6dir_wr = P6DIR[0] ? reg_hi_wr[P6DIR/2] : reg_lo_wr[P6DIR/2];
|
623 |
|
|
wire [7:0] p6dir_nxt = P6DIR[0] ? per_din[15:8] : per_din[7:0];
|
624 |
|
|
|
625 |
|
|
always @ (posedge mclk or posedge puc)
|
626 |
|
|
if (puc) p6dir <= 8'h00;
|
627 |
|
|
else if (p6dir_wr) p6dir <= p6dir_nxt & P6_EN_MSK;
|
628 |
|
|
|
629 |
|
|
assign p6_dout_en = p6dir;
|
630 |
|
|
|
631 |
|
|
|
632 |
|
|
// P6SEL Register
|
633 |
|
|
//----------------
|
634 |
|
|
reg [7:0] p6sel;
|
635 |
|
|
|
636 |
|
|
wire p6sel_wr = P6SEL[0] ? reg_hi_wr[P6SEL/2] : reg_lo_wr[P6SEL/2];
|
637 |
|
|
wire [7:0] p6sel_nxt = P6SEL[0] ? per_din[15:8] : per_din[7:0];
|
638 |
|
|
|
639 |
|
|
always @ (posedge mclk or posedge puc)
|
640 |
|
|
if (puc) p6sel <= 8'h00;
|
641 |
|
|
else if (p6sel_wr) p6sel <= p6sel_nxt & P6_EN_MSK;
|
642 |
|
|
|
643 |
|
|
assign p6_sel = p6sel;
|
644 |
|
|
|
645 |
|
|
|
646 |
|
|
|
647 |
|
|
//============================================================================
|
648 |
|
|
// 4) INTERRUPT GENERATION
|
649 |
|
|
//============================================================================
|
650 |
|
|
|
651 |
|
|
// Port 1 interrupt
|
652 |
|
|
//------------------
|
653 |
|
|
|
654 |
|
|
// Delay input
|
655 |
|
|
reg [7:0] p1in_dly;
|
656 |
|
|
always @ (posedge mclk or posedge puc)
|
657 |
|
|
if (puc) p1in_dly <= 8'h00;
|
658 |
|
|
else p1in_dly <= p1in & P1_EN_MSK;
|
659 |
|
|
|
660 |
|
|
// Edge detection
|
661 |
|
|
wire [7:0] p1in_re = p1in & ~p1in_dly;
|
662 |
|
|
wire [7:0] p1in_fe = ~p1in & p1in_dly;
|
663 |
|
|
|
664 |
|
|
// Set interrupt flag
|
665 |
|
|
assign p1ifg_set = {p1ies[7] ? p1in_fe[7] : p1in_re[7],
|
666 |
|
|
p1ies[6] ? p1in_fe[6] : p1in_re[6],
|
667 |
|
|
p1ies[5] ? p1in_fe[5] : p1in_re[5],
|
668 |
|
|
p1ies[4] ? p1in_fe[4] : p1in_re[4],
|
669 |
|
|
p1ies[3] ? p1in_fe[3] : p1in_re[3],
|
670 |
|
|
p1ies[2] ? p1in_fe[2] : p1in_re[2],
|
671 |
|
|
p1ies[1] ? p1in_fe[1] : p1in_re[1],
|
672 |
|
|
p1ies[0] ? p1in_fe[0] : p1in_re[0]} & P1_EN_MSK;
|
673 |
|
|
|
674 |
|
|
// Generate CPU interrupt
|
675 |
|
|
assign irq_port1 = |(p1ie & p1ifg) & P1_EN[0];
|
676 |
|
|
|
677 |
|
|
|
678 |
|
|
// Port 1 interrupt
|
679 |
|
|
//------------------
|
680 |
|
|
|
681 |
|
|
// Delay input
|
682 |
|
|
reg [7:0] p2in_dly;
|
683 |
|
|
always @ (posedge mclk or posedge puc)
|
684 |
|
|
if (puc) p2in_dly <= 8'h00;
|
685 |
|
|
else p2in_dly <= p2in & P2_EN_MSK;
|
686 |
|
|
|
687 |
|
|
// Edge detection
|
688 |
|
|
wire [7:0] p2in_re = p2in & ~p2in_dly;
|
689 |
|
|
wire [7:0] p2in_fe = ~p2in & p2in_dly;
|
690 |
|
|
|
691 |
|
|
// Set interrupt flag
|
692 |
|
|
assign p2ifg_set = {p2ies[7] ? p2in_fe[7] : p2in_re[7],
|
693 |
|
|
p2ies[6] ? p2in_fe[6] : p2in_re[6],
|
694 |
|
|
p2ies[5] ? p2in_fe[5] : p2in_re[5],
|
695 |
|
|
p2ies[4] ? p2in_fe[4] : p2in_re[4],
|
696 |
|
|
p2ies[3] ? p2in_fe[3] : p2in_re[3],
|
697 |
|
|
p2ies[2] ? p2in_fe[2] : p2in_re[2],
|
698 |
|
|
p2ies[1] ? p2in_fe[1] : p2in_re[1],
|
699 |
|
|
p2ies[0] ? p2in_fe[0] : p2in_re[0]} & P2_EN_MSK;
|
700 |
|
|
|
701 |
|
|
// Generate CPU interrupt
|
702 |
|
|
assign irq_port2 = |(p2ie & p2ifg) & P2_EN[0];
|
703 |
|
|
|
704 |
|
|
|
705 |
|
|
//============================================================================
|
706 |
|
|
// 5) DATA OUTPUT GENERATION
|
707 |
|
|
//============================================================================
|
708 |
|
|
|
709 |
|
|
// Data output mux
|
710 |
|
|
wire [15:0] p1in_rd = (p1in & {8{reg_rd[P1IN/2]}}) << (8 & {4{P1IN[0]}});
|
711 |
|
|
wire [15:0] p1out_rd = (p1out & {8{reg_rd[P1OUT/2]}}) << (8 & {4{P1OUT[0]}});
|
712 |
|
|
wire [15:0] p1dir_rd = (p1dir & {8{reg_rd[P1DIR/2]}}) << (8 & {4{P1DIR[0]}});
|
713 |
|
|
wire [15:0] p1ifg_rd = (p1ifg & {8{reg_rd[P1IFG/2]}}) << (8 & {4{P1IFG[0]}});
|
714 |
|
|
wire [15:0] p1ies_rd = (p1ies & {8{reg_rd[P1IES/2]}}) << (8 & {4{P1IES[0]}});
|
715 |
|
|
wire [15:0] p1ie_rd = (p1ie & {8{reg_rd[P1IE/2]}}) << (8 & {4{P1IE[0]}});
|
716 |
|
|
wire [15:0] p1sel_rd = (p1sel & {8{reg_rd[P1SEL/2]}}) << (8 & {4{P1SEL[0]}});
|
717 |
|
|
wire [15:0] p2in_rd = (p2in & {8{reg_rd[P2IN/2]}}) << (8 & {4{P2IN[0]}});
|
718 |
|
|
wire [15:0] p2out_rd = (p2out & {8{reg_rd[P2OUT/2]}}) << (8 & {4{P2OUT[0]}});
|
719 |
|
|
wire [15:0] p2dir_rd = (p2dir & {8{reg_rd[P2DIR/2]}}) << (8 & {4{P2DIR[0]}});
|
720 |
|
|
wire [15:0] p2ifg_rd = (p2ifg & {8{reg_rd[P2IFG/2]}}) << (8 & {4{P2IFG[0]}});
|
721 |
|
|
wire [15:0] p2ies_rd = (p2ies & {8{reg_rd[P2IES/2]}}) << (8 & {4{P2IES[0]}});
|
722 |
|
|
wire [15:0] p2ie_rd = (p2ie & {8{reg_rd[P2IE/2]}}) << (8 & {4{P2IE[0]}});
|
723 |
|
|
wire [15:0] p2sel_rd = (p2sel & {8{reg_rd[P2SEL/2]}}) << (8 & {4{P2SEL[0]}});
|
724 |
|
|
wire [15:0] p3in_rd = (p3in & {8{reg_rd[P3IN/2]}}) << (8 & {4{P3IN[0]}});
|
725 |
|
|
wire [15:0] p3out_rd = (p3out & {8{reg_rd[P3OUT/2]}}) << (8 & {4{P3OUT[0]}});
|
726 |
|
|
wire [15:0] p3dir_rd = (p3dir & {8{reg_rd[P3DIR/2]}}) << (8 & {4{P3DIR[0]}});
|
727 |
|
|
wire [15:0] p3sel_rd = (p3sel & {8{reg_rd[P3SEL/2]}}) << (8 & {4{P3SEL[0]}});
|
728 |
|
|
wire [15:0] p4in_rd = (p4in & {8{reg_rd[P4IN/2]}}) << (8 & {4{P4IN[0]}});
|
729 |
|
|
wire [15:0] p4out_rd = (p4out & {8{reg_rd[P4OUT/2]}}) << (8 & {4{P4OUT[0]}});
|
730 |
|
|
wire [15:0] p4dir_rd = (p4dir & {8{reg_rd[P4DIR/2]}}) << (8 & {4{P4DIR[0]}});
|
731 |
|
|
wire [15:0] p4sel_rd = (p4sel & {8{reg_rd[P4SEL/2]}}) << (8 & {4{P4SEL[0]}});
|
732 |
|
|
wire [15:0] p5in_rd = (p5in & {8{reg_rd[P5IN/2]}}) << (8 & {4{P5IN[0]}});
|
733 |
|
|
wire [15:0] p5out_rd = (p5out & {8{reg_rd[P5OUT/2]}}) << (8 & {4{P5OUT[0]}});
|
734 |
|
|
wire [15:0] p5dir_rd = (p5dir & {8{reg_rd[P5DIR/2]}}) << (8 & {4{P5DIR[0]}});
|
735 |
|
|
wire [15:0] p5sel_rd = (p5sel & {8{reg_rd[P5SEL/2]}}) << (8 & {4{P5SEL[0]}});
|
736 |
|
|
wire [15:0] p6in_rd = (p6in & {8{reg_rd[P6IN/2]}}) << (8 & {4{P6IN[0]}});
|
737 |
|
|
wire [15:0] p6out_rd = (p6out & {8{reg_rd[P6OUT/2]}}) << (8 & {4{P6OUT[0]}});
|
738 |
|
|
wire [15:0] p6dir_rd = (p6dir & {8{reg_rd[P6DIR/2]}}) << (8 & {4{P6DIR[0]}});
|
739 |
|
|
wire [15:0] p6sel_rd = (p6sel & {8{reg_rd[P6SEL/2]}}) << (8 & {4{P6SEL[0]}});
|
740 |
|
|
|
741 |
|
|
wire [15:0] per_dout = p1in_rd |
|
742 |
|
|
p1out_rd |
|
743 |
|
|
p1dir_rd |
|
744 |
|
|
p1ifg_rd |
|
745 |
|
|
p1ies_rd |
|
746 |
|
|
p1ie_rd |
|
747 |
|
|
p1sel_rd |
|
748 |
|
|
p2in_rd |
|
749 |
|
|
p2out_rd |
|
750 |
|
|
p2dir_rd |
|
751 |
|
|
p2ifg_rd |
|
752 |
|
|
p2ies_rd |
|
753 |
|
|
p2ie_rd |
|
754 |
|
|
p2sel_rd |
|
755 |
|
|
p3in_rd |
|
756 |
|
|
p3out_rd |
|
757 |
|
|
p3dir_rd |
|
758 |
|
|
p3sel_rd |
|
759 |
|
|
p4in_rd |
|
760 |
|
|
p4out_rd |
|
761 |
|
|
p4dir_rd |
|
762 |
|
|
p4sel_rd |
|
763 |
|
|
p5in_rd |
|
764 |
|
|
p5out_rd |
|
765 |
|
|
p5dir_rd |
|
766 |
|
|
p5sel_rd |
|
767 |
|
|
p6in_rd |
|
768 |
|
|
p6out_rd |
|
769 |
|
|
p6dir_rd |
|
770 |
|
|
p6sel_rd;
|
771 |
|
|
|
772 |
34 |
olivier.gi |
endmodule // omsp_gpio
|
773 |
2 |
olivier.gi |
|
774 |
33 |
olivier.gi |
`include "openMSP430_undefines.v"
|