soc/interconnect/csr: add fields support for CSRStorage's write simulation method
This commit is contained in:
parent
2567a0ae1d
commit
6de20f185a
|
@ -411,8 +411,15 @@ class CSRStorage(_CompoundCSR):
|
|||
"""Write method for simulation."""
|
||||
yield self.storage.eq(value)
|
||||
yield self.re.eq(1)
|
||||
if hasattr(self, "fields"):
|
||||
for field in [*self.fields.fields]:
|
||||
yield getattr(self.fields, field.name).eq((value >> field.offset) & (2**field.size -1))
|
||||
yield
|
||||
yield self.re.eq(0)
|
||||
if hasattr(self, "fields"):
|
||||
for field in [*self.fields.fields]:
|
||||
if field.pulse:
|
||||
yield getattr(self.fields, field.name).eq(0)
|
||||
|
||||
# AutoCSR & Helpers --------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue