Skip to content

Commit

Permalink
Merge pull request pulp-platform#22 from pulp-platform/fix-lite_xbar-tb
Browse files Browse the repository at this point in the history
tb_axi_lite_xbar: Fix AW->W dependency and increase handshake randomness
  • Loading branch information
andreaskurth authored Nov 15, 2019
2 parents 0780b2c + d2a1cff commit 321af7d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion scripts/run_vsim.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test_axi_lite_xbar() {

# regression test cases
test_axi_lite_xbar 1 1
# test_axi_lite_xbar 4 9 # This seems to be a bug in ModelSim!
test_axi_lite_xbar 4 9

for NM in 1 2 3 4 8; do
test_axi_lite_xbar $NM 4
Expand Down
55 changes: 37 additions & 18 deletions test/tb_axi_lite_xbar.sv
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,18 @@ module tb_axi_lite_xbar;
assert(rand_success);
end while ((t.addr >> SLAVE_SHIFT) >= NUM_SLAVE);
t.resp = axi_pkg::RESP_OKAY;
fork
begin
random_delay();
drv.send_ar(t.addr);
mailbox_rd[t.addr >> SLAVE_SHIFT].put(t);
end
begin
random_delay();
drv.recv_r(data, resp);
end
join
random_delay();
drv.send_ar(t.addr);
// queue_rd[t.addr >> SLAVE_SHIFT].push_back(t);
mailbox_rd[t.addr >> SLAVE_SHIFT].put(t);
random_delay();
drv.recv_r(data, resp);
tests_total++;
if (t.data != data || t.resp != resp) begin
tests_failed++;
Expand All @@ -160,14 +166,22 @@ module tb_axi_lite_xbar;
assert(rand_success);
end while ((t.addr >> SLAVE_SHIFT) >= NUM_SLAVE);
t.resp = axi_pkg::RESP_OKAY;
fork
begin
random_delay();
drv.send_aw(t.addr);
mailbox_wr[t.addr >> SLAVE_SHIFT].put(t);
end
begin
random_delay();
drv.send_w(t.data, t.strb);
end
begin
random_delay();
drv.recv_b(resp);
end
join
random_delay();
drv.send_aw(t.addr);
// queue_wr[t.addr >> SLAVE_SHIFT].push_back(t);
mailbox_wr[t.addr >> SLAVE_SHIFT].put(t);
random_delay();
drv.send_w(t.data, t.strb);
random_delay();
drv.recv_b(resp);
tests_total++;
if (t.resp != resp) begin
tests_failed++;
Expand Down Expand Up @@ -216,12 +230,17 @@ module tb_axi_lite_xbar;
static logic [AW-1:0] addr;
static logic [DW-1:0] data;
static logic [DW/8-1:0] strb;
random_delay();
drv.recv_aw(addr);
// t = queue_wr[i].pop_front();
mailbox_wr[i].get(t);
random_delay();
drv.recv_w(data, strb);
fork
begin
random_delay();
drv.recv_aw(addr);
mailbox_wr[i].get(t);
end
begin
random_delay();
drv.recv_w(data, strb);
end
join
random_delay();
drv.send_b(t.resp);
tests_total++;
Expand Down

0 comments on commit 321af7d

Please sign in to comment.