blob: 525e43532b6df77907af3e06546b882a70904cfb [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001// 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 name: "gpio",
Rupert Swarbrickd0cbfad2021-06-29 17:04:51 +01006 clocking: [{clock: "clk_i", reset: "rst_ni"}],
Rupert Swarbrick6c831292021-02-25 17:08:53 +00007 bus_interfaces: [
8 { protocol: "tlul", direction: "device" }
9 ],
lowRISC Contributors802543a2019-08-31 12:12:56 +010010 available_inout_list: [
11 { name: "gpio",
12 width: 32,
13 desc: "GPIO inout to/from PAD"
14 }
15 ],
16 interrupt_list: [
17 { name: "gpio",
18 width: 32,
19 desc: "raised if any of GPIO pin detects configured interrupt mode"
20 }
21 ],
Michael Schaffner0281a862021-06-04 18:25:28 -070022 alert_list: [
23 { name: "fatal_fault",
24 desc: '''
Michael Schaffner99e89372021-06-25 17:33:33 -070025 This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
Michael Schaffner0281a862021-06-04 18:25:28 -070026 '''
27 }
28 ],
Michael Schaffner757a4092022-01-05 04:35:45 -080029 param_list: [
30 { name: "GpioAsyncOn",
31 type: "bit",
32 default: "1'b1",
33 desc: '''
34 Instantiates 2-flop synchronizers on all GPIO inputs if set to 1.
35 '''
36 local: "false",
37 expose: "true"
38 },
39 ]
Michael Schaffner17626932021-12-13 09:10:43 -080040 countermeasures: [
41 { name: "BUS.INTEGRITY",
42 desc: "End-to-end bus integrity scheme."
43 }
44 ]
lowRISC Contributors802543a2019-08-31 12:12:56 +010045
46 regwidth: "32",
47 registers: [
48 { name: "DATA_IN",
49 desc: "GPIO Input data read value",
50 swaccess: "ro",
51 hwaccess: "hwo",
Cindy Chen85aca772020-02-26 14:29:56 -080052 tags: [// data_in is ro register, so exclude its readback check
53 "excl:CsrNonInitTests:CsrExclWriteCheck"],
lowRISC Contributors802543a2019-08-31 12:12:56 +010054 fields: [
55 { bits: "31:0",
56 resval: "x"
57 }
58 ],
59 },
60 { name: "DIRECT_OUT",
61 desc: "GPIO direct output data write value",
62 swaccess: "rw",
63 hwaccess: "hrw",
64 hwext: "true",
65 hwqe: "true",
66 fields: [
67 { bits: "31:0" }
68 ],
69 },
70 { name: "MASKED_OUT_LOWER",
71 desc: '''GPIO write data lower with mask.
72
73 Masked write for DATA_OUT[15:0].
74
75 Upper 16 bits of this register are used as mask. Writing
76 lower 16 bits of the register changes DATA_OUT[15:0] value
77 if mask bits are set.
78
79 Read-back of this register returns upper 16 bits as zero
80 and lower 16 bits as DATA_OUT[15:0].
81 '''
82 swaccess: "rw",
83 hwaccess: "hrw",
84 hwext: "true",
85 hwqe: "true",
Cindy Chen85aca772020-02-26 14:29:56 -080086 tags: [// read value of masked_* registers yield a different value than written
87 // avoid writing to masked_out* registers as they affect direct_out value
88 "excl:CsrNonInitTests:CsrExclAll"],
lowRISC Contributors802543a2019-08-31 12:12:56 +010089 fields: [
90 { bits: "15:0",
91 name: "data",
92 desc: '''Write data value[15:0].
93
94 Value to write into DATA_OUT[i], valid in the presence of mask[i]==1
95 '''
96 },
97 { bits: "31:16",
98 name: "mask",
99 desc: '''Write data mask[15:0].
100
101 A value of 1 in mask[i] allows the updating of DATA_OUT[i], 0 <= i <= 15
102 '''
103 swaccess: "wo"
104 },
105 ],
106 },
107 { name: "MASKED_OUT_UPPER",
108 desc: '''GPIO write data upper with mask.
109
110 Masked write for DATA_OUT[31:16].
111
112 Upper 16 bits of this register are used as mask. Writing
113 lower 16 bits of the register changes DATA_OUT[31:16] value
114 if mask bits are set.
115
116 Read-back of this register returns upper 16 bits as zero
117 and lower 16 bits as DATA_OUT[31:16].
118 '''
119 swaccess: "rw",
120 hwaccess: "hrw",
121 hwext: "true",
122 hwqe: "true",
Cindy Chen85aca772020-02-26 14:29:56 -0800123 tags: [// read value of masked_* registers yield a different value than written
124 // avoid writing to masked_out* registers as they affect direct_out value
125 "excl:CsrNonInitTests:CsrExclAll"],
lowRISC Contributors802543a2019-08-31 12:12:56 +0100126 fields: [
127 { bits: "15:0",
128 name: "data",
129 desc: '''Write data value[31:16].
130
131 Value to write into DATA_OUT[i], valid in the presence of mask[i]==1
132 '''
133 },
134 { bits: "31:16",
135 name: "mask",
136 desc: '''Write data mask[31:16].
137
138 A value of 1 in mask[i] allows the updating of DATA_OUT[i], 16 <= i <= 31
139 '''
140 swaccess: "wo"
141 },
142 ],
143 },
144 { name: "DIRECT_OE",
145 desc: '''GPIO Output Enable.
146
147 Setting direct_oe[i] to 1 enables output mode for GPIO[i]
148 ''',
149 swaccess: "rw",
150 hwaccess: "hrw",
151 hwext: "true",
152 hwqe: "true",
153 fields: [
154 { bits: "31:0" }
155 ],
156 },
157 { name: "MASKED_OE_LOWER",
158 desc: '''GPIO write Output Enable lower with mask.
159
160 Masked write for DATA_OE[15:0], the register that controls
161 output mode for GPIO pins [15:0].
162
163 Upper 16 bits of this register are used as mask. Writing
164 lower 16 bits of the register changes DATA_OE[15:0] value
165 if mask bits are set.
166
167 Read-back of this register returns upper 16 bits as zero
168 and lower 16 bits as DATA_OE[15:0].
169 ''',
170 swaccess: "rw",
171 hwaccess: "hrw",
172 hwext: "true",
173 hwqe: "true",
Cindy Chen85aca772020-02-26 14:29:56 -0800174 tags: [// read value of masked_* registers yield a different value than written
175 // avoid writing to masked_oe* registers as they affect direct_oe value
176 "excl:CsrNonInitTests:CsrExclAll"],
lowRISC Contributors802543a2019-08-31 12:12:56 +0100177 fields: [
178 { bits: "15:0",
179 name: "data",
180 desc: '''Write OE value[15:0].
181
182 Value to write into DATA_OE[i], valid in the presence of mask[i]==1
183 ''',
184 },
185 { name: "mask",
186 desc: '''Write OE mask[15:0].
187
188 A value of 1 in mask[i] allows the updating of DATA_OE[i], 0 <= i <= 15
189 ''',
190 bits: "31:16"
191 },
192 ],
193 },
194 { name: "MASKED_OE_UPPER",
195 desc: '''GPIO write Output Enable upper with mask.
196
197 Masked write for DATA_OE[31:16], the register that controls
198 output mode for GPIO pins [31:16].
199
200 Upper 16 bits of this register are used as mask. Writing
201 lower 16 bits of the register changes DATA_OE[31:16] value
202 if mask bits are set.
203
204 Read-back of this register returns upper 16 bits as zero
205 and lower 16 bits as DATA_OE[31:16].
206 ''',
207 swaccess: "rw",
208 hwaccess: "hrw",
209 hwext: "true",
210 hwqe: "true",
Cindy Chen85aca772020-02-26 14:29:56 -0800211 tags: [// read value of masked_* registers yield a different value than written
212 // avoid writing to masked_oe* registers as they affect direct_oe value
213 "excl:CsrNonInitTests:CsrExclAll"],
lowRISC Contributors802543a2019-08-31 12:12:56 +0100214 fields: [
215 { bits: "15:0",
216 name: "data",
217 desc: '''Write OE value[31:16].
218
219 Value to write into DATA_OE[i], valid in the presence of mask[i]==1
220 ''',
221 },
222 { name: "mask",
223 desc: '''Write OE mask[31:16].
224
225 A value of 1 in mask[i] allows the updating of DATA_OE[i], 16 <= i <= 31
226 ''',
227 bits: "31:16"
228 },
229 ],
230 },
231
232 { name: "INTR_CTRL_EN_RISING",
233 desc: '''GPIO interrupt enable for GPIO, rising edge.
234
235 If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_RISING[i]
236 enables rising-edge interrupt detection on GPIO[i].
237 ''',
238 swaccess: "rw",
239 hwaccess: "hro",
240 fields: [
241 { bits: "31:0" }
242 ],
243 },
244 { name: "INTR_CTRL_EN_FALLING",
245 desc: '''GPIO interrupt enable for GPIO, falling edge.
246
247 If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_FALLING[i]
248 enables falling-edge interrupt detection on GPIO[i].
249 ''',
250 swaccess: "rw",
251 hwaccess: "hro",
252 fields: [
253 { bits: "31:0" }
254 ],
255 },
256 { name: "INTR_CTRL_EN_LVLHIGH",
257 desc: '''GPIO interrupt enable for GPIO, level high.
258
259 If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_LVLHIGH[i]
260 enables level high interrupt detection on GPIO[i].
261 ''',
262 swaccess: "rw",
263 hwaccess: "hro",
264 fields: [
265 { bits: "31:0" }
266 ],
267 },
268 { name: "INTR_CTRL_EN_LVLLOW",
269 desc: '''GPIO interrupt enable for GPIO, level low.
270
271 If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_LVLLOW[i]
272 enables level low interrupt detection on GPIO[i].
273 ''',
274 swaccess: "rw",
275 hwaccess: "hro",
276 fields: [
277 { bits: "31:0" }
278 ],
279 },
280 { name: "CTRL_EN_INPUT_FILTER",
281 desc: '''filter enable for GPIO input bits.
282
283 If !!CTRL_EN_INPUT_FILTER[i] is true, a value of input bit [i]
284 must be stable for 16 cycles before transitioning.
285 ''',
286 swaccess: "rw",
287 hwaccess: "hro",
288 fields: [
289 { bits: "31:0" }
290 ],
291 },
292 ],
293}