{#- Error Handling Signal Declarations Template -#}
    // Error Handling Signals
    logic [7:0] error_status = 8'h0;
    logic [7:0] correctable_error_count = 8'h0;
    logic [7:0] uncorrectable_error_count = 8'h0;
    logic error_recovery_active = 1'b0;
    logic [15:0] error_recovery_timer = 16'h0;
    logic [3:0] retry_count = 4'h0;

    // Error Detection Signals
    logic parity_error = 1'b0;
    logic crc_error = 1'b0;
    logic timeout_error = 1'b0;
    logic ecc_error = 1'b0;
    logic [31:0] timeout_counter = 32'h0;

{# Use safe_attr default false to be defensive during template migration #}
{% from "_helpers.j2" import safe_attr %}
{%- if safe_attr(config, 'enable_crc_check', false) %}
    logic [7:0] calculated_crc = 8'h0;
    logic [7:0] expected_crc = 8'h0;
{%- endif %}

{%- if safe_attr(config, 'enable_error_logging', false) %}
    logic [31:0] error_log [0:15];
    logic [3:0] error_log_ptr = 4'h0;
{%- endif %}