From: Florent Kermarrec Date: Mon, 2 Dec 2019 08:44:44 +0000 (+0100) Subject: soc/interconnect/csr: add fields support for CSRStorage's write simulation method X-Git-Tag: 24jan2021_ls180~834 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6de20f185a280de852a76134a6ae5c0a81adec2a;p=litex.git soc/interconnect/csr: add fields support for CSRStorage's write simulation method --- diff --git a/litex/soc/interconnect/csr.py b/litex/soc/interconnect/csr.py index a7defd0a..75a7c488 100644 --- a/litex/soc/interconnect/csr.py +++ b/litex/soc/interconnect/csr.py @@ -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 --------------------------------------------------------------------------------