Skip to content

Commit 8dbc01f

Browse files
committed
rand_axi_master: Respect burst type restrictions in ATOPs
This is a second fix for issue #104.
1 parent 70805e3 commit 8dbc01f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3333
respectively.
3434
- `axi_test::rand_axi_slave`: Display `prot` signal (but otherwise still ignore it).
3535

36+
### Fixed
37+
- `rand_axi_master` (in `axi_test`): Another fix to respect burst type restrictions when emitting
38+
ATOPs.
39+
3640

3741
## 0.22.1 - 2020-05-11
3842

src/axi_test.sv

+10-8
Original file line numberDiff line numberDiff line change
@@ -881,21 +881,23 @@ package axi_test;
881881
end
882882
beat.ax_len = bytes / AXI_STRB_WIDTH - 1;
883883
end
884-
// Determine `ax_addr`.
885-
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP && AXI_BURST_FIXED) begin
884+
// Determine `ax_addr` and `ax_burst`.
885+
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP) begin
886886
// The address must be aligned to half the outbound data size. [E2-337]
887887
beat.ax_addr = beat.ax_addr & ~((1'b1 << beat.ax_size) - 1);
888-
end else begin
889-
// The address must be aligned to the data size. [E2-337]
890-
beat.ax_addr = beat.ax_addr & ~((1'b1 << (beat.ax_size+1)) - 1);
891-
end
892-
// Determine `ax_burst`.
893-
if (beat.ax_atop == axi_pkg::ATOP_ATOMICCMP) begin
894888
// If the address is aligned to the total size of outgoing data, the burst type must be
895889
// INCR. Otherwise, it must be WRAP. [E2-338]
896890
beat.ax_burst = (beat.ax_addr % ((beat.ax_len+1) * 2**beat.ax_size) == 0) ?
897891
axi_pkg::BURST_INCR : axi_pkg::BURST_WRAP;
892+
// If we are not allowed to emit WRAP bursts, align the address to the total size of
893+
// outgoing data and fall back to INCR.
894+
if (beat.ax_burst == axi_pkg::BURST_WRAP && !AXI_BURST_WRAP) begin
895+
beat.ax_addr -= (beat.ax_addr % ((beat.ax_len+1) * 2**beat.ax_size));
896+
beat.ax_burst = axi_pkg::BURST_INCR;
897+
end
898898
end else begin
899+
// The address must be aligned to the data size. [E2-337]
900+
beat.ax_addr = beat.ax_addr & ~((1'b1 << (beat.ax_size+1)) - 1);
899901
// Only INCR allowed.
900902
beat.ax_burst = axi_pkg::BURST_INCR;
901903
end

0 commit comments

Comments
 (0)