forked from pulp-platform/axi
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
axi_bus_compare: Fixes and changes from the PR, add README entry
- Loading branch information
1 parent
96cdede
commit 8810353
Showing
5 changed files
with
96 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// Authors: | ||
// - Thomas Benz <[email protected]> | ||
|
||
`include "axi/assign.svh" | ||
/// Synthesizable test module comparing two AXI channels of the same type | ||
/// This module is meant to be used in FPGA-based verification. | ||
module axi_bus_compare #( | ||
|
@@ -79,22 +80,23 @@ module axi_bus_compare #( | |
// Channel Signals | ||
//----------------------------------- | ||
// assign request payload A | ||
assign axi_a_req_o.aw = axi_a_req_i.aw; | ||
assign axi_a_req_o.w = axi_a_req_i.w; | ||
assign axi_a_req_o.ar = axi_a_req_i.ar; | ||
|
||
`AXI_ASSIGN_AW_STRUCT(axi_a_req_o.aw, axi_a_req_i.aw) | ||
`AXI_ASSIGN_W_STRUCT(axi_a_req_o.w, axi_a_req_i.w) | ||
`AXI_ASSIGN_AR_STRUCT(axi_a_req_o.ar, axi_a_req_i.ar) | ||
|
||
// assign response payload A | ||
assign axi_a_rsp_o.r = axi_a_rsp_i.r; | ||
assign axi_a_rsp_o.b = axi_a_rsp_i.b; | ||
`AXI_ASSIGN_R_STRUCT(axi_a_rsp_o.r, axi_a_rsp_i.r) | ||
`AXI_ASSIGN_B_STRUCT(axi_a_rsp_o.b, axi_a_rsp_i.b) | ||
|
||
// assign request payload B | ||
assign axi_b_req_o.aw = axi_b_req_i.aw; | ||
assign axi_b_req_o.w = axi_b_req_i.w; | ||
assign axi_b_req_o.ar = axi_b_req_i.ar; | ||
`AXI_ASSIGN_AW_STRUCT(axi_b_req_o.aw, axi_b_req_i.aw) | ||
`AXI_ASSIGN_W_STRUCT(axi_b_req_o.w, axi_b_req_i.w) | ||
`AXI_ASSIGN_AR_STRUCT(axi_b_req_o.ar, axi_b_req_i.ar) | ||
|
||
// assign response payload B | ||
assign axi_b_rsp_o.r = axi_b_rsp_i.r; | ||
assign axi_b_rsp_o.b = axi_b_rsp_i.b; | ||
`AXI_ASSIGN_R_STRUCT(axi_b_rsp_o.r, axi_b_rsp_i.r) | ||
`AXI_ASSIGN_B_STRUCT(axi_b_rsp_o.b, axi_b_rsp_i.b) | ||
|
||
// fifo handshaking signals A | ||
id_t fifo_valid_aw_a, fifo_ready_aw_a; | ||
|
@@ -314,40 +316,38 @@ module axi_bus_compare #( | |
// Input Handshaking A | ||
//----------------------------------- | ||
always_comb begin : gen_handshaking_a | ||
for (int id = 0; id < 2**AxiIdWidth; id++) begin | ||
// aw | ||
// defaults | ||
fifo_valid_aw_a = '0; | ||
fifo_sel_ready_aw_a = '0; | ||
// assign according id | ||
fifo_valid_aw_a [axi_a_req_i.aw.id] = fifo_sel_valid_aw_a; | ||
fifo_sel_ready_aw_a = fifo_ready_aw_a[axi_a_req_i.aw.id]; | ||
|
||
|
||
// b | ||
// defaults | ||
fifo_valid_b_a = '0; | ||
fifo_sel_ready_b_a = '0; | ||
// assign according id | ||
fifo_valid_b_a [axi_a_rsp_i.b.id] = fifo_sel_valid_b_a; | ||
fifo_sel_ready_b_a = fifo_ready_b_a[axi_a_rsp_i.b.id]; | ||
|
||
// ar | ||
// defaults | ||
fifo_valid_ar_a = '0; | ||
fifo_sel_ready_ar_a = '0; | ||
// assign according id | ||
fifo_valid_ar_a [axi_a_req_i.ar.id] = fifo_sel_valid_ar_a; | ||
fifo_sel_ready_ar_a = fifo_ready_ar_a[axi_a_req_i.ar.id]; | ||
|
||
// b | ||
// defaults | ||
fifo_valid_r_a = '0; | ||
fifo_sel_ready_r_a = '0; | ||
// assign according id | ||
fifo_valid_r_a [axi_a_rsp_i.r.id] = fifo_sel_valid_r_a; | ||
fifo_sel_ready_r_a = fifo_ready_r_a[axi_a_rsp_i.r.id]; | ||
end | ||
// aw | ||
// defaults | ||
fifo_valid_aw_a = '0; | ||
fifo_sel_ready_aw_a = '0; | ||
// assign according id | ||
fifo_valid_aw_a [axi_a_req_i.aw.id] = fifo_sel_valid_aw_a; | ||
fifo_sel_ready_aw_a = fifo_ready_aw_a[axi_a_req_i.aw.id]; | ||
|
||
|
||
// b | ||
// defaults | ||
fifo_valid_b_a = '0; | ||
fifo_sel_ready_b_a = '0; | ||
// assign according id | ||
fifo_valid_b_a [axi_a_rsp_i.b.id] = fifo_sel_valid_b_a; | ||
fifo_sel_ready_b_a = fifo_ready_b_a[axi_a_rsp_i.b.id]; | ||
|
||
// ar | ||
// defaults | ||
fifo_valid_ar_a = '0; | ||
fifo_sel_ready_ar_a = '0; | ||
// assign according id | ||
fifo_valid_ar_a [axi_a_req_i.ar.id] = fifo_sel_valid_ar_a; | ||
fifo_sel_ready_ar_a = fifo_ready_ar_a[axi_a_req_i.ar.id]; | ||
|
||
// b | ||
// defaults | ||
fifo_valid_r_a = '0; | ||
fifo_sel_ready_r_a = '0; | ||
// assign according id | ||
fifo_valid_r_a [axi_a_rsp_i.r.id] = fifo_sel_valid_r_a; | ||
fifo_sel_ready_r_a = fifo_ready_r_a[axi_a_rsp_i.r.id]; | ||
end | ||
|
||
|
||
|
@@ -516,40 +516,38 @@ module axi_bus_compare #( | |
// Input Handshaking B | ||
//----------------------------------- | ||
always_comb begin : gen_handshaking_b | ||
for (int id = 0; id < 2**AxiIdWidth; id++) begin | ||
// aw | ||
// defaults | ||
fifo_valid_aw_b = '0; | ||
fifo_sel_ready_aw_b = '0; | ||
// assign according id | ||
fifo_valid_aw_b [axi_b_req_i.aw.id] = fifo_sel_valid_aw_b; | ||
fifo_sel_ready_aw_b = fifo_ready_aw_b[axi_b_req_i.aw.id]; | ||
|
||
|
||
// b | ||
// defaults | ||
fifo_valid_b_b = '0; | ||
fifo_sel_ready_b_b = '0; | ||
// assign according id | ||
fifo_valid_b_b [axi_b_rsp_i.b.id] = fifo_sel_valid_b_b; | ||
fifo_sel_ready_b_b = fifo_ready_b_b[axi_b_rsp_i.b.id]; | ||
|
||
// ar | ||
// defaults | ||
fifo_valid_ar_b = '0; | ||
fifo_sel_ready_ar_b = '0; | ||
// assign according id | ||
fifo_valid_ar_b [axi_b_req_i.ar.id] = fifo_sel_valid_ar_b; | ||
fifo_sel_ready_ar_b = fifo_ready_ar_b[axi_b_req_i.ar.id]; | ||
|
||
// b | ||
// defaults | ||
fifo_valid_r_b = '0; | ||
fifo_sel_ready_r_b = '0; | ||
// assign according id | ||
fifo_valid_r_b [axi_b_rsp_i.r.id] = fifo_sel_valid_r_b; | ||
fifo_sel_ready_r_b = fifo_ready_r_b[axi_b_rsp_i.r.id]; | ||
end | ||
// aw | ||
// defaults | ||
fifo_valid_aw_b = '0; | ||
fifo_sel_ready_aw_b = '0; | ||
// assign according id | ||
fifo_valid_aw_b [axi_b_req_i.aw.id] = fifo_sel_valid_aw_b; | ||
fifo_sel_ready_aw_b = fifo_ready_aw_b[axi_b_req_i.aw.id]; | ||
|
||
|
||
// b | ||
// defaults | ||
fifo_valid_b_b = '0; | ||
fifo_sel_ready_b_b = '0; | ||
// assign according id | ||
fifo_valid_b_b [axi_b_rsp_i.b.id] = fifo_sel_valid_b_b; | ||
fifo_sel_ready_b_b = fifo_ready_b_b[axi_b_rsp_i.b.id]; | ||
|
||
// ar | ||
// defaults | ||
fifo_valid_ar_b = '0; | ||
fifo_sel_ready_ar_b = '0; | ||
// assign according id | ||
fifo_valid_ar_b [axi_b_req_i.ar.id] = fifo_sel_valid_ar_b; | ||
fifo_sel_ready_ar_b = fifo_ready_ar_b[axi_b_req_i.ar.id]; | ||
|
||
// b | ||
// defaults | ||
fifo_valid_r_b = '0; | ||
fifo_sel_ready_r_b = '0; | ||
// assign according id | ||
fifo_valid_r_b [axi_b_rsp_i.r.id] = fifo_sel_valid_r_b; | ||
fifo_sel_ready_r_b = fifo_ready_r_b[axi_b_rsp_i.r.id]; | ||
end | ||
|
||
|
||
|
@@ -584,4 +582,4 @@ module axi_bus_compare #( | |
assign mismatch_o = (|aw_mismatch_o) | (|w_mismatch_o) | (|b_mismatch_o) | | ||
(|ar_mismatch_o) | (|r_mismatch_o); | ||
|
||
endmodule : axi_bus_compare | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
// Authors: | ||
// - Thomas Benz <[email protected]> | ||
|
||
`include "axi/assign.svh" | ||
/// Synthesizable test module comparing two AXI slaves of the same type. | ||
/// The reference response is always passed to the master, whereas the test response | ||
/// is discarded after handshaking. | ||
|
@@ -123,8 +124,8 @@ module axi_slave_compare #( | |
// assemble buses | ||
always_comb begin | ||
// request | ||
axi_ref_req_in = axi_mst_req_i; | ||
axi_test_req_in = axi_mst_req_i; | ||
`AXI_SET_REQ_STRUCT(axi_ref_req_in, axi_mst_req_i) | ||
`AXI_SET_REQ_STRUCT(axi_test_req_in, axi_mst_req_i) | ||
// overwrite valids in requests | ||
axi_ref_req_in.aw_valid = aw_valid_ref; | ||
axi_ref_req_in.ar_valid = ar_valid_ref; | ||
|
@@ -140,7 +141,7 @@ module axi_slave_compare #( | |
ar_ready_test = axi_test_rsp_in.ar_ready; | ||
w_ready_test = axi_test_rsp_in.w_ready; | ||
// response | ||
axi_mst_rsp_o = axi_ref_rsp_in; | ||
`AXI_SET_RESP_STRUCT(axi_mst_rsp_o, axi_ref_rsp_in) | ||
// overwrite readies | ||
axi_mst_rsp_o.aw_ready = aw_ready_mst; | ||
axi_mst_rsp_o.w_ready = w_ready_mst; | ||
|
@@ -181,4 +182,4 @@ module axi_slave_compare #( | |
.axi_b_rsp_i ( axi_test_rsp_i ) | ||
); | ||
|
||
endmodule : axi_slave_compare | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -236,4 +236,4 @@ module tb_axi_slave_compare #( | |
$finish(); | ||
end | ||
|
||
endmodule : tb_axi_slave_compare | ||
endmodule |