nrf5340_app_pac/cacheinfo_s/set/
way.rs1#[doc = "Register `WAY[%s]` reader"]
2pub struct R(crate::R<WAY_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<WAY_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<WAY_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<WAY_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `WAY[%s]` writer"]
17pub struct W(crate::W<WAY_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<WAY_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<WAY_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<WAY_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `TAG` reader - Cache tag."]
38pub type TAG_R = crate::FieldReader<u32, u32>;
39#[doc = "Field `TAG` writer - Cache tag."]
40pub type TAG_W<'a, const O: u8> = crate::FieldWriter<'a, u32, WAY_SPEC, u32, u32, 17, O>;
41#[doc = "Field `V` reader - Valid bit"]
42pub type V_R = crate::BitReader<V_A>;
43#[doc = "Valid bit\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq)]
45pub enum V_A {
46 #[doc = "0: Invalid cache line"]
47 INVALID = 0,
48 #[doc = "1: Valid cache line"]
49 VALID = 1,
50}
51impl From<V_A> for bool {
52 #[inline(always)]
53 fn from(variant: V_A) -> Self {
54 variant as u8 != 0
55 }
56}
57impl V_R {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub fn variant(&self) -> V_A {
61 match self.bits {
62 false => V_A::INVALID,
63 true => V_A::VALID,
64 }
65 }
66 #[doc = "Checks if the value of the field is `INVALID`"]
67 #[inline(always)]
68 pub fn is_invalid(&self) -> bool {
69 *self == V_A::INVALID
70 }
71 #[doc = "Checks if the value of the field is `VALID`"]
72 #[inline(always)]
73 pub fn is_valid(&self) -> bool {
74 *self == V_A::VALID
75 }
76}
77#[doc = "Field `MRU` reader - Most recently used way."]
78pub type MRU_R = crate::BitReader<MRU_A>;
79#[doc = "Most recently used way.\n\nValue on reset: 0"]
80#[derive(Clone, Copy, Debug, PartialEq)]
81pub enum MRU_A {
82 #[doc = "0: Way0 was most recently used"]
83 WAY0 = 0,
84 #[doc = "1: Way1 was most recently used"]
85 WAY1 = 1,
86}
87impl From<MRU_A> for bool {
88 #[inline(always)]
89 fn from(variant: MRU_A) -> Self {
90 variant as u8 != 0
91 }
92}
93impl MRU_R {
94 #[doc = "Get enumerated values variant"]
95 #[inline(always)]
96 pub fn variant(&self) -> MRU_A {
97 match self.bits {
98 false => MRU_A::WAY0,
99 true => MRU_A::WAY1,
100 }
101 }
102 #[doc = "Checks if the value of the field is `WAY0`"]
103 #[inline(always)]
104 pub fn is_way0(&self) -> bool {
105 *self == MRU_A::WAY0
106 }
107 #[doc = "Checks if the value of the field is `WAY1`"]
108 #[inline(always)]
109 pub fn is_way1(&self) -> bool {
110 *self == MRU_A::WAY1
111 }
112}
113impl R {
114 #[doc = "Bits 0:16 - Cache tag."]
115 #[inline(always)]
116 pub fn tag(&self) -> TAG_R {
117 TAG_R::new((self.bits & 0x0001_ffff) as u32)
118 }
119 #[doc = "Bit 30 - Valid bit"]
120 #[inline(always)]
121 pub fn v(&self) -> V_R {
122 V_R::new(((self.bits >> 30) & 1) != 0)
123 }
124 #[doc = "Bit 31 - Most recently used way."]
125 #[inline(always)]
126 pub fn mru(&self) -> MRU_R {
127 MRU_R::new(((self.bits >> 31) & 1) != 0)
128 }
129}
130impl W {
131 #[doc = "Bits 0:16 - Cache tag."]
132 #[inline(always)]
133 pub fn tag(&mut self) -> TAG_W<0> {
134 TAG_W::new(self)
135 }
136 #[doc = "Writes raw bits to the register."]
137 #[inline(always)]
138 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
139 self.0.bits(bits);
140 self
141 }
142}
143#[doc = "Description collection: Cache information for SET\\[n\\], WAY\\[o\\].\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 [way](index.html) module"]
144pub struct WAY_SPEC;
145impl crate::RegisterSpec for WAY_SPEC {
146 type Ux = u32;
147}
148#[doc = "`read()` method returns [way::R](R) reader structure"]
149impl crate::Readable for WAY_SPEC {
150 type Reader = R;
151}
152#[doc = "`write(|w| ..)` method takes [way::W](W) writer structure"]
153impl crate::Writable for WAY_SPEC {
154 type Writer = W;
155}
156#[doc = "`reset()` method sets WAY[%s]
157to value 0"]
158impl crate::Resettable for WAY_SPEC {
159 #[inline(always)]
160 fn reset_value() -> Self::Ux {
161 0
162 }
163}