pub type R = crate::R<WACrs>;
pub type W = crate::W<WACrs>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MODULUS {
Bin256 = 0,
Bin128 = 1,
Eccbin233p = 2,
Eccbin163p = 3,
Gcmbin128 = 4,
Eccprime256p = 5,
Eccprime224p = 6,
Eccprime192p = 7,
Eccbin233n = 8,
Eccbin233kn = 9,
Eccbin163n = 10,
Eccbin163kn = 11,
Eccprime256n = 12,
Eccprime224n = 13,
Eccprime192n = 14,
}
impl From<MODULUS> for u8 {
#[inline(always)]
fn from(variant: MODULUS) -> Self {
variant as _
}
}
impl crate::FieldSpec for MODULUS {
type Ux = u8;
}
impl crate::IsEnum for MODULUS {}
pub type ModulusR = crate::FieldReader<MODULUS>;
impl ModulusR {
#[inline(always)]
pub const fn variant(&self) -> Option<MODULUS> {
match self.bits {
0 => Some(MODULUS::Bin256),
1 => Some(MODULUS::Bin128),
2 => Some(MODULUS::Eccbin233p),
3 => Some(MODULUS::Eccbin163p),
4 => Some(MODULUS::Gcmbin128),
5 => Some(MODULUS::Eccprime256p),
6 => Some(MODULUS::Eccprime224p),
7 => Some(MODULUS::Eccprime192p),
8 => Some(MODULUS::Eccbin233n),
9 => Some(MODULUS::Eccbin233kn),
10 => Some(MODULUS::Eccbin163n),
11 => Some(MODULUS::Eccbin163kn),
12 => Some(MODULUS::Eccprime256n),
13 => Some(MODULUS::Eccprime224n),
14 => Some(MODULUS::Eccprime192n),
_ => None,
}
}
#[inline(always)]
pub fn is_bin256(&self) -> bool {
*self == MODULUS::Bin256
}
#[inline(always)]
pub fn is_bin128(&self) -> bool {
*self == MODULUS::Bin128
}
#[inline(always)]
pub fn is_eccbin233p(&self) -> bool {
*self == MODULUS::Eccbin233p
}
#[inline(always)]
pub fn is_eccbin163p(&self) -> bool {
*self == MODULUS::Eccbin163p
}
#[inline(always)]
pub fn is_gcmbin128(&self) -> bool {
*self == MODULUS::Gcmbin128
}
#[inline(always)]
pub fn is_eccprime256p(&self) -> bool {
*self == MODULUS::Eccprime256p
}
#[inline(always)]
pub fn is_eccprime224p(&self) -> bool {
*self == MODULUS::Eccprime224p
}
#[inline(always)]
pub fn is_eccprime192p(&self) -> bool {
*self == MODULUS::Eccprime192p
}
#[inline(always)]
pub fn is_eccbin233n(&self) -> bool {
*self == MODULUS::Eccbin233n
}
#[inline(always)]
pub fn is_eccbin233kn(&self) -> bool {
*self == MODULUS::Eccbin233kn
}
#[inline(always)]
pub fn is_eccbin163n(&self) -> bool {
*self == MODULUS::Eccbin163n
}
#[inline(always)]
pub fn is_eccbin163kn(&self) -> bool {
*self == MODULUS::Eccbin163kn
}
#[inline(always)]
pub fn is_eccprime256n(&self) -> bool {
*self == MODULUS::Eccprime256n
}
#[inline(always)]
pub fn is_eccprime224n(&self) -> bool {
*self == MODULUS::Eccprime224n
}
#[inline(always)]
pub fn is_eccprime192n(&self) -> bool {
*self == MODULUS::Eccprime192n
}
}
pub type ModulusW<'a, REG> = crate::FieldWriter<'a, REG, 4, MODULUS>;
impl<'a, REG> ModulusW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn bin256(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Bin256)
}
#[inline(always)]
pub fn bin128(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Bin128)
}
#[inline(always)]
pub fn eccbin233p(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin233p)
}
#[inline(always)]
pub fn eccbin163p(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin163p)
}
#[inline(always)]
pub fn gcmbin128(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Gcmbin128)
}
#[inline(always)]
pub fn eccprime256p(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime256p)
}
#[inline(always)]
pub fn eccprime224p(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime224p)
}
#[inline(always)]
pub fn eccprime192p(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime192p)
}
#[inline(always)]
pub fn eccbin233n(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin233n)
}
#[inline(always)]
pub fn eccbin233kn(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin233kn)
}
#[inline(always)]
pub fn eccbin163n(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin163n)
}
#[inline(always)]
pub fn eccbin163kn(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccbin163kn)
}
#[inline(always)]
pub fn eccprime256n(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime256n)
}
#[inline(always)]
pub fn eccprime224n(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime224n)
}
#[inline(always)]
pub fn eccprime192n(self) -> &'a mut crate::W<REG> {
self.variant(MODULUS::Eccprime192n)
}
}
pub type ModopR = crate::BitReader;
pub type ModopW<'a, REG> = crate::BitWriter<'a, REG>;
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum MULWIDTH {
Mul256 = 0,
Mul128 = 1,
Mulmod = 2,
}
impl From<MULWIDTH> for u8 {
#[inline(always)]
fn from(variant: MULWIDTH) -> Self {
variant as _
}
}
impl crate::FieldSpec for MULWIDTH {
type Ux = u8;
}
impl crate::IsEnum for MULWIDTH {}
pub type MulwidthR = crate::FieldReader<MULWIDTH>;
impl MulwidthR {
#[inline(always)]
pub const fn variant(&self) -> Option<MULWIDTH> {
match self.bits {
0 => Some(MULWIDTH::Mul256),
1 => Some(MULWIDTH::Mul128),
2 => Some(MULWIDTH::Mulmod),
_ => None,
}
}
#[inline(always)]
pub fn is_mul256(&self) -> bool {
*self == MULWIDTH::Mul256
}
#[inline(always)]
pub fn is_mul128(&self) -> bool {
*self == MULWIDTH::Mul128
}
#[inline(always)]
pub fn is_mulmod(&self) -> bool {
*self == MULWIDTH::Mulmod
}
}
pub type MulwidthW<'a, REG> = crate::FieldWriter<'a, REG, 2, MULWIDTH>;
impl<'a, REG> MulwidthW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn mul256(self) -> &'a mut crate::W<REG> {
self.variant(MULWIDTH::Mul256)
}
#[inline(always)]
pub fn mul128(self) -> &'a mut crate::W<REG> {
self.variant(MULWIDTH::Mul128)
}
#[inline(always)]
pub fn mulmod(self) -> &'a mut crate::W<REG> {
self.variant(MULWIDTH::Mulmod)
}
}
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum RESULTWIDTH {
_256bit = 0,
_128bit = 1,
_260bit = 2,
}
impl From<RESULTWIDTH> for u8 {
#[inline(always)]
fn from(variant: RESULTWIDTH) -> Self {
variant as _
}
}
impl crate::FieldSpec for RESULTWIDTH {
type Ux = u8;
}
impl crate::IsEnum for RESULTWIDTH {}
pub type ResultwidthR = crate::FieldReader<RESULTWIDTH>;
impl ResultwidthR {
#[inline(always)]
pub const fn variant(&self) -> Option<RESULTWIDTH> {
match self.bits {
0 => Some(RESULTWIDTH::_256bit),
1 => Some(RESULTWIDTH::_128bit),
2 => Some(RESULTWIDTH::_260bit),
_ => None,
}
}
#[inline(always)]
pub fn is_256bit(&self) -> bool {
*self == RESULTWIDTH::_256bit
}
#[inline(always)]
pub fn is_128bit(&self) -> bool {
*self == RESULTWIDTH::_128bit
}
#[inline(always)]
pub fn is_260bit(&self) -> bool {
*self == RESULTWIDTH::_260bit
}
}
pub type ResultwidthW<'a, REG> = crate::FieldWriter<'a, REG, 2, RESULTWIDTH>;
impl<'a, REG> ResultwidthW<'a, REG>
where
REG: crate::Writable + crate::RegisterSpec,
REG::Ux: From<u8>,
{
#[inline(always)]
pub fn _256bit(self) -> &'a mut crate::W<REG> {
self.variant(RESULTWIDTH::_256bit)
}
#[inline(always)]
pub fn _128bit(self) -> &'a mut crate::W<REG> {
self.variant(RESULTWIDTH::_128bit)
}
#[inline(always)]
pub fn _260bit(self) -> &'a mut crate::W<REG> {
self.variant(RESULTWIDTH::_260bit)
}
}
impl R {
#[inline(always)]
pub fn modulus(&self) -> ModulusR {
ModulusR::new((self.bits & 0x0f) as u8)
}
#[inline(always)]
pub fn modop(&self) -> ModopR {
ModopR::new(((self.bits >> 4) & 1) != 0)
}
#[inline(always)]
pub fn mulwidth(&self) -> MulwidthR {
MulwidthR::new(((self.bits >> 8) & 3) as u8)
}
#[inline(always)]
pub fn resultwidth(&self) -> ResultwidthR {
ResultwidthR::new(((self.bits >> 10) & 3) as u8)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("WAC")
.field("modulus", &self.modulus())
.field("modop", &self.modop())
.field("mulwidth", &self.mulwidth())
.field("resultwidth", &self.resultwidth())
.finish()
}
}
impl W {
#[inline(always)]
pub fn modulus(&mut self) -> ModulusW<'_, WACrs> {
ModulusW::new(self, 0)
}
#[inline(always)]
pub fn modop(&mut self) -> ModopW<'_, WACrs> {
ModopW::new(self, 4)
}
#[inline(always)]
pub fn mulwidth(&mut self) -> MulwidthW<'_, WACrs> {
MulwidthW::new(self, 8)
}
#[inline(always)]
pub fn resultwidth(&mut self) -> ResultwidthW<'_, WACrs> {
ResultwidthW::new(self, 10)
}
}
pub struct WACrs;
impl crate::RegisterSpec for WACrs {
type Ux = u32;
}
impl crate::Readable for WACrs {}
impl crate::Writable for WACrs {
type Safety = crate::Unsafe;
}
impl crate::Resettable for WACrs {}