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
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
#[doc = "Register `WAC` reader"]
pub struct R(crate::R<WAC_SPEC>);
impl core::ops::Deref for R {
    type Target = crate::R<WAC_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl From<crate::R<WAC_SPEC>> for R {
    #[inline(always)]
    fn from(reader: crate::R<WAC_SPEC>) -> Self {
        R(reader)
    }
}
#[doc = "Register `WAC` writer"]
pub struct W(crate::W<WAC_SPEC>);
impl core::ops::Deref for W {
    type Target = crate::W<WAC_SPEC>;
    #[inline(always)]
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl core::ops::DerefMut for W {
    #[inline(always)]
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl From<crate::W<WAC_SPEC>> for W {
    #[inline(always)]
    fn from(writer: crate::W<WAC_SPEC>) -> Self {
        W(writer)
    }
}
#[doc = "Field `MODULUS` reader - Modular Operation Modulus"]
pub type MODULUS_R = crate::FieldReader<u8, MODULUS_A>;
#[doc = "Modular Operation Modulus\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODULUS_A {
    #[doc = "0: Generic modulus. p = 2^256"]
    BIN256 = 0,
    #[doc = "1: Generic modulus. p = 2^128"]
    BIN128 = 1,
    #[doc = "2: Modulus for B-233 and K-233 ECC curves. p(t) = t^233 + t^74 + 1"]
    ECCBIN233P = 2,
    #[doc = "3: Modulus for B-163 and K-163 ECC curves. p(t) = t^163 + t^7 + t^6 + t^3 + 1"]
    ECCBIN163P = 3,
    #[doc = "4: Modulus for GCM. P(t) = t^128 + t^7 + t^2 + t + 1"]
    GCMBIN128 = 4,
    #[doc = "5: Modulus for P-256 ECC curve. p = 2^256 - 2^224 + 2^192 + 2^96 - 1"]
    ECCPRIME256P = 5,
    #[doc = "6: Modulus for P-224 ECC curve. p = 2^224 - 2^96 - 1"]
    ECCPRIME224P = 6,
    #[doc = "7: Modulus for P-192 ECC curve. p = 2^192 - 2^64 - 1"]
    ECCPRIME192P = 7,
    #[doc = "8: P modulus for B-233 ECC curve"]
    ECCBIN233N = 8,
    #[doc = "9: P modulus for K-233 ECC curve"]
    ECCBIN233KN = 9,
    #[doc = "10: P modulus for B-163 ECC curve"]
    ECCBIN163N = 10,
    #[doc = "11: P modulus for K-163 ECC curve"]
    ECCBIN163KN = 11,
    #[doc = "12: P modulus for P-256 ECC curve"]
    ECCPRIME256N = 12,
    #[doc = "13: P modulus for P-224 ECC curve"]
    ECCPRIME224N = 13,
    #[doc = "14: P modulus for P-192 ECC curve"]
    ECCPRIME192N = 14,
}
impl From<MODULUS_A> for u8 {
    #[inline(always)]
    fn from(variant: MODULUS_A) -> Self {
        variant as _
    }
}
impl MODULUS_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<MODULUS_A> {
        match self.bits {
            0 => Some(MODULUS_A::BIN256),
            1 => Some(MODULUS_A::BIN128),
            2 => Some(MODULUS_A::ECCBIN233P),
            3 => Some(MODULUS_A::ECCBIN163P),
            4 => Some(MODULUS_A::GCMBIN128),
            5 => Some(MODULUS_A::ECCPRIME256P),
            6 => Some(MODULUS_A::ECCPRIME224P),
            7 => Some(MODULUS_A::ECCPRIME192P),
            8 => Some(MODULUS_A::ECCBIN233N),
            9 => Some(MODULUS_A::ECCBIN233KN),
            10 => Some(MODULUS_A::ECCBIN163N),
            11 => Some(MODULUS_A::ECCBIN163KN),
            12 => Some(MODULUS_A::ECCPRIME256N),
            13 => Some(MODULUS_A::ECCPRIME224N),
            14 => Some(MODULUS_A::ECCPRIME192N),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `BIN256`"]
    #[inline(always)]
    pub fn is_bin256(&self) -> bool {
        *self == MODULUS_A::BIN256
    }
    #[doc = "Checks if the value of the field is `BIN128`"]
    #[inline(always)]
    pub fn is_bin128(&self) -> bool {
        *self == MODULUS_A::BIN128
    }
    #[doc = "Checks if the value of the field is `ECCBIN233P`"]
    #[inline(always)]
    pub fn is_eccbin233p(&self) -> bool {
        *self == MODULUS_A::ECCBIN233P
    }
    #[doc = "Checks if the value of the field is `ECCBIN163P`"]
    #[inline(always)]
    pub fn is_eccbin163p(&self) -> bool {
        *self == MODULUS_A::ECCBIN163P
    }
    #[doc = "Checks if the value of the field is `GCMBIN128`"]
    #[inline(always)]
    pub fn is_gcmbin128(&self) -> bool {
        *self == MODULUS_A::GCMBIN128
    }
    #[doc = "Checks if the value of the field is `ECCPRIME256P`"]
    #[inline(always)]
    pub fn is_eccprime256p(&self) -> bool {
        *self == MODULUS_A::ECCPRIME256P
    }
    #[doc = "Checks if the value of the field is `ECCPRIME224P`"]
    #[inline(always)]
    pub fn is_eccprime224p(&self) -> bool {
        *self == MODULUS_A::ECCPRIME224P
    }
    #[doc = "Checks if the value of the field is `ECCPRIME192P`"]
    #[inline(always)]
    pub fn is_eccprime192p(&self) -> bool {
        *self == MODULUS_A::ECCPRIME192P
    }
    #[doc = "Checks if the value of the field is `ECCBIN233N`"]
    #[inline(always)]
    pub fn is_eccbin233n(&self) -> bool {
        *self == MODULUS_A::ECCBIN233N
    }
    #[doc = "Checks if the value of the field is `ECCBIN233KN`"]
    #[inline(always)]
    pub fn is_eccbin233kn(&self) -> bool {
        *self == MODULUS_A::ECCBIN233KN
    }
    #[doc = "Checks if the value of the field is `ECCBIN163N`"]
    #[inline(always)]
    pub fn is_eccbin163n(&self) -> bool {
        *self == MODULUS_A::ECCBIN163N
    }
    #[doc = "Checks if the value of the field is `ECCBIN163KN`"]
    #[inline(always)]
    pub fn is_eccbin163kn(&self) -> bool {
        *self == MODULUS_A::ECCBIN163KN
    }
    #[doc = "Checks if the value of the field is `ECCPRIME256N`"]
    #[inline(always)]
    pub fn is_eccprime256n(&self) -> bool {
        *self == MODULUS_A::ECCPRIME256N
    }
    #[doc = "Checks if the value of the field is `ECCPRIME224N`"]
    #[inline(always)]
    pub fn is_eccprime224n(&self) -> bool {
        *self == MODULUS_A::ECCPRIME224N
    }
    #[doc = "Checks if the value of the field is `ECCPRIME192N`"]
    #[inline(always)]
    pub fn is_eccprime192n(&self) -> bool {
        *self == MODULUS_A::ECCPRIME192N
    }
}
#[doc = "Field `MODULUS` writer - Modular Operation Modulus"]
pub type MODULUS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, WAC_SPEC, u8, MODULUS_A, 4, O>;
impl<'a, const O: u8> MODULUS_W<'a, O> {
    #[doc = "Generic modulus. p = 2^256"]
    #[inline(always)]
    pub fn bin256(self) -> &'a mut W {
        self.variant(MODULUS_A::BIN256)
    }
    #[doc = "Generic modulus. p = 2^128"]
    #[inline(always)]
    pub fn bin128(self) -> &'a mut W {
        self.variant(MODULUS_A::BIN128)
    }
    #[doc = "Modulus for B-233 and K-233 ECC curves. p(t) = t^233 + t^74 + 1"]
    #[inline(always)]
    pub fn eccbin233p(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN233P)
    }
    #[doc = "Modulus for B-163 and K-163 ECC curves. p(t) = t^163 + t^7 + t^6 + t^3 + 1"]
    #[inline(always)]
    pub fn eccbin163p(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN163P)
    }
    #[doc = "Modulus for GCM. P(t) = t^128 + t^7 + t^2 + t + 1"]
    #[inline(always)]
    pub fn gcmbin128(self) -> &'a mut W {
        self.variant(MODULUS_A::GCMBIN128)
    }
    #[doc = "Modulus for P-256 ECC curve. p = 2^256 - 2^224 + 2^192 + 2^96 - 1"]
    #[inline(always)]
    pub fn eccprime256p(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME256P)
    }
    #[doc = "Modulus for P-224 ECC curve. p = 2^224 - 2^96 - 1"]
    #[inline(always)]
    pub fn eccprime224p(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME224P)
    }
    #[doc = "Modulus for P-192 ECC curve. p = 2^192 - 2^64 - 1"]
    #[inline(always)]
    pub fn eccprime192p(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME192P)
    }
    #[doc = "P modulus for B-233 ECC curve"]
    #[inline(always)]
    pub fn eccbin233n(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN233N)
    }
    #[doc = "P modulus for K-233 ECC curve"]
    #[inline(always)]
    pub fn eccbin233kn(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN233KN)
    }
    #[doc = "P modulus for B-163 ECC curve"]
    #[inline(always)]
    pub fn eccbin163n(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN163N)
    }
    #[doc = "P modulus for K-163 ECC curve"]
    #[inline(always)]
    pub fn eccbin163kn(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCBIN163KN)
    }
    #[doc = "P modulus for P-256 ECC curve"]
    #[inline(always)]
    pub fn eccprime256n(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME256N)
    }
    #[doc = "P modulus for P-224 ECC curve"]
    #[inline(always)]
    pub fn eccprime224n(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME224N)
    }
    #[doc = "P modulus for P-192 ECC curve"]
    #[inline(always)]
    pub fn eccprime192n(self) -> &'a mut W {
        self.variant(MODULUS_A::ECCPRIME192N)
    }
}
#[doc = "Field `MODOP` reader - Modular Operation Field Type"]
pub type MODOP_R = crate::BitReader<bool>;
#[doc = "Field `MODOP` writer - Modular Operation Field Type"]
pub type MODOP_W<'a, const O: u8> = crate::BitWriter<'a, u32, WAC_SPEC, bool, O>;
#[doc = "Field `MULWIDTH` reader - Multiply Width"]
pub type MULWIDTH_R = crate::FieldReader<u8, MULWIDTH_A>;
#[doc = "Multiply Width\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MULWIDTH_A {
    #[doc = "0: Multiply 256 bits"]
    MUL256 = 0,
    #[doc = "1: Multiply 128 bits"]
    MUL128 = 1,
    #[doc = "2: Same number of bits as specified by MODULUS"]
    MULMOD = 2,
}
impl From<MULWIDTH_A> for u8 {
    #[inline(always)]
    fn from(variant: MULWIDTH_A) -> Self {
        variant as _
    }
}
impl MULWIDTH_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<MULWIDTH_A> {
        match self.bits {
            0 => Some(MULWIDTH_A::MUL256),
            1 => Some(MULWIDTH_A::MUL128),
            2 => Some(MULWIDTH_A::MULMOD),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `MUL256`"]
    #[inline(always)]
    pub fn is_mul256(&self) -> bool {
        *self == MULWIDTH_A::MUL256
    }
    #[doc = "Checks if the value of the field is `MUL128`"]
    #[inline(always)]
    pub fn is_mul128(&self) -> bool {
        *self == MULWIDTH_A::MUL128
    }
    #[doc = "Checks if the value of the field is `MULMOD`"]
    #[inline(always)]
    pub fn is_mulmod(&self) -> bool {
        *self == MULWIDTH_A::MULMOD
    }
}
#[doc = "Field `MULWIDTH` writer - Multiply Width"]
pub type MULWIDTH_W<'a, const O: u8> = crate::FieldWriter<'a, u32, WAC_SPEC, u8, MULWIDTH_A, 2, O>;
impl<'a, const O: u8> MULWIDTH_W<'a, O> {
    #[doc = "Multiply 256 bits"]
    #[inline(always)]
    pub fn mul256(self) -> &'a mut W {
        self.variant(MULWIDTH_A::MUL256)
    }
    #[doc = "Multiply 128 bits"]
    #[inline(always)]
    pub fn mul128(self) -> &'a mut W {
        self.variant(MULWIDTH_A::MUL128)
    }
    #[doc = "Same number of bits as specified by MODULUS"]
    #[inline(always)]
    pub fn mulmod(self) -> &'a mut W {
        self.variant(MULWIDTH_A::MULMOD)
    }
}
#[doc = "Field `RESULTWIDTH` reader - Result Width"]
pub type RESULTWIDTH_R = crate::FieldReader<u8, RESULTWIDTH_A>;
#[doc = "Result Width\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RESULTWIDTH_A {
    #[doc = "0: Results have 256 bits"]
    _256BIT = 0,
    #[doc = "1: Results have 128 bits"]
    _128BIT = 1,
    #[doc = "2: Results have 260 bits. Upper bits of result can be read through DDATA0MSBS in CRYPTO_STATUS"]
    _260BIT = 2,
}
impl From<RESULTWIDTH_A> for u8 {
    #[inline(always)]
    fn from(variant: RESULTWIDTH_A) -> Self {
        variant as _
    }
}
impl RESULTWIDTH_R {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> Option<RESULTWIDTH_A> {
        match self.bits {
            0 => Some(RESULTWIDTH_A::_256BIT),
            1 => Some(RESULTWIDTH_A::_128BIT),
            2 => Some(RESULTWIDTH_A::_260BIT),
            _ => None,
        }
    }
    #[doc = "Checks if the value of the field is `_256BIT`"]
    #[inline(always)]
    pub fn is_256bit(&self) -> bool {
        *self == RESULTWIDTH_A::_256BIT
    }
    #[doc = "Checks if the value of the field is `_128BIT`"]
    #[inline(always)]
    pub fn is_128bit(&self) -> bool {
        *self == RESULTWIDTH_A::_128BIT
    }
    #[doc = "Checks if the value of the field is `_260BIT`"]
    #[inline(always)]
    pub fn is_260bit(&self) -> bool {
        *self == RESULTWIDTH_A::_260BIT
    }
}
#[doc = "Field `RESULTWIDTH` writer - Result Width"]
pub type RESULTWIDTH_W<'a, const O: u8> =
    crate::FieldWriter<'a, u32, WAC_SPEC, u8, RESULTWIDTH_A, 2, O>;
impl<'a, const O: u8> RESULTWIDTH_W<'a, O> {
    #[doc = "Results have 256 bits"]
    #[inline(always)]
    pub fn _256bit(self) -> &'a mut W {
        self.variant(RESULTWIDTH_A::_256BIT)
    }
    #[doc = "Results have 128 bits"]
    #[inline(always)]
    pub fn _128bit(self) -> &'a mut W {
        self.variant(RESULTWIDTH_A::_128BIT)
    }
    #[doc = "Results have 260 bits. Upper bits of result can be read through DDATA0MSBS in CRYPTO_STATUS"]
    #[inline(always)]
    pub fn _260bit(self) -> &'a mut W {
        self.variant(RESULTWIDTH_A::_260BIT)
    }
}
impl R {
    #[doc = "Bits 0:3 - Modular Operation Modulus"]
    #[inline(always)]
    pub fn modulus(&self) -> MODULUS_R {
        MODULUS_R::new((self.bits & 0x0f) as u8)
    }
    #[doc = "Bit 4 - Modular Operation Field Type"]
    #[inline(always)]
    pub fn modop(&self) -> MODOP_R {
        MODOP_R::new(((self.bits >> 4) & 1) != 0)
    }
    #[doc = "Bits 8:9 - Multiply Width"]
    #[inline(always)]
    pub fn mulwidth(&self) -> MULWIDTH_R {
        MULWIDTH_R::new(((self.bits >> 8) & 3) as u8)
    }
    #[doc = "Bits 10:11 - Result Width"]
    #[inline(always)]
    pub fn resultwidth(&self) -> RESULTWIDTH_R {
        RESULTWIDTH_R::new(((self.bits >> 10) & 3) as u8)
    }
}
impl W {
    #[doc = "Bits 0:3 - Modular Operation Modulus"]
    #[inline(always)]
    #[must_use]
    pub fn modulus(&mut self) -> MODULUS_W<0> {
        MODULUS_W::new(self)
    }
    #[doc = "Bit 4 - Modular Operation Field Type"]
    #[inline(always)]
    #[must_use]
    pub fn modop(&mut self) -> MODOP_W<4> {
        MODOP_W::new(self)
    }
    #[doc = "Bits 8:9 - Multiply Width"]
    #[inline(always)]
    #[must_use]
    pub fn mulwidth(&mut self) -> MULWIDTH_W<8> {
        MULWIDTH_W::new(self)
    }
    #[doc = "Bits 10:11 - Result Width"]
    #[inline(always)]
    #[must_use]
    pub fn resultwidth(&mut self) -> RESULTWIDTH_W<10> {
        RESULTWIDTH_W::new(self)
    }
    #[doc = "Writes raw bits to the register."]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.0.bits(bits);
        self
    }
}
#[doc = "Wide Arithmetic Configuration\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [wac](index.html) module"]
pub struct WAC_SPEC;
impl crate::RegisterSpec for WAC_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [wac::R](R) reader structure"]
impl crate::Readable for WAC_SPEC {
    type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [wac::W](W) writer structure"]
impl crate::Writable for WAC_SPEC {
    type Writer = W;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
}
#[doc = "`reset()` method sets WAC to value 0"]
impl crate::Resettable for WAC_SPEC {
    const RESET_VALUE: Self::Ux = 0;
}