// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Register Top module auto-generated by `rdl2ot`

`include "prim_assert.sv"

module uart_reg_top (
  input clk_i,
  input rst_ni,
  input  tlul_pkg::tl_h2d_t tl_i,
  output tlul_pkg::tl_d2h_t tl_o,
  // To HW
  output uart_reg_pkg::uart_reg2hw_t reg2hw, // Write
  input  uart_reg_pkg::uart_hw2reg_t hw2reg, // Read

  // Integrity check errors
  output logic intg_err_o
);

  import uart_reg_pkg::* ;

  localparam int AW = 6;
  localparam int DW = 32;
  localparam int DBW = DW/8;                    // Byte Width

  // register signals
  logic           reg_we;
  logic           reg_re;
  logic [AW-1:0]  reg_addr;
  logic [DW-1:0]  reg_wdata;
  logic [DBW-1:0] reg_be;
  logic [DW-1:0]  reg_rdata;
  logic           reg_error;

  logic          addrmiss, wr_err;

  logic [DW-1:0] reg_rdata_next;
  logic reg_busy;

  tlul_pkg::tl_h2d_t tl_reg_h2d;
  tlul_pkg::tl_d2h_t tl_reg_d2h;


  // incoming payload check
  logic intg_err;
  tlul_cmd_intg_chk u_chk (
    .tl_i(tl_i),
    .err_o(intg_err)
  );

  // also check for spurious write enables
  logic reg_we_err;
  logic [12:0] reg_we_check;
  prim_reg_we_check #(
    .OneHotWidth(13)
  ) u_prim_reg_we_check (
    .clk_i(clk_i),
    .rst_ni(rst_ni),
    .oh_i  (reg_we_check),
    .en_i  (reg_we && !addrmiss),
    .err_o (reg_we_err)
  );

  logic err_q;
  always_ff @(posedge clk_i or negedge rst_ni) begin
    if (!rst_ni) begin
      err_q <= '0;
    end else if (intg_err || reg_we_err) begin
      err_q <= 1'b1;
    end
  end

  // integrity error output is permanent and should be used for alert generation
  // register errors are transactional
  assign intg_err_o = err_q | intg_err | reg_we_err;

  // outgoing integrity generation
  tlul_pkg::tl_d2h_t tl_o_pre;
  tlul_rsp_intg_gen #(
    .EnableRspIntgGen(1),
    .EnableDataIntgGen(1)
  ) u_rsp_intg_gen (
    .tl_i(tl_o_pre),
    .tl_o(tl_o)
  );

  assign tl_reg_h2d = tl_i;
  assign tl_o_pre   = tl_reg_d2h;

  tlul_adapter_reg #(
    .RegAw(AW),
    .RegDw(DW),
    .EnableDataIntgGen(0)
  ) u_reg_if (
    .clk_i  (clk_i),
    .rst_ni (rst_ni),

    .tl_i (tl_reg_h2d),
    .tl_o (tl_reg_d2h),

    .en_ifetch_i(prim_mubi_pkg::MuBi4False),
    .intg_error_o(),

    .we_o    (reg_we),
    .re_o    (reg_re),
    .addr_o  (reg_addr),
    .wdata_o (reg_wdata),
    .be_o    (reg_be),
    .busy_i  (reg_busy),
    .rdata_i (reg_rdata),
    .error_i (reg_error)
  );

  // cdc oversampling signals

  assign reg_rdata = reg_rdata_next ;
  assign reg_error = addrmiss | wr_err | intg_err;

  // Define SW related signals
  // Format: <reg>_<field>_{wd|we|qs}
  //        or <reg>_{wd|we|qs} if field == 1 or 0
  logic interrupt_state_we;
  logic interrupt_state_tx_watermark_qs;
  logic interrupt_state_tx_watermark_wd;
  logic interrupt_state_rx_watermark_qs;
  logic interrupt_state_rx_watermark_wd;
  logic interrupt_state_tx_empty_qs;
  logic interrupt_state_tx_empty_wd;
  logic interrupt_state_rx_overflow_qs;
  logic interrupt_state_rx_overflow_wd;
  logic interrupt_state_rx_frame_err_qs;
  logic interrupt_state_rx_frame_err_wd;
  logic interrupt_state_rx_break_err_qs;
  logic interrupt_state_rx_break_err_wd;
  logic interrupt_state_rx_timeout_qs;
  logic interrupt_state_rx_timeout_wd;
  logic interrupt_state_rx_parity_err_qs;
  logic interrupt_state_rx_parity_err_wd;
  logic interrupt_enable_we;
  logic interrupt_enable_tx_watermark_qs;
  logic interrupt_enable_tx_watermark_wd;
  logic interrupt_enable_rx_watermark_qs;
  logic interrupt_enable_rx_watermark_wd;
  logic interrupt_enable_tx_empty_qs;
  logic interrupt_enable_tx_empty_wd;
  logic interrupt_enable_rx_overflow_qs;
  logic interrupt_enable_rx_overflow_wd;
  logic interrupt_enable_rx_frame_err_qs;
  logic interrupt_enable_rx_frame_err_wd;
  logic interrupt_enable_rx_break_err_qs;
  logic interrupt_enable_rx_break_err_wd;
  logic interrupt_enable_rx_timeout_qs;
  logic interrupt_enable_rx_timeout_wd;
  logic interrupt_enable_rx_parity_err_qs;
  logic interrupt_enable_rx_parity_err_wd;
  logic interrupt_test_we;
  logic interrupt_test_tx_watermark_wd;
  logic interrupt_test_rx_watermark_wd;
  logic interrupt_test_tx_empty_wd;
  logic interrupt_test_rx_overflow_wd;
  logic interrupt_test_rx_frame_err_wd;
  logic interrupt_test_rx_break_err_wd;
  logic interrupt_test_rx_timeout_wd;
  logic interrupt_test_rx_parity_err_wd;
  logic alert_test_we;
  logic alert_test_wd;
  logic ctrl_we;
  logic ctrl_tx_qs;
  logic ctrl_tx_wd;
  logic ctrl_rx_qs;
  logic ctrl_rx_wd;
  logic ctrl_nf_qs;
  logic ctrl_nf_wd;
  logic ctrl_slpbk_qs;
  logic ctrl_slpbk_wd;
  logic ctrl_llpbk_qs;
  logic ctrl_llpbk_wd;
  logic ctrl_parity_en_qs;
  logic ctrl_parity_en_wd;
  logic ctrl_parity_odd_qs;
  logic ctrl_parity_odd_wd;
  logic [1:0] ctrl_rxblvl_qs;
  logic [1:0] ctrl_rxblvl_wd;
  logic [15:0] ctrl_nco_qs;
  logic [15:0] ctrl_nco_wd;
  logic status_txfull_qs;
  logic status_rxfull_qs;
  logic status_txempty_qs;
  logic status_txidle_qs;
  logic status_rxidle_qs;
  logic status_rxempty_qs;
  logic [7:0] rdata_qs;
  logic wdata_we;
  logic [7:0] wdata_wd;
  logic fifo_ctrl_we;
  logic fifo_ctrl_rxrst_qs;
  logic fifo_ctrl_rxrst_wd;
  logic fifo_ctrl_txrst_qs;
  logic fifo_ctrl_txrst_wd;
  logic [2:0] fifo_ctrl_rxilvl_qs;
  logic [2:0] fifo_ctrl_rxilvl_wd;
  logic [1:0] fifo_ctrl_txilvl_qs;
  logic [1:0] fifo_ctrl_txilvl_wd;
  logic [5:0] fifo_status_txlvl_qs;
  logic [5:0] fifo_status_rxlvl_qs;
  logic ovrd_we;
  logic ovrd_txen_qs;
  logic ovrd_txen_wd;
  logic ovrd_txval_qs;
  logic ovrd_txval_wd;
  logic [15:0] val_qs;
  logic timeout_ctrl_we;
  logic [23:0] timeout_ctrl_val_qs;
  logic [23:0] timeout_ctrl_val_wd;
  logic timeout_ctrl_en_qs;
  logic timeout_ctrl_en_wd;
  // Register instances
  // R[interrupt_state]: V(False)
  //   F[tx_watermark]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_tx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_tx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.tx_watermark.de),
    .d      (hw2reg.interrupt_state.tx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.tx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_tx_watermark_qs)
  );

  //   F[rx_watermark]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_watermark.de),
    .d      (hw2reg.interrupt_state.rx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_watermark_qs)
  );

  //   F[tx_empty]: 2:2
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_tx_empty (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_tx_empty_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.tx_empty.de),
    .d      (hw2reg.interrupt_state.tx_empty.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.tx_empty.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_tx_empty_qs)
  );

  //   F[rx_overflow]: 3:3
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_overflow (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_overflow_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_overflow.de),
    .d      (hw2reg.interrupt_state.rx_overflow.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_overflow.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_overflow_qs)
  );

  //   F[rx_frame_err]: 4:4
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_frame_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_frame_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_frame_err.de),
    .d      (hw2reg.interrupt_state.rx_frame_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_frame_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_frame_err_qs)
  );

  //   F[rx_break_err]: 5:5
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_break_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_break_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_break_err.de),
    .d      (hw2reg.interrupt_state.rx_break_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_break_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_break_err_qs)
  );

  //   F[rx_timeout]: 6:6
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_timeout (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_timeout_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_timeout.de),
    .d      (hw2reg.interrupt_state.rx_timeout.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_timeout.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_timeout_qs)
  );

  //   F[rx_parity_err]: 7:7
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_state_rx_parity_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_state_we),
    .wd     (interrupt_state_rx_parity_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_state.rx_parity_err.de),
    .d      (hw2reg.interrupt_state.rx_parity_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_state.rx_parity_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_state_rx_parity_err_qs)
  );


  // R[interrupt_enable]: V(False)
  //   F[tx_watermark]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_tx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_tx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.tx_watermark.de),
    .d      (hw2reg.interrupt_enable.tx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.tx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_tx_watermark_qs)
  );

  //   F[rx_watermark]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_watermark.de),
    .d      (hw2reg.interrupt_enable.rx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_watermark_qs)
  );

  //   F[tx_empty]: 2:2
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_tx_empty (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_tx_empty_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.tx_empty.de),
    .d      (hw2reg.interrupt_enable.tx_empty.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.tx_empty.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_tx_empty_qs)
  );

  //   F[rx_overflow]: 3:3
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_overflow (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_overflow_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_overflow.de),
    .d      (hw2reg.interrupt_enable.rx_overflow.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_overflow.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_overflow_qs)
  );

  //   F[rx_frame_err]: 4:4
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_frame_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_frame_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_frame_err.de),
    .d      (hw2reg.interrupt_enable.rx_frame_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_frame_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_frame_err_qs)
  );

  //   F[rx_break_err]: 5:5
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_break_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_break_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_break_err.de),
    .d      (hw2reg.interrupt_enable.rx_break_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_break_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_break_err_qs)
  );

  //   F[rx_timeout]: 6:6
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_timeout (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_timeout_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_timeout.de),
    .d      (hw2reg.interrupt_enable.rx_timeout.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_timeout.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_timeout_qs)
  );

  //   F[rx_parity_err]: 7:7
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessW1C),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_enable_rx_parity_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_enable_we),
    .wd     (interrupt_enable_rx_parity_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_enable.rx_parity_err.de),
    .d      (hw2reg.interrupt_enable.rx_parity_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_enable.rx_parity_err.q),
    .ds     (),

    // to register interface (read)
    .qs     (interrupt_enable_rx_parity_err_qs)
  );


  // R[interrupt_test]: V(False)
  //   F[tx_watermark]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_tx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_tx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.tx_watermark.de),
    .d      (hw2reg.interrupt_test.tx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.tx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_watermark]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_watermark (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_watermark_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_watermark.de),
    .d      (hw2reg.interrupt_test.rx_watermark.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_watermark.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[tx_empty]: 2:2
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_tx_empty (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_tx_empty_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.tx_empty.de),
    .d      (hw2reg.interrupt_test.tx_empty.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.tx_empty.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_overflow]: 3:3
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_overflow (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_overflow_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_overflow.de),
    .d      (hw2reg.interrupt_test.rx_overflow.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_overflow.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_frame_err]: 4:4
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_frame_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_frame_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_frame_err.de),
    .d      (hw2reg.interrupt_test.rx_frame_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_frame_err.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_break_err]: 5:5
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_break_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_break_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_break_err.de),
    .d      (hw2reg.interrupt_test.rx_break_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_break_err.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_timeout]: 6:6
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_timeout (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_timeout_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_timeout.de),
    .d      (hw2reg.interrupt_test.rx_timeout.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_timeout.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );

  //   F[rx_parity_err]: 7:7
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_interrupt_test_rx_parity_err (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (interrupt_test_we),
    .wd     (interrupt_test_rx_parity_err_wd),

    // from internal hardware
    .de     (hw2reg.interrupt_test.rx_parity_err.de),
    .d      (hw2reg.interrupt_test.rx_parity_err.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.interrupt_test.rx_parity_err.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );


  // R[alert_test]: V(False)
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_alert_test (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (alert_test_we),
    .wd     (alert_test_wd),

    // from internal hardware
    .de     (hw2reg.alert_test.de),
    .d      (hw2reg.alert_test.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.alert_test.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );


  // R[ctrl]: V(False)
  //   F[tx]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_tx (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_tx_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.tx.de),
    .d      (hw2reg.ctrl.tx.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.tx.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_tx_qs)
  );

  //   F[rx]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_rx (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_rx_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.rx.de),
    .d      (hw2reg.ctrl.rx.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.rx.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_rx_qs)
  );

  //   F[nf]: 2:2
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_nf (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_nf_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.nf.de),
    .d      (hw2reg.ctrl.nf.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.nf.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_nf_qs)
  );

  //   F[slpbk]: 4:4
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_slpbk (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_slpbk_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.slpbk.de),
    .d      (hw2reg.ctrl.slpbk.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.slpbk.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_slpbk_qs)
  );

  //   F[llpbk]: 5:5
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_llpbk (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_llpbk_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.llpbk.de),
    .d      (hw2reg.ctrl.llpbk.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.llpbk.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_llpbk_qs)
  );

  //   F[parity_en]: 6:6
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_parity_en (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_parity_en_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.parity_en.de),
    .d      (hw2reg.ctrl.parity_en.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.parity_en.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_parity_en_qs)
  );

  //   F[parity_odd]: 7:7
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ctrl_parity_odd (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_parity_odd_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.parity_odd.de),
    .d      (hw2reg.ctrl.parity_odd.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.parity_odd.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_parity_odd_qs)
  );

  //   F[rxblvl]: 9:8
  prim_subreg #(
    .DW      (2),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (2'h0),
    .Mubi    (1'b0)
  ) u_ctrl_rxblvl (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_rxblvl_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.rxblvl.de),
    .d      (hw2reg.ctrl.rxblvl.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.rxblvl.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_rxblvl_qs)
  );

  //   F[nco]: 31:16
  prim_subreg #(
    .DW      (16),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (16'h0),
    .Mubi    (1'b0)
  ) u_ctrl_nco (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ctrl_we),
    .wd     (ctrl_nco_wd),

    // from internal hardware
    .de     (hw2reg.ctrl.nco.de),
    .d      (hw2reg.ctrl.nco.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ctrl.nco.q),
    .ds     (),

    // to register interface (read)
    .qs     (ctrl_nco_qs)
  );


  // R[status]: V(False)
  //   F[txfull]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_status_txfull (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.txfull.de),
    .d      (hw2reg.status.txfull.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.txfull.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_txfull_qs)
  );

  //   F[rxfull]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_status_rxfull (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.rxfull.de),
    .d      (hw2reg.status.rxfull.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.rxfull.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_rxfull_qs)
  );

  //   F[txempty]: 2:2
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h1),
    .Mubi    (1'b0)
  ) u_status_txempty (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.txempty.de),
    .d      (hw2reg.status.txempty.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.txempty.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_txempty_qs)
  );

  //   F[txidle]: 3:3
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h1),
    .Mubi    (1'b0)
  ) u_status_txidle (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.txidle.de),
    .d      (hw2reg.status.txidle.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.txidle.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_txidle_qs)
  );

  //   F[rxidle]: 4:4
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h1),
    .Mubi    (1'b0)
  ) u_status_rxidle (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.rxidle.de),
    .d      (hw2reg.status.rxidle.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.rxidle.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_rxidle_qs)
  );

  //   F[rxempty]: 5:5
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (1'h1),
    .Mubi    (1'b0)
  ) u_status_rxempty (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.status.rxempty.de),
    .d      (hw2reg.status.rxempty.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.status.rxempty.q),
    .ds     (),

    // to register interface (read)
    .qs     (status_rxempty_qs)
  );


  // R[rdata]: V(False)
  prim_subreg #(
    .DW      (8),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (8'h0),
    .Mubi    (1'b0)
  ) u_rdata (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.rdata.de),
    .d      (hw2reg.rdata.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.rdata.q),
    .ds     (),

    // to register interface (read)
    .qs     (rdata_qs)
  );


  // R[wdata]: V(False)
  prim_subreg #(
    .DW      (8),
    .SwAccess(prim_subreg_pkg::SwAccessWO),
    .RESVAL  (8'h0),
    .Mubi    (1'b0)
  ) u_wdata (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (wdata_we),
    .wd     (wdata_wd),

    // from internal hardware
    .de     (hw2reg.wdata.de),
    .d      (hw2reg.wdata.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.wdata.q),
    .ds     (),

    // to register interface (read)
    .qs     ()
  );


  // R[fifo_ctrl]: V(False)
  //   F[rxrst]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_fifo_ctrl_rxrst (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (fifo_ctrl_we),
    .wd     (fifo_ctrl_rxrst_wd),

    // from internal hardware
    .de     (hw2reg.fifo_ctrl.rxrst.de),
    .d      (hw2reg.fifo_ctrl.rxrst.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_ctrl.rxrst.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_ctrl_rxrst_qs)
  );

  //   F[txrst]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_fifo_ctrl_txrst (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (fifo_ctrl_we),
    .wd     (fifo_ctrl_txrst_wd),

    // from internal hardware
    .de     (hw2reg.fifo_ctrl.txrst.de),
    .d      (hw2reg.fifo_ctrl.txrst.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_ctrl.txrst.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_ctrl_txrst_qs)
  );

  //   F[rxilvl]: 4:2
  prim_subreg #(
    .DW      (3),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (3'h0),
    .Mubi    (1'b0)
  ) u_fifo_ctrl_rxilvl (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (fifo_ctrl_we),
    .wd     (fifo_ctrl_rxilvl_wd),

    // from internal hardware
    .de     (hw2reg.fifo_ctrl.rxilvl.de),
    .d      (hw2reg.fifo_ctrl.rxilvl.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_ctrl.rxilvl.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_ctrl_rxilvl_qs)
  );

  //   F[txilvl]: 6:5
  prim_subreg #(
    .DW      (2),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (2'h0),
    .Mubi    (1'b0)
  ) u_fifo_ctrl_txilvl (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (fifo_ctrl_we),
    .wd     (fifo_ctrl_txilvl_wd),

    // from internal hardware
    .de     (hw2reg.fifo_ctrl.txilvl.de),
    .d      (hw2reg.fifo_ctrl.txilvl.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_ctrl.txilvl.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_ctrl_txilvl_qs)
  );


  // R[fifo_status]: V(False)
  //   F[txlvl]: 5:0
  prim_subreg #(
    .DW      (6),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (6'h0),
    .Mubi    (1'b0)
  ) u_fifo_status_txlvl (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.fifo_status.txlvl.de),
    .d      (hw2reg.fifo_status.txlvl.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_status.txlvl.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_status_txlvl_qs)
  );

  //   F[rxlvl]: 21:16
  prim_subreg #(
    .DW      (6),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (6'h0),
    .Mubi    (1'b0)
  ) u_fifo_status_rxlvl (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.fifo_status.rxlvl.de),
    .d      (hw2reg.fifo_status.rxlvl.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.fifo_status.rxlvl.q),
    .ds     (),

    // to register interface (read)
    .qs     (fifo_status_rxlvl_qs)
  );


  // R[ovrd]: V(False)
  //   F[txen]: 0:0
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ovrd_txen (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ovrd_we),
    .wd     (ovrd_txen_wd),

    // from internal hardware
    .de     (hw2reg.ovrd.txen.de),
    .d      (hw2reg.ovrd.txen.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ovrd.txen.q),
    .ds     (),

    // to register interface (read)
    .qs     (ovrd_txen_qs)
  );

  //   F[txval]: 1:1
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_ovrd_txval (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (ovrd_we),
    .wd     (ovrd_txval_wd),

    // from internal hardware
    .de     (hw2reg.ovrd.txval.de),
    .d      (hw2reg.ovrd.txval.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.ovrd.txval.q),
    .ds     (),

    // to register interface (read)
    .qs     (ovrd_txval_qs)
  );


  // R[val]: V(False)
  prim_subreg #(
    .DW      (16),
    .SwAccess(prim_subreg_pkg::SwAccessRO),
    .RESVAL  (16'h0),
    .Mubi    (1'b0)
  ) u_val (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (1'b0),
    .wd     ('0),

    // from internal hardware
    .de     (hw2reg.val.de),
    .d      (hw2reg.val.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.val.q),
    .ds     (),

    // to register interface (read)
    .qs     (val_qs)
  );


  // R[timeout_ctrl]: V(False)
  //   F[val]: 23:0
  prim_subreg #(
    .DW      (24),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (24'h0),
    .Mubi    (1'b0)
  ) u_timeout_ctrl_val (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (timeout_ctrl_we),
    .wd     (timeout_ctrl_val_wd),

    // from internal hardware
    .de     (hw2reg.timeout_ctrl.val.de),
    .d      (hw2reg.timeout_ctrl.val.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.timeout_ctrl.val.q),
    .ds     (),

    // to register interface (read)
    .qs     (timeout_ctrl_val_qs)
  );

  //   F[en]: 31:31
  prim_subreg #(
    .DW      (1),
    .SwAccess(prim_subreg_pkg::SwAccessRW),
    .RESVAL  (1'h0),
    .Mubi    (1'b0)
  ) u_timeout_ctrl_en (
    .clk_i   (clk_i),
    .rst_ni  (rst_ni),

    // from register interface
    .we     (timeout_ctrl_we),
    .wd     (timeout_ctrl_en_wd),

    // from internal hardware
    .de     (hw2reg.timeout_ctrl.en.de),
    .d      (hw2reg.timeout_ctrl.en.d),

    // to internal hardware
    .qe     (),
    .q      (reg2hw.timeout_ctrl.en.q),
    .ds     (),

    // to register interface (read)
    .qs     (timeout_ctrl_en_qs)
  );



  logic [12:0] addr_hit;
  always_comb begin
    addr_hit[ 0] = (reg_addr == UART_INTERRUPT_STATE_OFFSET);
    addr_hit[ 1] = (reg_addr == UART_INTERRUPT_ENABLE_OFFSET);
    addr_hit[ 2] = (reg_addr == UART_INTERRUPT_TEST_OFFSET);
    addr_hit[ 3] = (reg_addr == UART_ALERT_TEST_OFFSET);
    addr_hit[ 4] = (reg_addr == UART_CTRL_OFFSET);
    addr_hit[ 5] = (reg_addr == UART_STATUS_OFFSET);
    addr_hit[ 6] = (reg_addr == UART_RDATA_OFFSET);
    addr_hit[ 7] = (reg_addr == UART_WDATA_OFFSET);
    addr_hit[ 8] = (reg_addr == UART_FIFO_CTRL_OFFSET);
    addr_hit[ 9] = (reg_addr == UART_FIFO_STATUS_OFFSET);
    addr_hit[10] = (reg_addr == UART_OVRD_OFFSET);
    addr_hit[11] = (reg_addr == UART_VAL_OFFSET);
    addr_hit[12] = (reg_addr == UART_TIMEOUT_CTRL_OFFSET);
  end

  assign addrmiss = (reg_re || reg_we) ? ~|addr_hit : 1'b0 ;

  // Check sub-word write is permitted
  always_comb begin
    wr_err = (reg_we &
              ((addr_hit[ 0] & (|(UART_PERMIT[ 0] & ~reg_be))) |
               (addr_hit[ 1] & (|(UART_PERMIT[ 1] & ~reg_be))) |
               (addr_hit[ 2] & (|(UART_PERMIT[ 2] & ~reg_be))) |
               (addr_hit[ 3] & (|(UART_PERMIT[ 3] & ~reg_be))) |
               (addr_hit[ 4] & (|(UART_PERMIT[ 4] & ~reg_be))) |
               (addr_hit[ 5] & (|(UART_PERMIT[ 5] & ~reg_be))) |
               (addr_hit[ 6] & (|(UART_PERMIT[ 6] & ~reg_be))) |
               (addr_hit[ 7] & (|(UART_PERMIT[ 7] & ~reg_be))) |
               (addr_hit[ 8] & (|(UART_PERMIT[ 8] & ~reg_be))) |
               (addr_hit[ 9] & (|(UART_PERMIT[ 9] & ~reg_be))) |
               (addr_hit[10] & (|(UART_PERMIT[10] & ~reg_be))) |
               (addr_hit[11] & (|(UART_PERMIT[11] & ~reg_be))) |
               (addr_hit[12] & (|(UART_PERMIT[12] & ~reg_be)))));
  end

  // Generate write-enables
  assign interrupt_state_we = addr_hit[0] & reg_we & !reg_error;

  assign interrupt_state_tx_watermark_wd = reg_wdata[0];

  assign interrupt_state_rx_watermark_wd = reg_wdata[1];

  assign interrupt_state_tx_empty_wd = reg_wdata[2];

  assign interrupt_state_rx_overflow_wd = reg_wdata[3];

  assign interrupt_state_rx_frame_err_wd = reg_wdata[4];

  assign interrupt_state_rx_break_err_wd = reg_wdata[5];

  assign interrupt_state_rx_timeout_wd = reg_wdata[6];

  assign interrupt_state_rx_parity_err_wd = reg_wdata[7];

  assign interrupt_enable_we = addr_hit[1] & reg_we & !reg_error;

  assign interrupt_enable_tx_watermark_wd = reg_wdata[0];

  assign interrupt_enable_rx_watermark_wd = reg_wdata[1];

  assign interrupt_enable_tx_empty_wd = reg_wdata[2];

  assign interrupt_enable_rx_overflow_wd = reg_wdata[3];

  assign interrupt_enable_rx_frame_err_wd = reg_wdata[4];

  assign interrupt_enable_rx_break_err_wd = reg_wdata[5];

  assign interrupt_enable_rx_timeout_wd = reg_wdata[6];

  assign interrupt_enable_rx_parity_err_wd = reg_wdata[7];

  assign interrupt_test_we = addr_hit[2] & reg_we & !reg_error;

  assign interrupt_test_tx_watermark_wd = reg_wdata[0];

  assign interrupt_test_rx_watermark_wd = reg_wdata[1];

  assign interrupt_test_tx_empty_wd = reg_wdata[2];

  assign interrupt_test_rx_overflow_wd = reg_wdata[3];

  assign interrupt_test_rx_frame_err_wd = reg_wdata[4];

  assign interrupt_test_rx_break_err_wd = reg_wdata[5];

  assign interrupt_test_rx_timeout_wd = reg_wdata[6];

  assign interrupt_test_rx_parity_err_wd = reg_wdata[7];

  assign alert_test_we = addr_hit[3] & reg_we & !reg_error;

  assign alert_test_wd = reg_wdata[0];

  assign ctrl_we = addr_hit[4] & reg_we & !reg_error;

  assign ctrl_tx_wd = reg_wdata[0];

  assign ctrl_rx_wd = reg_wdata[1];

  assign ctrl_nf_wd = reg_wdata[2];

  assign ctrl_slpbk_wd = reg_wdata[4];

  assign ctrl_llpbk_wd = reg_wdata[5];

  assign ctrl_parity_en_wd = reg_wdata[6];

  assign ctrl_parity_odd_wd = reg_wdata[7];

  assign ctrl_rxblvl_wd = reg_wdata[9:8];

  assign ctrl_nco_wd = reg_wdata[31:16];

  assign wdata_we = addr_hit[7] & reg_we & !reg_error;

  assign wdata_wd = reg_wdata[7:0];

  assign fifo_ctrl_we = addr_hit[8] & reg_we & !reg_error;

  assign fifo_ctrl_rxrst_wd = reg_wdata[0];

  assign fifo_ctrl_txrst_wd = reg_wdata[1];

  assign fifo_ctrl_rxilvl_wd = reg_wdata[4:2];

  assign fifo_ctrl_txilvl_wd = reg_wdata[6:5];

  assign ovrd_we = addr_hit[10] & reg_we & !reg_error;

  assign ovrd_txen_wd = reg_wdata[0];

  assign ovrd_txval_wd = reg_wdata[1];

  assign timeout_ctrl_we = addr_hit[12] & reg_we & !reg_error;

  assign timeout_ctrl_val_wd = reg_wdata[23:0];

  assign timeout_ctrl_en_wd = reg_wdata[31];


  // Assign write-enables to checker logic vector.
  always_comb begin
    reg_we_check[0] = interrupt_state_we;
    reg_we_check[1] = interrupt_enable_we;
    reg_we_check[2] = interrupt_test_we;
    reg_we_check[3] = alert_test_we;
    reg_we_check[4] = ctrl_we;
    reg_we_check[5] = 1'b0;
    reg_we_check[6] = 1'b0;
    reg_we_check[7] = wdata_we;
    reg_we_check[8] = fifo_ctrl_we;
    reg_we_check[9] = 1'b0;
    reg_we_check[10] = ovrd_we;
    reg_we_check[11] = 1'b0;
    reg_we_check[12] = timeout_ctrl_we;
  end

  // Read data return
  always_comb begin
    reg_rdata_next = '0;
    unique case (1'b1)
      addr_hit[0]: begin
        reg_rdata_next[0] = interrupt_state_tx_watermark_qs;
        reg_rdata_next[1] = interrupt_state_rx_watermark_qs;
        reg_rdata_next[2] = interrupt_state_tx_empty_qs;
        reg_rdata_next[3] = interrupt_state_rx_overflow_qs;
        reg_rdata_next[4] = interrupt_state_rx_frame_err_qs;
        reg_rdata_next[5] = interrupt_state_rx_break_err_qs;
        reg_rdata_next[6] = interrupt_state_rx_timeout_qs;
        reg_rdata_next[7] = interrupt_state_rx_parity_err_qs;
      end

      addr_hit[1]: begin
        reg_rdata_next[0] = interrupt_enable_tx_watermark_qs;
        reg_rdata_next[1] = interrupt_enable_rx_watermark_qs;
        reg_rdata_next[2] = interrupt_enable_tx_empty_qs;
        reg_rdata_next[3] = interrupt_enable_rx_overflow_qs;
        reg_rdata_next[4] = interrupt_enable_rx_frame_err_qs;
        reg_rdata_next[5] = interrupt_enable_rx_break_err_qs;
        reg_rdata_next[6] = interrupt_enable_rx_timeout_qs;
        reg_rdata_next[7] = interrupt_enable_rx_parity_err_qs;
      end

      addr_hit[2]: begin
        reg_rdata_next[0] = '0;
        reg_rdata_next[1] = '0;
        reg_rdata_next[2] = '0;
        reg_rdata_next[3] = '0;
        reg_rdata_next[4] = '0;
        reg_rdata_next[5] = '0;
        reg_rdata_next[6] = '0;
        reg_rdata_next[7] = '0;
      end

      addr_hit[3]: begin
        reg_rdata_next[0] = '0;
      end

      addr_hit[4]: begin
        reg_rdata_next[0] = ctrl_tx_qs;
        reg_rdata_next[1] = ctrl_rx_qs;
        reg_rdata_next[2] = ctrl_nf_qs;
        reg_rdata_next[4] = ctrl_slpbk_qs;
        reg_rdata_next[5] = ctrl_llpbk_qs;
        reg_rdata_next[6] = ctrl_parity_en_qs;
        reg_rdata_next[7] = ctrl_parity_odd_qs;
        reg_rdata_next[9:8] = ctrl_rxblvl_qs;
        reg_rdata_next[31:16] = ctrl_nco_qs;
      end

      addr_hit[5]: begin
        reg_rdata_next[0] = status_txfull_qs;
        reg_rdata_next[1] = status_rxfull_qs;
        reg_rdata_next[2] = status_txempty_qs;
        reg_rdata_next[3] = status_txidle_qs;
        reg_rdata_next[4] = status_rxidle_qs;
        reg_rdata_next[5] = status_rxempty_qs;
      end

      addr_hit[6]: begin
        reg_rdata_next[7:0] = rdata_qs;
      end

      addr_hit[7]: begin
        reg_rdata_next[7:0] = '0;
      end

      addr_hit[8]: begin
        reg_rdata_next[0] = fifo_ctrl_rxrst_qs;
        reg_rdata_next[1] = fifo_ctrl_txrst_qs;
        reg_rdata_next[4:2] = fifo_ctrl_rxilvl_qs;
        reg_rdata_next[6:5] = fifo_ctrl_txilvl_qs;
      end

      addr_hit[9]: begin
        reg_rdata_next[5:0] = fifo_status_txlvl_qs;
        reg_rdata_next[21:16] = fifo_status_rxlvl_qs;
      end

      addr_hit[10]: begin
        reg_rdata_next[0] = ovrd_txen_qs;
        reg_rdata_next[1] = ovrd_txval_qs;
      end

      addr_hit[11]: begin
        reg_rdata_next[15:0] = val_qs;
      end

      addr_hit[12]: begin
        reg_rdata_next[23:0] = timeout_ctrl_val_qs;
        reg_rdata_next[31] = timeout_ctrl_en_qs;
      end

      default: begin
        reg_rdata_next = '1;
      end
    endcase
  end

  // shadow busy
  logic shadow_busy;
  assign shadow_busy = 1'b0;

  // register busy
  assign reg_busy = shadow_busy;

  // Unused signal tieoff

  // wdata / byte enable are not always fully used
  // add a blanket unused statement to handle lint waivers
  logic unused_wdata;
  logic unused_be;
  assign unused_wdata = ^reg_wdata;
  assign unused_be = ^reg_be;

  // Assertions for Register Interface
  `ASSERT_PULSE(wePulse, reg_we, clk_i, !rst_ni)
  `ASSERT_PULSE(rePulse, reg_re, clk_i, !rst_ni)

  `ASSERT(reAfterRv, $rose(reg_re || reg_we) |=> tl_o_pre.d_valid, clk_i, !rst_ni)

  `ASSERT(en2addrHit, (reg_we || reg_re) |-> $onehot0(addr_hit), clk_i, !rst_ni)

  // this is formulated as an assumption such that the FPV testbenches do disprove this
  // property by mistake
  //`ASSUME(reqParity, tl_reg_h2d.a_valid |-> tl_reg_h2d.a_user.chk_en == tlul_pkg::CheckDis)

endmodule
