Gather bit-ranges of byte-enable signal in error-wire

Previously, the error wire would be assigned like this:

    assign example_reg_err_mux_in = !((widget_if.r_vld && (widget_if.byte_en[0] || widget_if.byte_en[1] || widget_if.byte_en[2] || widget_if.byte_en[3])) || (widget_if.w_vld && (widget_if.byte_en[0] || widget_if.byte_en[1] || widget_if.byte_en[2] || widget_if.byte_en[3])));

Now, this same line is simplified to:
    assign example_reg_err_mux_in = !((widget_if.r_vld && (|widget_if.byte_en[3:0])) || (widget_if.w_vld && (|widget_if.byte_en[3:0])));
This commit is contained in:
Dennis Potter 2021-11-02 23:17:28 -07:00
parent 8df25ece01
commit 95b9a5a46a
Signed by: Dennis
GPG Key ID: 186A8AD440942BAF

View File

@ -215,11 +215,42 @@ class Register(Component):
# an error. # an error.
# #
# Furthermore, consider an error indication that is set for external registers # Furthermore, consider an error indication that is set for external registers
bytes_read_format = [f"widget_if.byte_en[{x}]" for x in list(map(str, bytes_read))] wdgt_str = 'widget_if.byte_en'
bytes_written_format = [f"widget_if.byte_en[{x}]" for x in list(map(str, bytes_written))]
bytes_read_format = []
bytes_read_sorted = sorted(bytes_read, reverse = True)
prev = msb = bytes_read_sorted[0]
for i in bytes_read_sorted[1:]:
if prev - i > 1:
bytes_read_format.append(
f"|{wdgt_str}[{msb}:{prev}]" if msb > prev else f"{wdgt_str}[{msb}]")
msb = i
if i == bytes_read_sorted[-1]:
bytes_read_format.append(
f"|{wdgt_str}[{msb}:{i}]" if msb > i else f"{wdgt_str}[{msb}]")
prev = i
bytes_written_format = []
bytes_written_sorted = sorted(bytes_written, reverse = True)
prev = msb = bytes_written_sorted[0]
for i in bytes_written_sorted[1:]:
if prev - i > 1:
bytes_written_format.append(
f"|{wdgt_str}[{msb}:{prev}]" if msb > prev else f"{wdgt_str}[{msb}]")
msb = i
if i == bytes_written_sorted[-1]:
bytes_written_format.append(
f"|{wdgt_str}[{msb}:{i}]" if msb > i else f"{wdgt_str}[{msb}]")
prev = i
# Parse mux error-input
sw_err_condition_vec = [] sw_err_condition_vec = []
sw_err_condition_vec.append(self._process_yaml( sw_err_condition_vec.append(self._process_yaml(
Register.templ_dict['sw_err_condition'], Register.templ_dict['sw_err_condition'],
{'rd_byte_list_ored': {'rd_byte_list_ored':