From ace4238ccfce70f77689c085d9c82f91759d0120 Mon Sep 17 00:00:00 2001 From: Dennis Date: Wed, 6 Oct 2021 23:20:55 -0700 Subject: [PATCH] Fix bug in external read-interface In dc37c879, some properties got saved in self.properties of a Component. In that commit, self.properties['sw_rd'] never got set. For that reason, external registers with a read-interface were broken. --- srdl2sv/components/addrmap.py | 2 +- srdl2sv/components/field.py | 7 +++++-- srdl2sv/components/templates/fields.yaml | 8 ++++---- srdl2sv/components/widgets/srdl2sv_amba3ahblite.yaml | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/srdl2sv/components/addrmap.py b/srdl2sv/components/addrmap.py index eb5d9c8..cf70a09 100644 --- a/srdl2sv/components/addrmap.py +++ b/srdl2sv/components/addrmap.py @@ -270,7 +270,7 @@ class AddrMap(Component): return self.process_yaml( self.widget_templ_dict['module_instantiation'], - {'bus_width': self.regwidth} + {'bus_width': self.regwidth-1} ) diff --git a/srdl2sv/components/field.py b/srdl2sv/components/field.py index 6ea7261..92deb2e 100644 --- a/srdl2sv/components/field.py +++ b/srdl2sv/components/field.py @@ -72,13 +72,12 @@ class Field(Component): # Define software access (if applicable) access_rtl['sw_write'] = ([], False) - if obj.get_property('sw') in (AccessType.rw, AccessType.w): + if self.properties['sw_wr']: # Append to list of registers that can write self.writable_by.add(path_wo_field) # This will need a wire to indicate that a write is taking place self.properties['sw_wr_wire'] = True - self.properties['sw_wr'] = True swwe = obj.get_property('swwe') swwel = obj.get_property('swwel') @@ -1232,6 +1231,10 @@ class Field(Component): self.path_underscored_vec = [] self.path_wo_field_vec = [] + # Set some properties that always must be known + self.properties['sw_wr'] = obj.get_property('sw') in (AccessType.rw, AccessType.w) + self.properties['sw_rd'] = obj.get_property('sw') in (AccessType.rw, AccessType.r) + # Save dimensions of unpacked dimension self.array_dimensions = array_dimensions self.total_array_dimensions = array_dimensions diff --git a/srdl2sv/components/templates/fields.yaml b/srdl2sv/components/templates/fields.yaml index 7f0463b..3628d6a 100644 --- a/srdl2sv/components/templates/fields.yaml +++ b/srdl2sv/components/templates/fields.yaml @@ -420,9 +420,9 @@ external_rd_assignments: - name: '{path}_ext_r_data' signal_type: '{field_type}' - name: '{path}_ext_r_ack' - signal_type: 'logic' + signal_type: '' - name: '{path}_ext_r_err' - signal_type: 'logic' + signal_type: '' output_ports: - name: '{path}_ext_r_req' signal_type: 'logic' @@ -461,9 +461,9 @@ external_wr_assignments: signal_type: 'logic [{width}:0]' input_ports: - name: '{path}_ext_w_ack' - signal_type: 'logic' + signal_type: '' - name: '{path}_ext_w_err' - signal_type: 'logic' + signal_type: '' external_wr_mask_segment: rtl: |- {{{width}{{b2r.byte_en[{idx}]}}}} diff --git a/srdl2sv/components/widgets/srdl2sv_amba3ahblite.yaml b/srdl2sv/components/widgets/srdl2sv_amba3ahblite.yaml index 1a897d8..21a7c7b 100644 --- a/srdl2sv/components/widgets/srdl2sv_amba3ahblite.yaml +++ b/srdl2sv/components/widgets/srdl2sv_amba3ahblite.yaml @@ -56,7 +56,7 @@ module_instantiation: - name: 'HTRANS' signal_type: '[1:0]' - name: 'HWDATA' - signal_type: '[{bus_width}-1:0]' + signal_type: '[{bus_width}:0]' - name: 'HSEL' signal_type: '' output_ports: @@ -65,4 +65,4 @@ module_instantiation: - name: 'HRESP' signal_type: '' - name: 'HRDATA' - signal_type: '[{bus_width}-1:0]' + signal_type: '[{bus_width}:0]'