Skip to content

Commit

Permalink
axi_sim_mem: add basic and multiport interface variant
Browse files Browse the repository at this point in the history
Ensures backward-compatability
  • Loading branch information
micprog committed Jul 16, 2024
1 parent f03fe42 commit bf90008
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions src/axi_sim_mem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,87 @@ endmodule
///
/// See the documentation of the main module for the definition of ports and parameters.
module axi_sim_mem_intf #(
parameter int unsigned AXI_ADDR_WIDTH = 32'd0,
parameter int unsigned AXI_DATA_WIDTH = 32'd0,
parameter int unsigned AXI_ID_WIDTH = 32'd0,
parameter int unsigned AXI_USER_WIDTH = 32'd0,
parameter bit WARN_UNINITIALIZED = 1'b0,
parameter UNINITIALIZED_DATA = "undefined",
parameter bit ClearErrOnAccess = 1'b0,
parameter time APPL_DELAY = 0ps,
parameter time ACQ_DELAY = 0ps
) (
input logic clk_i,
input logic rst_ni,
AXI_BUS.Slave axi_slv,
output logic mon_w_valid_o,
output logic [AXI_ADDR_WIDTH-1:0] mon_w_addr_o,
output logic [AXI_DATA_WIDTH-1:0] mon_w_data_o,
output logic [AXI_ID_WIDTH-1:0] mon_w_id_o,
output logic [AXI_USER_WIDTH-1:0] mon_w_user_o,
output axi_pkg::len_t mon_w_beat_count_o,
output logic mon_w_last_o,
output logic mon_r_valid_o,
output logic [AXI_ADDR_WIDTH-1:0] mon_r_addr_o,
output logic [AXI_DATA_WIDTH-1:0] mon_r_data_o,
output logic [AXI_ID_WIDTH-1:0] mon_r_id_o,
output logic [AXI_USER_WIDTH-1:0] mon_r_user_o,
output axi_pkg::len_t mon_r_beat_count_o,
output logic mon_r_last_o
);

typedef logic [AXI_ADDR_WIDTH-1:0] axi_addr_t;
typedef logic [AXI_DATA_WIDTH-1:0] axi_data_t;
typedef logic [AXI_ID_WIDTH-1:0] axi_id_t;
typedef logic [AXI_DATA_WIDTH/8-1:0] axi_strb_t;
typedef logic [AXI_USER_WIDTH-1:0] axi_user_t;
`AXI_TYPEDEF_ALL(axi, axi_addr_t, axi_id_t, axi_data_t, axi_strb_t, axi_user_t)

axi_req_t axi_req;
axi_resp_t axi_rsp;

`AXI_ASSIGN_TO_REQ(axi_req, axi_slv)
`AXI_ASSIGN_FROM_RESP(axi_slv, axi_rsp)

axi_sim_mem #(
.AddrWidth (AXI_ADDR_WIDTH),
.DataWidth (AXI_DATA_WIDTH),
.IdWidth (AXI_ID_WIDTH),
.UserWidth (AXI_USER_WIDTH),
.axi_req_t (axi_req_t),
.axi_rsp_t (axi_resp_t),
.WarnUninitialized (WARN_UNINITIALIZED),
.UninitializedData (UNINITIALIZED_DATA),
.ClearErrOnAccess (ClearErrOnAccess),
.ApplDelay (APPL_DELAY),
.AcqDelay (ACQ_DELAY)
) i_sim_mem (
.clk_i,
.rst_ni,
.axi_req_i (axi_req),
.axi_rsp_o (axi_rsp),
.mon_w_valid_o,
.mon_w_addr_o,
.mon_w_data_o,
.mon_w_id_o,
.mon_w_user_o,
.mon_w_beat_count_o,
.mon_w_last_o,
.mon_r_valid_o,
.mon_r_addr_o,
.mon_r_data_o,
.mon_r_id_o,
.mon_r_user_o,
.mon_r_beat_count_o,
.mon_r_last_o
);

endmodule

/// Mutliport interface variant of [`axi_sim_mem`](module.axi_sim_mem).
///
/// See the documentation of the main module for the definition of ports and parameters.
module axi_sim_mem_multiport_intf #(
parameter int unsigned AXI_ADDR_WIDTH = 32'd0,
parameter int unsigned AXI_DATA_WIDTH = 32'd0,
parameter int unsigned AXI_ID_WIDTH = 32'd0,
Expand Down

0 comments on commit bf90008

Please sign in to comment.