Fix regression in OnRead and OnWrite properties

The following tests were failing:
    - test_swacc_properties.test_rclr_rset
    - test_swacc_properties.test_rclr_rset_hw_precedence

The reason for this failure was incorrect usage of the assignment
expression. Due to the lack of parentheses, the onread/onwrite variable
would mostly evaluate to False.
This commit is contained in:
Dennis Potter 2021-11-07 11:36:05 -08:00
parent 0dba725fd3
commit 33b6e2e946
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF

View File

@ -86,20 +86,21 @@ class Field(Component):
def add_sw_access(self, obj, alias = False): def add_sw_access(self, obj, alias = False):
# Perform some basic checks # Perform some basic checks
if onwrite := obj.get_property('onwrite') \ onwrite = obj.get_property('onwrite')
and not self.properties['sw_wr']: onread = obj.get_property('onread')
if onwrite and not self.properties['sw_wr']:
self.logger.fatal("An onwrite property '%s' is defined but "\ self.logger.fatal("An onwrite property '%s' is defined but "\
"software does not have write-access. This is not "\ "software does not have write-access. This is not "\
"legal.", onwrite) "legal.", onwrite)
sys.exit(1) sys.exit(1)
elif onread := obj.get_property('onread') \ elif onread and self.storage_type is not StorageType.FLOPS:
and self.storage_type is not StorageType.FLOPS: self.logger.warning("Field has an onread property '%s' but does not "
self.logger.warning("Field has an onread property but does not "
"implement a flop. Since the flop itself is " "implement a flop. Since the flop itself is "
"implemented outside of the register block it is " "implemented outside of the register block it is "
"advised to remove the property and notify the external " "advised to remove the property and notify the external "
"hardware by using the 'swacc' property.") "hardware by using the 'swacc' property.", onread)
access_rtl = {} access_rtl = {}