mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/csr: ValueError if write would be truncated in simulation
This commit is contained in:
parent
04e9ffa2b2
commit
053e540b8a
1 changed files with 2 additions and 0 deletions
|
@ -428,6 +428,8 @@ class CSRStorage(_CompoundCSR):
|
|||
"""Write method for simulation.
|
||||
|
||||
Side effects: synchronous advances simulation clk by one tick."""
|
||||
if bits_for(value) > self.size:
|
||||
raise ValueError(f"value {value} exceeds range of {self.size} bit CSR {self.name}.")
|
||||
|
||||
yield self.storage.eq(value)
|
||||
yield self.re.eq(1)
|
||||
|
|
Loading…
Reference in a new issue