mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
soc/interconnect/csr/CSRConstant: Add constant attribute.
This commit is contained in:
parent
4a5ce77d40
commit
be23a059ff
1 changed files with 4 additions and 3 deletions
|
@ -61,15 +61,16 @@ class CSRConstant(DUID):
|
|||
|
||||
def __init__(self, value, bits_sign=None, name=None):
|
||||
DUID.__init__(self)
|
||||
self.value = Constant(value, bits_sign)
|
||||
self.name = get_obj_var_name(name)
|
||||
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 ----------------------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in a new issue