From 33b6e2e946085214c420b4a7b441ffe58098fc50 Mon Sep 17 00:00:00 2001 From: Dennis Date: Sun, 7 Nov 2021 11:36:05 -0800 Subject: [PATCH] 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. --- srdl2sv/components/field.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/srdl2sv/components/field.py b/srdl2sv/components/field.py index e939edc..824f248 100644 --- a/srdl2sv/components/field.py +++ b/srdl2sv/components/field.py @@ -86,20 +86,21 @@ class Field(Component): def add_sw_access(self, obj, alias = False): # Perform some basic checks - if onwrite := obj.get_property('onwrite') \ - and not self.properties['sw_wr']: + onwrite = obj.get_property('onwrite') + onread = obj.get_property('onread') + + if onwrite and not self.properties['sw_wr']: self.logger.fatal("An onwrite property '%s' is defined but "\ "software does not have write-access. This is not "\ "legal.", onwrite) sys.exit(1) - elif onread := obj.get_property('onread') \ - and self.storage_type is not StorageType.FLOPS: - self.logger.warning("Field has an onread property but does not " + elif onread and self.storage_type is not StorageType.FLOPS: + self.logger.warning("Field has an onread property '%s' but does not " "implement a flop. Since the flop itself is " "implemented outside of the register block it is " "advised to remove the property and notify the external " - "hardware by using the 'swacc' property.") + "hardware by using the 'swacc' property.", onread) access_rtl = {}