forked from lowRISC/opentitan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadc_ctrl.hjson
351 lines (340 loc) · 10.5 KB
/
adc_ctrl.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
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{ name: "adc_ctrl",
human_name: "ADC Controller",
one_line_desc: "Low-power controller for a dual-channel ADC with filtering and debouncing capability",
one_paragraph_desc: '''
Analog to Digital Converter (ADC) Controller provides a simple front-end to an analog block that allows filtering and debouncing of the sampled data.
ADC Controller supports 2 ADC channels and 8 filters on the values from the channels.
It has debounce timers on the filter output and supports ADCs with 10-bit output.
To enable usage while the device is sleeping, it runs on a slow always-on clock.
In addition, it has a low power periodic scan mode for monitoring ADC channels.
'''
design_spec: "../doc",
dv_doc: "../doc/dv",
hw_checklist: "../doc/checklist",
sw_checklist: "/sw/device/lib/dif/dif_adc_ctrl",
version: "1.0",
life_stage: "L1",
design_stage: "D3",
verification_stage: "V2S",
dif_stage: "S2",
notes: "",
clocking: [
{clock: "clk_i", reset: "rst_ni", primary: true},
{clock: "clk_aon_i", reset: "rst_aon_ni"}
]
bus_interfaces: [
{ protocol: "tlul", direction: "device" }
],
inter_signal_list: [
{ struct: "adc_ast",
type: "req_rsp",
act: "req",
name: "adc",
package: "ast_pkg",
},
{ struct: "logic",
type: "uni",
act: "req",
name: "wkup_req",
package: "",
}
],
interrupt_list: [
{ name: "match_done",
desc: "ADC match or measurement event done",
}
],
alert_list: [
{ name: "fatal_fault",
desc: '''
This fatal alert is triggered when a fatal TL-UL bus integrity fault is detected.
'''
}
],
wakeup_list: [
{ name: "wkup_req",
desc: "ADC wakeup request",
}
],
param_list: [
{ name: "NumAdcFilter",
type: "int",
default: "8",
desc: "Number for ADC filters",
local: "true",
}
{ name: "NumAdcChannel",
type: "int",
default: "2",
desc: "Number for ADC channels",
local: "true",
}
],
countermeasures: [
{ name: "BUS.INTEGRITY",
desc: "End-to-end bus integrity scheme."
}
]
regwidth: "32",
registers: [
{ name: "adc_en_ctl",
desc: "ADC enable control register",
swaccess: "rw",
hwaccess: "hro",
resval: "0",
async: "clk_aon_i",
fields: [
{ bits: "0",
name: "adc_enable",
desc: "1'b0: to power down ADC and ADC_CTRL FSM will enter the reset state; 1'b1: to power up ADC and ADC_CTRL FSM will start",
tags: [
// Writes to ADC_EN_CTRL.ADC_ENABLE will cause side effects
"excl:CsrNonInitTests:CsrExclWrite:CsrExclWriteCheck"
]
}
{ bits: "1",
name: "oneshot_mode",
desc: "Oneshot mode does not care about the filter value. 1'b0: disable; 1'b1: enable",
}
]
}
{ name: "adc_pd_ctl",
desc: "ADC PowerDown(PD) control register",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
fields: [
{ bits: "0",
name: "lp_mode",
desc: "1'b0: adc_pd is disabled, use adc_sample_ctl. 1'b1: adc_pd is enabled, use both adc_lp_sample_ctl & adc_sample_ctl",
resval: "0",
}
{ bits: "7:4",
name: "pwrup_time",
desc: '''
ADC power up time, measured in always on clock cycles.
After power up time is reached, the ADC controller needs one additional cycle before an ADC channel is selected for access.
'''
resval: "7",
}
{ bits: "31:8",
name: "wakeup_time",
desc: "How often FSM wakes up from ADC PD mode to take a sample, measured in always on clock cycles.",
resval: "1600",
}
]
}
{ name: "adc_lp_sample_ctl",
desc: "ADC Low-Power(LP) sample control register",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
fields: [
{ bits: "7:0",
name: "lp_sample_cnt",
desc: '''
The number of samples in low-power mode when the low-power mode is enabled.
After the programmed number is met, ADC won't be powered down any more.
This value must be 1 or larger.
''',
resval: "4",
}
],
}
{ name: "adc_sample_ctl",
desc: "ADC sample control register",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
resval: "155",
fields: [
{ bits: "15:0",
name: "np_sample_cnt",
desc: '''
The number of samples in normal-power mode to meet the debounce spec.
Used after the low-power mode condition is met or in the normal power mode.
This value must be 1 or larger.
''',
}
]
}
{ name: "adc_fsm_rst",
desc: "ADC FSM reset control",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "0",
name: "rst_en",
desc: "1'b0: Normal functional mode. 1'b1: SW to reset all the FSMs and timers",
}
]
}
{ multireg: {
name: "adc_chn0_filter_ctl",
desc: '''ADC channel0 filter range
Up to 8 filters can be configured per channel and each filter has an associated [min, max] range.
The condition bit then defines whether the sample values of that channel need to lie within the range or outside to create a match.
The filter range bounds can be configured with a granularity of 2.148mV.
''',
count: "NumAdcFilter",
cname: "ADC_CTRL",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "11:2",
name: "min_v",
desc: "10-bit for chn0 filter min value ",
}
{ bits: "12",
name: "cond",
desc: "1-bit for the condition; 1'b0 means min<=ADC<=max, 1'b1 means ADC>max or ADC<min ",
}
{ bits: "27:18",
name: "max_v",
desc: "10-bit for chn0 filter max value ",
},
{ bits: "31",
name: "EN",
desc: "Enable for filter",
}
],
}
}
{ multireg: {
name: "adc_chn1_filter_ctl",
desc: '''ADC channel1 filter range
Up to 8 filters can be configured per channel and each filter has an associated [min, max] range.
The condition bit then defines whether the sample values of that channel need to lie within the range or outside to create a match.
The filter range bounds can be configured with a granularity of 2.148mV.
''',
count: "NumAdcFilter",
cname: "ADC_CTRL",
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "11:2",
name: "min_v",
desc: "10-bit for chn0 filter min value ",
}
{ bits: "12",
name: "cond",
desc: "1-bit for the condition; 1'b0 means min<=ADC<=max, 1'b1 means ADC>max or ADC<min ",
}
{ bits: "27:18",
name: "max_v",
desc: "10-bit for chn0 filter max value ",
},
{ bits: "31",
name: "EN",
desc: "Enable for filter",
}
],
}
},
{ multireg: {
name: "adc_chn_val",
desc: "ADC value sampled on channel",
count: "NumAdcChannel",
cname: "ADC_CTRL",
swaccess: "ro",
hwaccess: "hwo",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "1:0",
name: "adc_chn_value_ext",
desc: "2-bit extension; RO 0",
}
{ bits: "11:2",
name: "adc_chn_value",
desc: "Latest ADC value sampled on channel. each step is 2.148mV",
}
{ bits: "17:16",
name: "adc_chn_value_intr_ext",
desc: "2-bit extension; RO 0",
}
{ bits: "27:18",
name: "adc_chn_value_intr",
desc: "ADC value sampled on channel when the interrupt is raised(debug cable is attached or disconnected), each step is 2.148mV",
}
],
}
}
{ name: "adc_wakeup_ctl",
desc: '''
Enable filter matches as wakeups
''',
swaccess: "rw",
hwaccess: "hro",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "NumAdcFilter-1:0",
name: "EN",
desc: "0: filter match wil not generate wakeupe; 1: filter match will generate wakeup",
}
]
}
{ name: "filter_status",
desc: '''
Adc filter match status
Indicates whether a particular filter has matched on all channels.
''',
swaccess: "rw1c",
hwaccess: "hrw",
async: "clk_aon_i",
resval: "0",
fields: [
{ bits: "7:0",
name: "COND",
desc: "0: filter condition is not met; 1: filter condition is met",
}
]
}
{ name: "adc_intr_ctl",
desc: '''
Interrupt enable controls.
adc_ctrl sends out only 1 interrupt, so this register controls
which internal sources are actually registered.
This register uses the same bit enumeration as !!ADC_INTR_STATUS
''',
swaccess: "rw",
hwaccess: "hro",
resval: "0",
fields: [
{ bits: "8:0",
name: "EN",
desc: "0: interrupt source is not enabled; 1: interrupt source is enabled",
}
]
}
{ name: "adc_intr_status",
desc: "Debug cable internal status",
swaccess: "rw1c",
hwaccess: "hrw",
resval: "0",
tags: [ // the value of these regs is determined by the
// value on the pins, hence it cannot be predicted.
"excl:CsrNonInitTests:CsrExclCheck"],
fields: [
{ bits: "NumAdcFilter-1:0",
name: "filter_match",
desc: "0: filter condition is not met; 1: filter condition is met",
}
{ bits: "NumAdcFilter:NumAdcFilter",
name: "oneshot",
desc: "0: oneshot sample is not done ; 1: oneshot sample is done",
}
]
}
],
}