Skip to content

Commit

Permalink
Merge pull request #338 from pulp-platform/michaero/sim_mem_rdata
Browse files Browse the repository at this point in the history
`axi_sim_mem`: Configure response data
  • Loading branch information
micprog authored May 8, 2024
2 parents ac5deb3 + be01569 commit e60e969
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.


## Unreleased
### Added
- `axi_sim_mem`: Allow response data for uninitialized region to have configurable defined value.

## 0.39.2 - 2024-03-13

Expand Down
15 changes: 14 additions & 1 deletion src/axi_sim_mem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module axi_sim_mem #(
parameter type axi_rsp_t = logic,
/// Warn on accesses to uninitialized bytes
parameter bit WarnUninitialized = 1'b0,
/// Default value for uninitialized memory (undefined, zeros, ones, random)
parameter UninitializedData = "undefined",
/// Clear error on access
parameter bit ClearErrOnAccess = 1'b0,
/// Application delay (measured after rising clock edge)
Expand Down Expand Up @@ -241,7 +243,16 @@ module axi_sim_mem #(
$warning("Access to non-initialized byte at address 0x%016x by ID 0x%x.", byte_addr,
r_beat.id);
end
r_data[i_byte*8+:8] = 'x;
case (UninitializedData)
"random":
r_data[i_byte*8+:8] = $urandom;
"ones":
r_data[i_byte*8+:8] = '1;
"zeros":
r_data[i_byte*8+:8] = '0;
default:
r_data[i_byte*8+:8] = 'x;
endcase
end else begin
r_data[i_byte*8+:8] = mem[byte_addr];
end
Expand Down Expand Up @@ -342,6 +353,7 @@ module axi_sim_mem_intf #(
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
Expand Down Expand Up @@ -386,6 +398,7 @@ module axi_sim_mem_intf #(
.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)
Expand Down

0 comments on commit e60e969

Please sign in to comment.