Skip to content

Commit

Permalink
rand_axi_master: Respect burst type restrictions in ATOPs
Browse files Browse the repository at this point in the history
This is a second fix for issue #104.
  • Loading branch information
andreaskurth committed May 11, 2020
1 parent 70805e3 commit 8dbc01f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
respectively.
- `axi_test::rand_axi_slave`: Display `prot` signal (but otherwise still ignore it).

### Fixed
- `rand_axi_master` (in `axi_test`): Another fix to respect burst type restrictions when emitting
ATOPs.


## 0.22.1 - 2020-05-11

Expand Down
18 changes: 10 additions & 8 deletions src/axi_test.sv
Original file line number Diff line number Diff line change
Expand Up @@ -881,21 +881,23 @@ package axi_test;
end
beat.ax_len = bytes / AXI_STRB_WIDTH - 1;
end
// Determine `ax_addr`.
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP && AXI_BURST_FIXED) begin
// Determine `ax_addr` and `ax_burst`.
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP) begin
// The address must be aligned to half the outbound data size. [E2-337]
beat.ax_addr = beat.ax_addr & ~((1'b1 << beat.ax_size) - 1);
end else begin
// The address must be aligned to the data size. [E2-337]
beat.ax_addr = beat.ax_addr & ~((1'b1 << (beat.ax_size+1)) - 1);
end
// Determine `ax_burst`.
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP) begin
// If the address is aligned to the total size of outgoing data, the burst type must be
// INCR. Otherwise, it must be WRAP. [E2-338]
beat.ax_burst = (beat.ax_addr % ((beat.ax_len+1) * 2**beat.ax_size) == 0) ?
axi_pkg::BURST_INCR : axi_pkg::BURST_WRAP;
// If we are not allowed to emit WRAP bursts, align the address to the total size of
// outgoing data and fall back to INCR.
if (beat.ax_burst == axi_pkg::BURST_WRAP && !AXI_BURST_WRAP) begin
beat.ax_addr -= (beat.ax_addr % ((beat.ax_len+1) * 2**beat.ax_size));
beat.ax_burst = axi_pkg::BURST_INCR;
end
end else begin
// The address must be aligned to the data size. [E2-337]
beat.ax_addr = beat.ax_addr & ~((1'b1 << (beat.ax_size+1)) - 1);
// Only INCR allowed.
beat.ax_burst = axi_pkg::BURST_INCR;
end
Expand Down

0 comments on commit 8dbc01f

Please sign in to comment.