hw/ip/rv_dm/rtl/tlul_adapter_host.sv Cov: 100%

   1: // Copyright lowRISC contributors.
   2: // Licensed under the Apache License, Version 2.0, see LICENSE for details.
   3: // SPDX-License-Identifier: Apache-2.0
   4: //
   5: // tlul_adapter (Host adapter) converts basic req/grant/rvalid into TL-UL
   6: // interface. It doesn't need register but combinational logics.
   7: 
   8: module tlul_adapter_host #(
   9:   parameter int unsigned AW = 32,
  10:   parameter int unsigned DW = 32
  11: ) (
  12:   input clk_i   ,
  13:   input rst_ni  ,
  14: 
  15:   input                   req_i   ,
  16:   output logic            gnt_o   ,
  17:   input        [AW-1:0]   addr_i  ,
  18:   input                   we_i    ,
  19:   input        [DW-1:0]   wdata_i ,
  20:   input        [DW/8-1:0] be_i    ,
  21:   input        [1:0]      size_i  , // 2**(size_i)
  22: 
  23:   output logic            valid_o ,
  24:   output logic [DW-1:0]   rdata_o ,
  25: 
  26:   output tlul_pkg::tl_h2d_t tl_o ,
  27:   input  tlul_pkg::tl_d2h_t tl_i
  28: );
  29: 
  30:   tlul_pkg::tl_a_op_e req_op;
  31: 
  32:   assign req_op = (we_i) ? tlul_pkg::PutFullData : tlul_pkg::Get ;
  33: 
  34:   assign tl_o = '{
  35:     a_valid:      req_i       ,
  36:     a_opcode:     req_op      ,
  37:     a_param:      '0          ,
  38:     a_size:       size_i      ,
  39:     a_source:     '0          ,
  40:     a_address:    addr_i      ,
  41:     a_mask:       be_i        ,
  42:     a_data:       wdata_i     ,
  43:     a_user:       '0          ,
  44: 
  45:     d_ready:      1'b1          // Ready to accept
  46:   };
  47: 
  48:   assign gnt_o   = tl_i.a_ready; // Do we need to and with req_i? then registers are required
  49: 
  50:   assign valid_o = tl_i.d_valid;
  51:   assign rdata_o = tl_i.d_data;
  52: 
  53:   // this assertion fails when DBG adapter cannot handle error response
  54:   `ASSERT(handleErrorResponse, tl_i.d_valid |-> (tl_i.d_error == 1'b0), clk_i, !rst_ni)
  55: 
  56: endmodule
  57: