soc/interconnect/csr/CSRConstant: Add constant attribute.

This commit is contained in:
Florent Kermarrec 2022-03-21 18:02:54 +01:00
parent 4a5ce77d40
commit be23a059ff
1 changed files with 4 additions and 3 deletions

View File

@ -63,13 +63,14 @@ class CSRConstant(DUID):
DUID.__init__(self)
self.value = Constant(value, bits_sign)
self.name = get_obj_var_name(name)
self.constant = value
if self.name is None:
raise ValueError("Cannot extract CSR name from code, need to specify.")
def read(self):
"""Read method for simulation."""
yield
return self.value.value
return self.constant
# CSR ----------------------------------------------------------------------------------------------