forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpio.hjson
407 lines (378 loc) · 12.9 KB
/
gpio.hjson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
name: "gpio",
human_name: "General-Purpose I/O Controller",
one_line_desc: "General-purpose I/O pin control interface for software",
one_paragraph_desc: '''
General-Purpose Input/Output (GPIO) Controller allows software to communicate through general-purpose I/O pins in a flexible manner.
It supports up to 32 GPIO ports and each of these ports can be written as peripheral outputs in two modes: either with direct access to each GPIO value using direct write, allowing software to control all GPIO ports simultaneously, or with masked writes to half of the bits at a time, allowing software to affect the output value of a subset of the bits without requiring a read-modify-write.
In the input direction, software can read the contents of any of the GPIO peripheral inputs, and it can request the detection of an interrupt event for any of the 32 bits in a configurable manner for detecting rising edge, falling edge, or active low/high input.
A noise filter is available through configuration for any of the inputs.
'''
// Unique comportable IP identifier defined under KNOWN_CIP_IDS in the regtool.
cip_id: "9",
design_spec: "../doc",
dv_doc: "../doc/dv",
hw_checklist: "../doc/checklist",
sw_checklist: "/sw/device/lib/dif/dif_gpio",
revisions: [
{
version: "1.0.0",
life_stage: "L2",
design_stage: "D3",
verification_stage: "V3",
commit_id: "c1be7eb2b7265cd5ba6ceb026c28acf8e371151a",
notes: "",
}
{
version: "1.2.0",
life_stage: "L1",
design_stage: "D3",
verification_stage: "V2S",
dif_stage: "S2",
notes: ""
}
]
clocking: [{clock: "clk_i", reset: "rst_ni"}],
bus_interfaces: [
{ protocol: "tlul", direction: "device" }
],
available_inout_list: [
{ name: "gpio",
width: 32,
desc: "GPIO inout to/from PAD"
}
],
interrupt_list: [
{ name: "gpio",
width: 32,
desc: "raised if any of GPIO pin detects configured interrupt mode"
auto_split: "true"
}
],
alert_list: [
{ name: "fatal_fault",
desc: '''
This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
'''
}
],
param_list: [
{ name: "GpioAsyncOn",
type: "bit",
default: "1'b1",
desc: '''
Instantiates 2-flop synchronizers on all GPIO inputs if set to 1.
'''
local: "false",
expose: "true"
},
{ name: "GpioAsHwStrapsEn",
type: "bit",
default: "1'b1",
desc: '''
Enable HW straps sampling logic for GPIO inputs at initial cold boot
'''
local: "false",
expose: "true"
},
]
countermeasures: [
{ name: "BUS.INTEGRITY",
desc: "End-to-end bus integrity scheme."
}
]
features: [
{
name: "GPIO.IN.INTR_CTRL"
desc: '''Input interrupts can be triggered identified by detecting either level or edge.
There are four detection modes available: rising edge, falling edge, high-level, and low-level.
'''
}
{
name: "GPIO.IN.FILTER"
desc: '''GPIO module provides noise filter control.
It can be enabled with programing GPIO.CTRL_EN_INPUT_FILTER.
Once it enables, input value must be stable for 16cycles before transitioning
'''
}
{
name: "GPIO.OUT.MASK"
desc: 'Masked output access enables to modify either upper or lower 16bits of output register without a Read-Modify-Write.'
}
]
inter_signal_list: [
{ struct: "logic",
type: "uni",
name: "strap_en",
act: "rcv",
package: "",
desc: '''
This signal is pulsed high by the power manager after reset in order to sample the HW straps.
''',
default: "1'b0"
},
{ struct: "gpio_straps",
type: "uni",
name: "sampled_straps",
act: "req",
package: "gpio_pkg",
desc: '''
This vector contains the sampled strap values.
''',
default: "'0"
},
]
regwidth: "32",
registers: [
{ name: "DATA_IN",
desc: "GPIO Input data read value",
swaccess: "ro",
hwaccess: "hwo",
tags: [// data_in is ro register, so exclude its readback check
"excl:CsrNonInitTests:CsrExclWriteCheck"],
fields: [
{ bits: "31:0",
resval: "x"
}
],
},
{ name: "DIRECT_OUT",
desc: "GPIO direct output data write value",
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
fields: [
{ bits: "31:0" }
],
},
{ name: "MASKED_OUT_LOWER",
desc: '''GPIO write data lower with mask.
Masked write for DATA_OUT[15:0].
Upper 16 bits of this register are used as mask. Writing
lower 16 bits of the register changes DATA_OUT[15:0] value
if mask bits are set.
Read-back of this register returns upper 16 bits as zero
and lower 16 bits as DATA_OUT[15:0].
'''
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
tags: [// read value of masked_* registers yield a different value than written
// avoid writing to masked_out* registers as they affect direct_out value
"excl:CsrNonInitTests:CsrExclAll"],
fields: [
{ bits: "15:0",
name: "data",
desc: '''Write data value[15:0].
Value to write into DATA_OUT[i], valid in the presence of mask[i]==1
'''
},
{ bits: "31:16",
name: "mask",
desc: '''Write data mask[15:0].
A value of 1 in mask[i] allows the updating of DATA_OUT[i], 0 <= i <= 15
'''
swaccess: "wo"
},
],
},
{ name: "MASKED_OUT_UPPER",
desc: '''GPIO write data upper with mask.
Masked write for DATA_OUT[31:16].
Upper 16 bits of this register are used as mask. Writing
lower 16 bits of the register changes DATA_OUT[31:16] value
if mask bits are set.
Read-back of this register returns upper 16 bits as zero
and lower 16 bits as DATA_OUT[31:16].
'''
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
tags: [// read value of masked_* registers yield a different value than written
// avoid writing to masked_out* registers as they affect direct_out value
"excl:CsrNonInitTests:CsrExclAll"],
fields: [
{ bits: "15:0",
name: "data",
desc: '''Write data value[31:16].
Value to write into DATA_OUT[i], valid in the presence of mask[i]==1
'''
},
{ bits: "31:16",
name: "mask",
desc: '''Write data mask[31:16].
A value of 1 in mask[i] allows the updating of DATA_OUT[i], 16 <= i <= 31
'''
swaccess: "wo"
},
],
},
{ name: "DIRECT_OE",
desc: '''GPIO Output Enable.
Setting direct_oe[i] to 1 enables output mode for GPIO[i]
''',
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
fields: [
{ bits: "31:0",
auto_split: "true"
}
],
},
{ name: "MASKED_OE_LOWER",
desc: '''GPIO write Output Enable lower with mask.
Masked write for DATA_OE[15:0], the register that controls
output mode for GPIO pins [15:0].
Upper 16 bits of this register are used as mask. Writing
lower 16 bits of the register changes DATA_OE[15:0] value
if mask bits are set.
Read-back of this register returns upper 16 bits as zero
and lower 16 bits as DATA_OE[15:0].
''',
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
tags: [// read value of masked_* registers yield a different value than written
// avoid writing to masked_oe* registers as they affect direct_oe value
"excl:CsrNonInitTests:CsrExclAll"],
fields: [
{ bits: "15:0",
name: "data",
desc: '''Write OE value[15:0].
Value to write into DATA_OE[i], valid in the presence of mask[i]==1
''',
},
{ name: "mask",
desc: '''Write OE mask[15:0].
A value of 1 in mask[i] allows the updating of DATA_OE[i], 0 <= i <= 15
''',
bits: "31:16"
},
],
},
{ name: "MASKED_OE_UPPER",
desc: '''GPIO write Output Enable upper with mask.
Masked write for DATA_OE[31:16], the register that controls
output mode for GPIO pins [31:16].
Upper 16 bits of this register are used as mask. Writing
lower 16 bits of the register changes DATA_OE[31:16] value
if mask bits are set.
Read-back of this register returns upper 16 bits as zero
and lower 16 bits as DATA_OE[31:16].
''',
swaccess: "rw",
hwaccess: "hrw",
hwext: "true",
hwqe: "true",
tags: [// read value of masked_* registers yield a different value than written
// avoid writing to masked_oe* registers as they affect direct_oe value
"excl:CsrNonInitTests:CsrExclAll"],
fields: [
{ bits: "15:0",
name: "data",
desc: '''Write OE value[31:16].
Value to write into DATA_OE[i], valid in the presence of mask[i]==1
''',
},
{ name: "mask",
desc: '''Write OE mask[31:16].
A value of 1 in mask[i] allows the updating of DATA_OE[i], 16 <= i <= 31
''',
bits: "31:16"
},
],
},
{ name: "INTR_CTRL_EN_RISING",
desc: '''GPIO interrupt enable for GPIO, rising edge.
If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_RISING[i]
enables rising-edge interrupt detection on GPIO[i].
''',
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0" }
],
},
{ name: "INTR_CTRL_EN_FALLING",
desc: '''GPIO interrupt enable for GPIO, falling edge.
If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_FALLING[i]
enables falling-edge interrupt detection on GPIO[i].
''',
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0" }
],
},
{ name: "INTR_CTRL_EN_LVLHIGH",
desc: '''GPIO interrupt enable for GPIO, level high.
If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_LVLHIGH[i]
enables level high interrupt detection on GPIO[i].
''',
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0" }
],
},
{ name: "INTR_CTRL_EN_LVLLOW",
desc: '''GPIO interrupt enable for GPIO, level low.
If !!INTR_ENABLE[i] is true, a value of 1 on !!INTR_CTRL_EN_LVLLOW[i]
enables level low interrupt detection on GPIO[i].
''',
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0" }
],
},
{ name: "CTRL_EN_INPUT_FILTER",
desc: '''filter enable for GPIO input bits.
If !!CTRL_EN_INPUT_FILTER[i] is true, a value of input bit [i]
must be stable for 16 cycles before transitioning.
''',
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "31:0" }
],
},
{ name: "HW_STRAPS_DATA_IN_VALID",
desc: "Indicates whether the data in !!HW_STRAPS_DATA_IN is valid.",
swaccess: "ro",
hwaccess: "hrw",
tags: [// Value in the register is determined by GPIO pin values that are sampled
// at system boot time (typically triggered by the power manager). Hence,
// we exclude both init and non-init checks here.
"excl:CsrAllTests:CsrExclAll"],
fields: [
{ bits: "0",
resval: "0"
}
],
},
{ name: "HW_STRAPS_DATA_IN",
desc: "GPIO Input data sampled as straps during cold boot read value",
swaccess: "ro",
hwaccess: "hrw",
tags: [// Value in the register is determined by GPIO pin values that are sampled
// at system boot time (typically triggered by the power manager). Hence,
// we exclude both init and non-init checks here.
"excl:CsrAllTests:CsrExclAll"],
fields: [
{ bits: "31:0",
resval: "0"
}
],
},
],
}