blob: d1dd6a069cc120eec9e70dc40b50698773dffe2b [file] [log] [blame]
Michael Schaffner51c61442019-10-01 15:49:10 -07001// Copyright lowRISC contributors.
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4//
5// Register Top module auto-generated by `reggen`
6
7module pinmux_reg_top (
8 input clk_i,
9 input rst_ni,
10
11 // Below Regster interface can be changed
12 input tlul_pkg::tl_h2d_t tl_i,
13 output tlul_pkg::tl_d2h_t tl_o,
14 // To HW
15 output pinmux_reg_pkg::pinmux_reg2hw_t reg2hw, // Write
16
17 // Config
18 input devmode_i // If 1, explicit error return for unmapped register access
19);
20
21 import pinmux_reg_pkg::* ;
22
Michael Schaffner7fac2d32019-10-04 10:14:50 -070023 localparam AW = 5;
Michael Schaffner51c61442019-10-01 15:49:10 -070024 localparam DW = 32;
25 localparam DBW = DW/8; // Byte Width
26
27 // register signals
28 logic reg_we;
29 logic reg_re;
30 logic [AW-1:0] reg_addr;
31 logic [DW-1:0] reg_wdata;
32 logic [DBW-1:0] reg_be;
33 logic [DW-1:0] reg_rdata;
34 logic reg_error;
35
36 logic addrmiss, wr_err;
37
38 logic [DW-1:0] reg_rdata_next;
39
40 tlul_pkg::tl_h2d_t tl_reg_h2d;
41 tlul_pkg::tl_d2h_t tl_reg_d2h;
42
43 assign tl_reg_h2d = tl_i;
44 assign tl_o = tl_reg_d2h;
45
46 tlul_adapter_reg #(
47 .RegAw(AW),
48 .RegDw(DW)
49 ) u_reg_if (
50 .clk_i,
51 .rst_ni,
52
53 .tl_i (tl_reg_h2d),
54 .tl_o (tl_reg_d2h),
55
56 .we_o (reg_we),
57 .re_o (reg_re),
58 .addr_o (reg_addr),
59 .wdata_o (reg_wdata),
60 .be_o (reg_be),
61 .rdata_i (reg_rdata),
62 .error_i (reg_error)
63 );
64
65 assign reg_rdata = reg_rdata_next ;
66 assign reg_error = (devmode_i & addrmiss) | wr_err ;
67
68 // Define SW related signals
69 // Format: <reg>_<field>_{wd|we|qs}
70 // or <reg>_{wd|we|qs} if field == 1 or 0
71 logic regen_qs;
72 logic regen_wd;
73 logic regen_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070074 logic [3:0] periph_insel0_in0_qs;
75 logic [3:0] periph_insel0_in0_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070076 logic periph_insel0_in0_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070077 logic [3:0] periph_insel0_in1_qs;
78 logic [3:0] periph_insel0_in1_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070079 logic periph_insel0_in1_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070080 logic [3:0] periph_insel0_in2_qs;
81 logic [3:0] periph_insel0_in2_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070082 logic periph_insel0_in2_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070083 logic [3:0] periph_insel0_in3_qs;
84 logic [3:0] periph_insel0_in3_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070085 logic periph_insel0_in3_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070086 logic [3:0] periph_insel0_in4_qs;
87 logic [3:0] periph_insel0_in4_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070088 logic periph_insel0_in4_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070089 logic [3:0] periph_insel0_in5_qs;
90 logic [3:0] periph_insel0_in5_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070091 logic periph_insel0_in5_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070092 logic [3:0] periph_insel0_in6_qs;
93 logic [3:0] periph_insel0_in6_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070094 logic periph_insel0_in6_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070095 logic [3:0] periph_insel0_in7_qs;
96 logic [3:0] periph_insel0_in7_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -070097 logic periph_insel0_in7_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -070098 logic [3:0] periph_insel1_in8_qs;
99 logic [3:0] periph_insel1_in8_wd;
100 logic periph_insel1_in8_we;
101 logic [3:0] periph_insel1_in9_qs;
102 logic [3:0] periph_insel1_in9_wd;
103 logic periph_insel1_in9_we;
104 logic [3:0] periph_insel1_in10_qs;
105 logic [3:0] periph_insel1_in10_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700106 logic periph_insel1_in10_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700107 logic [3:0] periph_insel1_in11_qs;
108 logic [3:0] periph_insel1_in11_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700109 logic periph_insel1_in11_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700110 logic [3:0] periph_insel1_in12_qs;
111 logic [3:0] periph_insel1_in12_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700112 logic periph_insel1_in12_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700113 logic [3:0] periph_insel1_in13_qs;
114 logic [3:0] periph_insel1_in13_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700115 logic periph_insel1_in13_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700116 logic [3:0] periph_insel1_in14_qs;
117 logic [3:0] periph_insel1_in14_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700118 logic periph_insel1_in14_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700119 logic [3:0] periph_insel1_in15_qs;
120 logic [3:0] periph_insel1_in15_wd;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700121 logic periph_insel1_in15_we;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700122 logic [4:0] mio_outsel0_out0_qs;
123 logic [4:0] mio_outsel0_out0_wd;
124 logic mio_outsel0_out0_we;
125 logic [4:0] mio_outsel0_out1_qs;
126 logic [4:0] mio_outsel0_out1_wd;
127 logic mio_outsel0_out1_we;
128 logic [4:0] mio_outsel0_out2_qs;
129 logic [4:0] mio_outsel0_out2_wd;
130 logic mio_outsel0_out2_we;
131 logic [4:0] mio_outsel0_out3_qs;
132 logic [4:0] mio_outsel0_out3_wd;
133 logic mio_outsel0_out3_we;
134 logic [4:0] mio_outsel0_out4_qs;
135 logic [4:0] mio_outsel0_out4_wd;
136 logic mio_outsel0_out4_we;
137 logic [4:0] mio_outsel0_out5_qs;
138 logic [4:0] mio_outsel0_out5_wd;
139 logic mio_outsel0_out5_we;
140 logic [4:0] mio_outsel1_out6_qs;
141 logic [4:0] mio_outsel1_out6_wd;
142 logic mio_outsel1_out6_we;
143 logic [4:0] mio_outsel1_out7_qs;
144 logic [4:0] mio_outsel1_out7_wd;
145 logic mio_outsel1_out7_we;
Michael Schaffner51c61442019-10-01 15:49:10 -0700146
147 // Register instances
148 // R[regen]: V(False)
149
150 prim_subreg #(
151 .DW (1),
Michael Schaffnerd86ff082019-10-01 17:22:59 -0700152 .SWACCESS("W0C"),
Michael Schaffner51c61442019-10-01 15:49:10 -0700153 .RESVAL (1'h1)
154 ) u_regen (
155 .clk_i (clk_i ),
156 .rst_ni (rst_ni ),
157
158 // from register interface
159 .we (regen_we),
160 .wd (regen_wd),
161
162 // from internal hardware
163 .de (1'b0),
164 .d ('0 ),
165
166 // to internal hardware
167 .qe (),
168 .q (),
169
170 // to register interface (read)
171 .qs (regen_qs)
172 );
173
174
175
176 // Subregister 0 of Multireg periph_insel
Michael Schaffnerfb801932019-10-02 10:49:15 -0700177 // R[periph_insel0]: V(False)
Michael Schaffner51c61442019-10-01 15:49:10 -0700178
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700179 // F[in0]: 3:0
Michael Schaffner51c61442019-10-01 15:49:10 -0700180 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700181 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700182 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700183 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700184 ) u_periph_insel0_in0 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700185 .clk_i (clk_i ),
186 .rst_ni (rst_ni ),
187
188 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700189 .we (periph_insel0_in0_we & regen_qs),
190 .wd (periph_insel0_in0_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700191
192 // from internal hardware
193 .de (1'b0),
194 .d ('0 ),
195
196 // to internal hardware
197 .qe (),
198 .q (reg2hw.periph_insel[0].q ),
199
200 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700201 .qs (periph_insel0_in0_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700202 );
203
204
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700205 // F[in1]: 7:4
Michael Schaffner51c61442019-10-01 15:49:10 -0700206 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700207 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700208 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700209 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700210 ) u_periph_insel0_in1 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700211 .clk_i (clk_i ),
212 .rst_ni (rst_ni ),
213
214 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700215 .we (periph_insel0_in1_we & regen_qs),
216 .wd (periph_insel0_in1_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700217
218 // from internal hardware
219 .de (1'b0),
220 .d ('0 ),
221
222 // to internal hardware
223 .qe (),
224 .q (reg2hw.periph_insel[1].q ),
225
226 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700227 .qs (periph_insel0_in1_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700228 );
229
230
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700231 // F[in2]: 11:8
Michael Schaffner51c61442019-10-01 15:49:10 -0700232 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700233 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700234 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700235 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700236 ) u_periph_insel0_in2 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700237 .clk_i (clk_i ),
238 .rst_ni (rst_ni ),
239
240 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700241 .we (periph_insel0_in2_we & regen_qs),
242 .wd (periph_insel0_in2_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700243
244 // from internal hardware
245 .de (1'b0),
246 .d ('0 ),
247
248 // to internal hardware
249 .qe (),
250 .q (reg2hw.periph_insel[2].q ),
251
252 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700253 .qs (periph_insel0_in2_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700254 );
255
256
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700257 // F[in3]: 15:12
Michael Schaffner51c61442019-10-01 15:49:10 -0700258 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700259 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700260 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700261 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700262 ) u_periph_insel0_in3 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700263 .clk_i (clk_i ),
264 .rst_ni (rst_ni ),
265
266 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700267 .we (periph_insel0_in3_we & regen_qs),
268 .wd (periph_insel0_in3_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700269
270 // from internal hardware
271 .de (1'b0),
272 .d ('0 ),
273
274 // to internal hardware
275 .qe (),
276 .q (reg2hw.periph_insel[3].q ),
277
278 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700279 .qs (periph_insel0_in3_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700280 );
281
282
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700283 // F[in4]: 19:16
Michael Schaffner51c61442019-10-01 15:49:10 -0700284 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700285 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700286 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700287 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700288 ) u_periph_insel0_in4 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700289 .clk_i (clk_i ),
290 .rst_ni (rst_ni ),
291
292 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700293 .we (periph_insel0_in4_we & regen_qs),
294 .wd (periph_insel0_in4_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700295
296 // from internal hardware
297 .de (1'b0),
298 .d ('0 ),
299
300 // to internal hardware
301 .qe (),
302 .q (reg2hw.periph_insel[4].q ),
303
304 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700305 .qs (periph_insel0_in4_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700306 );
307
308
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700309 // F[in5]: 23:20
Michael Schaffner51c61442019-10-01 15:49:10 -0700310 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700311 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700312 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700313 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700314 ) u_periph_insel0_in5 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700315 .clk_i (clk_i ),
316 .rst_ni (rst_ni ),
317
318 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700319 .we (periph_insel0_in5_we & regen_qs),
320 .wd (periph_insel0_in5_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700321
322 // from internal hardware
323 .de (1'b0),
324 .d ('0 ),
325
326 // to internal hardware
327 .qe (),
328 .q (reg2hw.periph_insel[5].q ),
329
330 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700331 .qs (periph_insel0_in5_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700332 );
333
334
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700335 // F[in6]: 27:24
Michael Schaffner51c61442019-10-01 15:49:10 -0700336 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700337 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700338 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700339 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700340 ) u_periph_insel0_in6 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700341 .clk_i (clk_i ),
342 .rst_ni (rst_ni ),
343
344 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700345 .we (periph_insel0_in6_we & regen_qs),
346 .wd (periph_insel0_in6_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700347
348 // from internal hardware
349 .de (1'b0),
350 .d ('0 ),
351
352 // to internal hardware
353 .qe (),
354 .q (reg2hw.periph_insel[6].q ),
355
356 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700357 .qs (periph_insel0_in6_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700358 );
359
360
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700361 // F[in7]: 31:28
Michael Schaffner51c61442019-10-01 15:49:10 -0700362 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700363 .DW (4),
Michael Schaffner51c61442019-10-01 15:49:10 -0700364 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700365 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700366 ) u_periph_insel0_in7 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700367 .clk_i (clk_i ),
368 .rst_ni (rst_ni ),
369
370 // from register interface (qualified with register enable)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700371 .we (periph_insel0_in7_we & regen_qs),
372 .wd (periph_insel0_in7_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700373
374 // from internal hardware
375 .de (1'b0),
376 .d ('0 ),
377
378 // to internal hardware
379 .qe (),
380 .q (reg2hw.periph_insel[7].q ),
381
382 // to register interface (read)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700383 .qs (periph_insel0_in7_qs)
384 );
385
386
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700387 // Subregister 8 of Multireg periph_insel
388 // R[periph_insel1]: V(False)
389
390 // F[in8]: 3:0
Michael Schaffnerfb801932019-10-02 10:49:15 -0700391 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700392 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700393 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700394 .RESVAL (4'h0)
395 ) u_periph_insel1_in8 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700396 .clk_i (clk_i ),
397 .rst_ni (rst_ni ),
398
399 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700400 .we (periph_insel1_in8_we & regen_qs),
401 .wd (periph_insel1_in8_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700402
403 // from internal hardware
404 .de (1'b0),
405 .d ('0 ),
406
407 // to internal hardware
408 .qe (),
409 .q (reg2hw.periph_insel[8].q ),
410
411 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700412 .qs (periph_insel1_in8_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700413 );
414
415
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700416 // F[in9]: 7:4
Michael Schaffnerfb801932019-10-02 10:49:15 -0700417 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700418 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700419 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700420 .RESVAL (4'h0)
421 ) u_periph_insel1_in9 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700422 .clk_i (clk_i ),
423 .rst_ni (rst_ni ),
424
425 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700426 .we (periph_insel1_in9_we & regen_qs),
427 .wd (periph_insel1_in9_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700428
429 // from internal hardware
430 .de (1'b0),
431 .d ('0 ),
432
433 // to internal hardware
434 .qe (),
435 .q (reg2hw.periph_insel[9].q ),
436
437 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700438 .qs (periph_insel1_in9_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700439 );
440
441
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700442 // F[in10]: 11:8
Michael Schaffnerfb801932019-10-02 10:49:15 -0700443 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700444 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700445 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700446 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700447 ) u_periph_insel1_in10 (
448 .clk_i (clk_i ),
449 .rst_ni (rst_ni ),
450
451 // from register interface (qualified with register enable)
452 .we (periph_insel1_in10_we & regen_qs),
453 .wd (periph_insel1_in10_wd),
454
455 // from internal hardware
456 .de (1'b0),
457 .d ('0 ),
458
459 // to internal hardware
460 .qe (),
461 .q (reg2hw.periph_insel[10].q ),
462
463 // to register interface (read)
464 .qs (periph_insel1_in10_qs)
465 );
466
467
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700468 // F[in11]: 15:12
Michael Schaffnerfb801932019-10-02 10:49:15 -0700469 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700470 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700471 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700472 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700473 ) u_periph_insel1_in11 (
474 .clk_i (clk_i ),
475 .rst_ni (rst_ni ),
476
477 // from register interface (qualified with register enable)
478 .we (periph_insel1_in11_we & regen_qs),
479 .wd (periph_insel1_in11_wd),
480
481 // from internal hardware
482 .de (1'b0),
483 .d ('0 ),
484
485 // to internal hardware
486 .qe (),
487 .q (reg2hw.periph_insel[11].q ),
488
489 // to register interface (read)
490 .qs (periph_insel1_in11_qs)
491 );
492
493
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700494 // F[in12]: 19:16
Michael Schaffnerfb801932019-10-02 10:49:15 -0700495 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700496 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700497 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700498 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700499 ) u_periph_insel1_in12 (
500 .clk_i (clk_i ),
501 .rst_ni (rst_ni ),
502
503 // from register interface (qualified with register enable)
504 .we (periph_insel1_in12_we & regen_qs),
505 .wd (periph_insel1_in12_wd),
506
507 // from internal hardware
508 .de (1'b0),
509 .d ('0 ),
510
511 // to internal hardware
512 .qe (),
513 .q (reg2hw.periph_insel[12].q ),
514
515 // to register interface (read)
516 .qs (periph_insel1_in12_qs)
517 );
518
519
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700520 // F[in13]: 23:20
Michael Schaffnerfb801932019-10-02 10:49:15 -0700521 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700522 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700523 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700524 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700525 ) u_periph_insel1_in13 (
526 .clk_i (clk_i ),
527 .rst_ni (rst_ni ),
528
529 // from register interface (qualified with register enable)
530 .we (periph_insel1_in13_we & regen_qs),
531 .wd (periph_insel1_in13_wd),
532
533 // from internal hardware
534 .de (1'b0),
535 .d ('0 ),
536
537 // to internal hardware
538 .qe (),
539 .q (reg2hw.periph_insel[13].q ),
540
541 // to register interface (read)
542 .qs (periph_insel1_in13_qs)
543 );
544
545
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700546 // F[in14]: 27:24
Michael Schaffnerfb801932019-10-02 10:49:15 -0700547 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700548 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700549 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700550 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700551 ) u_periph_insel1_in14 (
552 .clk_i (clk_i ),
553 .rst_ni (rst_ni ),
554
555 // from register interface (qualified with register enable)
556 .we (periph_insel1_in14_we & regen_qs),
557 .wd (periph_insel1_in14_wd),
558
559 // from internal hardware
560 .de (1'b0),
561 .d ('0 ),
562
563 // to internal hardware
564 .qe (),
565 .q (reg2hw.periph_insel[14].q ),
566
567 // to register interface (read)
568 .qs (periph_insel1_in14_qs)
569 );
570
571
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700572 // F[in15]: 31:28
Michael Schaffnerfb801932019-10-02 10:49:15 -0700573 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700574 .DW (4),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700575 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700576 .RESVAL (4'h0)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700577 ) u_periph_insel1_in15 (
578 .clk_i (clk_i ),
579 .rst_ni (rst_ni ),
580
581 // from register interface (qualified with register enable)
582 .we (periph_insel1_in15_we & regen_qs),
583 .wd (periph_insel1_in15_wd),
584
585 // from internal hardware
586 .de (1'b0),
587 .d ('0 ),
588
589 // to internal hardware
590 .qe (),
591 .q (reg2hw.periph_insel[15].q ),
592
593 // to register interface (read)
594 .qs (periph_insel1_in15_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700595 );
596
597
598
599
600 // Subregister 0 of Multireg mio_outsel
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700601 // R[mio_outsel0]: V(False)
Michael Schaffner51c61442019-10-01 15:49:10 -0700602
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700603 // F[out0]: 4:0
Michael Schaffner51c61442019-10-01 15:49:10 -0700604 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700605 .DW (5),
Michael Schaffner51c61442019-10-01 15:49:10 -0700606 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700607 .RESVAL (5'h2)
608 ) u_mio_outsel0_out0 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700609 .clk_i (clk_i ),
610 .rst_ni (rst_ni ),
611
612 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700613 .we (mio_outsel0_out0_we & regen_qs),
614 .wd (mio_outsel0_out0_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700615
616 // from internal hardware
617 .de (1'b0),
618 .d ('0 ),
619
620 // to internal hardware
621 .qe (),
622 .q (reg2hw.mio_outsel[0].q ),
623
624 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700625 .qs (mio_outsel0_out0_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700626 );
627
628
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700629 // F[out1]: 9:5
Michael Schaffner51c61442019-10-01 15:49:10 -0700630 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700631 .DW (5),
Michael Schaffner51c61442019-10-01 15:49:10 -0700632 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700633 .RESVAL (5'h2)
634 ) u_mio_outsel0_out1 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700635 .clk_i (clk_i ),
636 .rst_ni (rst_ni ),
637
638 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700639 .we (mio_outsel0_out1_we & regen_qs),
640 .wd (mio_outsel0_out1_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700641
642 // from internal hardware
643 .de (1'b0),
644 .d ('0 ),
645
646 // to internal hardware
647 .qe (),
648 .q (reg2hw.mio_outsel[1].q ),
649
650 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700651 .qs (mio_outsel0_out1_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700652 );
653
654
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700655 // F[out2]: 14:10
Michael Schaffner51c61442019-10-01 15:49:10 -0700656 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700657 .DW (5),
Michael Schaffner51c61442019-10-01 15:49:10 -0700658 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700659 .RESVAL (5'h2)
660 ) u_mio_outsel0_out2 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700661 .clk_i (clk_i ),
662 .rst_ni (rst_ni ),
663
664 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700665 .we (mio_outsel0_out2_we & regen_qs),
666 .wd (mio_outsel0_out2_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700667
668 // from internal hardware
669 .de (1'b0),
670 .d ('0 ),
671
672 // to internal hardware
673 .qe (),
674 .q (reg2hw.mio_outsel[2].q ),
675
676 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700677 .qs (mio_outsel0_out2_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700678 );
679
680
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700681 // F[out3]: 19:15
Michael Schaffner51c61442019-10-01 15:49:10 -0700682 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700683 .DW (5),
Michael Schaffner51c61442019-10-01 15:49:10 -0700684 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700685 .RESVAL (5'h2)
686 ) u_mio_outsel0_out3 (
Michael Schaffner51c61442019-10-01 15:49:10 -0700687 .clk_i (clk_i ),
688 .rst_ni (rst_ni ),
689
690 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700691 .we (mio_outsel0_out3_we & regen_qs),
692 .wd (mio_outsel0_out3_wd),
Michael Schaffner51c61442019-10-01 15:49:10 -0700693
694 // from internal hardware
695 .de (1'b0),
696 .d ('0 ),
697
698 // to internal hardware
699 .qe (),
700 .q (reg2hw.mio_outsel[3].q ),
701
702 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700703 .qs (mio_outsel0_out3_qs)
Michael Schaffner51c61442019-10-01 15:49:10 -0700704 );
705
706
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700707 // F[out4]: 24:20
Michael Schaffnerfb801932019-10-02 10:49:15 -0700708 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700709 .DW (5),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700710 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700711 .RESVAL (5'h2)
712 ) u_mio_outsel0_out4 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700713 .clk_i (clk_i ),
714 .rst_ni (rst_ni ),
715
716 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700717 .we (mio_outsel0_out4_we & regen_qs),
718 .wd (mio_outsel0_out4_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700719
720 // from internal hardware
721 .de (1'b0),
722 .d ('0 ),
723
724 // to internal hardware
725 .qe (),
726 .q (reg2hw.mio_outsel[4].q ),
727
728 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700729 .qs (mio_outsel0_out4_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700730 );
731
732
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700733 // F[out5]: 29:25
Michael Schaffnerfb801932019-10-02 10:49:15 -0700734 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700735 .DW (5),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700736 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700737 .RESVAL (5'h2)
738 ) u_mio_outsel0_out5 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700739 .clk_i (clk_i ),
740 .rst_ni (rst_ni ),
741
742 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700743 .we (mio_outsel0_out5_we & regen_qs),
744 .wd (mio_outsel0_out5_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700745
746 // from internal hardware
747 .de (1'b0),
748 .d ('0 ),
749
750 // to internal hardware
751 .qe (),
752 .q (reg2hw.mio_outsel[5].q ),
753
754 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700755 .qs (mio_outsel0_out5_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700756 );
757
758
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700759 // Subregister 6 of Multireg mio_outsel
760 // R[mio_outsel1]: V(False)
761
762 // F[out6]: 4:0
Michael Schaffnerfb801932019-10-02 10:49:15 -0700763 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700764 .DW (5),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700765 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700766 .RESVAL (5'h2)
767 ) u_mio_outsel1_out6 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700768 .clk_i (clk_i ),
769 .rst_ni (rst_ni ),
770
771 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700772 .we (mio_outsel1_out6_we & regen_qs),
773 .wd (mio_outsel1_out6_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700774
775 // from internal hardware
776 .de (1'b0),
777 .d ('0 ),
778
779 // to internal hardware
780 .qe (),
781 .q (reg2hw.mio_outsel[6].q ),
782
783 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700784 .qs (mio_outsel1_out6_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700785 );
786
787
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700788 // F[out7]: 9:5
Michael Schaffnerfb801932019-10-02 10:49:15 -0700789 prim_subreg #(
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700790 .DW (5),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700791 .SWACCESS("RW"),
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700792 .RESVAL (5'h2)
793 ) u_mio_outsel1_out7 (
Michael Schaffnerfb801932019-10-02 10:49:15 -0700794 .clk_i (clk_i ),
795 .rst_ni (rst_ni ),
796
797 // from register interface (qualified with register enable)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700798 .we (mio_outsel1_out7_we & regen_qs),
799 .wd (mio_outsel1_out7_wd),
Michael Schaffnerfb801932019-10-02 10:49:15 -0700800
801 // from internal hardware
802 .de (1'b0),
803 .d ('0 ),
804
805 // to internal hardware
806 .qe (),
807 .q (reg2hw.mio_outsel[7].q ),
808
809 // to register interface (read)
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700810 .qs (mio_outsel1_out7_qs)
Michael Schaffnerfb801932019-10-02 10:49:15 -0700811 );
Michael Schaffner51c61442019-10-01 15:49:10 -0700812
813
814
Michael Schaffnerfb801932019-10-02 10:49:15 -0700815
816
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700817 logic [4:0] addr_hit;
Michael Schaffner51c61442019-10-01 15:49:10 -0700818 always_comb begin
819 addr_hit = '0;
820 addr_hit[0] = (reg_addr == PINMUX_REGEN_OFFSET);
Michael Schaffnerfb801932019-10-02 10:49:15 -0700821 addr_hit[1] = (reg_addr == PINMUX_PERIPH_INSEL0_OFFSET);
822 addr_hit[2] = (reg_addr == PINMUX_PERIPH_INSEL1_OFFSET);
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700823 addr_hit[3] = (reg_addr == PINMUX_MIO_OUTSEL0_OFFSET);
824 addr_hit[4] = (reg_addr == PINMUX_MIO_OUTSEL1_OFFSET);
Michael Schaffner51c61442019-10-01 15:49:10 -0700825 end
826
827 assign addrmiss = (reg_re || reg_we) ? ~|addr_hit : 1'b0 ;
828
829 // Check sub-word write is permitted
830 always_comb begin
831 wr_err = 1'b0;
832 if (addr_hit[0] && reg_we && (PINMUX_PERMIT[0] != (PINMUX_PERMIT[0] & reg_be))) wr_err = 1'b1 ;
833 if (addr_hit[1] && reg_we && (PINMUX_PERMIT[1] != (PINMUX_PERMIT[1] & reg_be))) wr_err = 1'b1 ;
834 if (addr_hit[2] && reg_we && (PINMUX_PERMIT[2] != (PINMUX_PERMIT[2] & reg_be))) wr_err = 1'b1 ;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700835 if (addr_hit[3] && reg_we && (PINMUX_PERMIT[3] != (PINMUX_PERMIT[3] & reg_be))) wr_err = 1'b1 ;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700836 if (addr_hit[4] && reg_we && (PINMUX_PERMIT[4] != (PINMUX_PERMIT[4] & reg_be))) wr_err = 1'b1 ;
Michael Schaffner51c61442019-10-01 15:49:10 -0700837 end
838
839 assign regen_we = addr_hit[0] & reg_we & ~wr_err;
840 assign regen_wd = reg_wdata[0];
841
Michael Schaffnerfb801932019-10-02 10:49:15 -0700842 assign periph_insel0_in0_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700843 assign periph_insel0_in0_wd = reg_wdata[3:0];
Michael Schaffner51c61442019-10-01 15:49:10 -0700844
Michael Schaffnerfb801932019-10-02 10:49:15 -0700845 assign periph_insel0_in1_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700846 assign periph_insel0_in1_wd = reg_wdata[7:4];
Michael Schaffner51c61442019-10-01 15:49:10 -0700847
Michael Schaffnerfb801932019-10-02 10:49:15 -0700848 assign periph_insel0_in2_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700849 assign periph_insel0_in2_wd = reg_wdata[11:8];
Michael Schaffner51c61442019-10-01 15:49:10 -0700850
Michael Schaffnerfb801932019-10-02 10:49:15 -0700851 assign periph_insel0_in3_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700852 assign periph_insel0_in3_wd = reg_wdata[15:12];
Michael Schaffner51c61442019-10-01 15:49:10 -0700853
Michael Schaffnerfb801932019-10-02 10:49:15 -0700854 assign periph_insel0_in4_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700855 assign periph_insel0_in4_wd = reg_wdata[19:16];
Michael Schaffner51c61442019-10-01 15:49:10 -0700856
Michael Schaffnerfb801932019-10-02 10:49:15 -0700857 assign periph_insel0_in5_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700858 assign periph_insel0_in5_wd = reg_wdata[23:20];
Michael Schaffner51c61442019-10-01 15:49:10 -0700859
Michael Schaffnerfb801932019-10-02 10:49:15 -0700860 assign periph_insel0_in6_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700861 assign periph_insel0_in6_wd = reg_wdata[27:24];
Michael Schaffner51c61442019-10-01 15:49:10 -0700862
Michael Schaffnerfb801932019-10-02 10:49:15 -0700863 assign periph_insel0_in7_we = addr_hit[1] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700864 assign periph_insel0_in7_wd = reg_wdata[31:28];
Michael Schaffner51c61442019-10-01 15:49:10 -0700865
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700866 assign periph_insel1_in8_we = addr_hit[2] & reg_we & ~wr_err;
867 assign periph_insel1_in8_wd = reg_wdata[3:0];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700868
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700869 assign periph_insel1_in9_we = addr_hit[2] & reg_we & ~wr_err;
870 assign periph_insel1_in9_wd = reg_wdata[7:4];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700871
872 assign periph_insel1_in10_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700873 assign periph_insel1_in10_wd = reg_wdata[11:8];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700874
875 assign periph_insel1_in11_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700876 assign periph_insel1_in11_wd = reg_wdata[15:12];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700877
878 assign periph_insel1_in12_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700879 assign periph_insel1_in12_wd = reg_wdata[19:16];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700880
881 assign periph_insel1_in13_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700882 assign periph_insel1_in13_wd = reg_wdata[23:20];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700883
884 assign periph_insel1_in14_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700885 assign periph_insel1_in14_wd = reg_wdata[27:24];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700886
887 assign periph_insel1_in15_we = addr_hit[2] & reg_we & ~wr_err;
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700888 assign periph_insel1_in15_wd = reg_wdata[31:28];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700889
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700890 assign mio_outsel0_out0_we = addr_hit[3] & reg_we & ~wr_err;
891 assign mio_outsel0_out0_wd = reg_wdata[4:0];
Michael Schaffner51c61442019-10-01 15:49:10 -0700892
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700893 assign mio_outsel0_out1_we = addr_hit[3] & reg_we & ~wr_err;
894 assign mio_outsel0_out1_wd = reg_wdata[9:5];
Michael Schaffner51c61442019-10-01 15:49:10 -0700895
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700896 assign mio_outsel0_out2_we = addr_hit[3] & reg_we & ~wr_err;
897 assign mio_outsel0_out2_wd = reg_wdata[14:10];
Michael Schaffner51c61442019-10-01 15:49:10 -0700898
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700899 assign mio_outsel0_out3_we = addr_hit[3] & reg_we & ~wr_err;
900 assign mio_outsel0_out3_wd = reg_wdata[19:15];
Michael Schaffner51c61442019-10-01 15:49:10 -0700901
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700902 assign mio_outsel0_out4_we = addr_hit[3] & reg_we & ~wr_err;
903 assign mio_outsel0_out4_wd = reg_wdata[24:20];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700904
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700905 assign mio_outsel0_out5_we = addr_hit[3] & reg_we & ~wr_err;
906 assign mio_outsel0_out5_wd = reg_wdata[29:25];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700907
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700908 assign mio_outsel1_out6_we = addr_hit[4] & reg_we & ~wr_err;
909 assign mio_outsel1_out6_wd = reg_wdata[4:0];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700910
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700911 assign mio_outsel1_out7_we = addr_hit[4] & reg_we & ~wr_err;
912 assign mio_outsel1_out7_wd = reg_wdata[9:5];
Michael Schaffnerfb801932019-10-02 10:49:15 -0700913
Michael Schaffner51c61442019-10-01 15:49:10 -0700914 // Read data return
915 always_comb begin
916 reg_rdata_next = '0;
917 unique case (1'b1)
918 addr_hit[0]: begin
919 reg_rdata_next[0] = regen_qs;
920 end
921
922 addr_hit[1]: begin
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700923 reg_rdata_next[3:0] = periph_insel0_in0_qs;
924 reg_rdata_next[7:4] = periph_insel0_in1_qs;
925 reg_rdata_next[11:8] = periph_insel0_in2_qs;
926 reg_rdata_next[15:12] = periph_insel0_in3_qs;
927 reg_rdata_next[19:16] = periph_insel0_in4_qs;
928 reg_rdata_next[23:20] = periph_insel0_in5_qs;
929 reg_rdata_next[27:24] = periph_insel0_in6_qs;
930 reg_rdata_next[31:28] = periph_insel0_in7_qs;
Michael Schaffner51c61442019-10-01 15:49:10 -0700931 end
932
933 addr_hit[2]: begin
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700934 reg_rdata_next[3:0] = periph_insel1_in8_qs;
935 reg_rdata_next[7:4] = periph_insel1_in9_qs;
936 reg_rdata_next[11:8] = periph_insel1_in10_qs;
937 reg_rdata_next[15:12] = periph_insel1_in11_qs;
938 reg_rdata_next[19:16] = periph_insel1_in12_qs;
939 reg_rdata_next[23:20] = periph_insel1_in13_qs;
940 reg_rdata_next[27:24] = periph_insel1_in14_qs;
941 reg_rdata_next[31:28] = periph_insel1_in15_qs;
Michael Schaffnerfb801932019-10-02 10:49:15 -0700942 end
943
944 addr_hit[3]: begin
Michael Schaffner7fac2d32019-10-04 10:14:50 -0700945 reg_rdata_next[4:0] = mio_outsel0_out0_qs;
946 reg_rdata_next[9:5] = mio_outsel0_out1_qs;
947 reg_rdata_next[14:10] = mio_outsel0_out2_qs;
948 reg_rdata_next[19:15] = mio_outsel0_out3_qs;
949 reg_rdata_next[24:20] = mio_outsel0_out4_qs;
950 reg_rdata_next[29:25] = mio_outsel0_out5_qs;
951 end
952
953 addr_hit[4]: begin
954 reg_rdata_next[4:0] = mio_outsel1_out6_qs;
955 reg_rdata_next[9:5] = mio_outsel1_out7_qs;
Michael Schaffner51c61442019-10-01 15:49:10 -0700956 end
957
958 default: begin
959 reg_rdata_next = '1;
960 end
961 endcase
962 end
963
964 // Assertions for Register Interface
965 `ASSERT_PULSE(wePulse, reg_we, clk_i, !rst_ni)
966 `ASSERT_PULSE(rePulse, reg_re, clk_i, !rst_ni)
967
968 `ASSERT(reAfterRv, $rose(reg_re || reg_we) |=> tl_o.d_valid, clk_i, !rst_ni)
969
970 `ASSERT(en2addrHit, (reg_we || reg_re) |-> $onehot0(addr_hit), clk_i, !rst_ni)
971
Michael Schaffneree9e8db2019-10-22 17:49:51 -0700972 // this is formulated as an assumption such that the FPV testbenches do disprove this
973 // property by mistake
974 `ASSUME(reqParity, tl_reg_h2d.a_valid |-> tl_reg_h2d.a_user.parity_en == 1'b0, clk_i, !rst_ni)
Michael Schaffner51c61442019-10-01 15:49:10 -0700975
976endmodule