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

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