Skip to content

Commit

Permalink
Fix race in t_interface_virtual_sched_ico
Browse files Browse the repository at this point in the history
  • Loading branch information
gezalore committed Dec 6, 2023
1 parent f3bace1 commit 23453e5
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 22 deletions.
14 changes: 12 additions & 2 deletions test_regress/t/t_interface_virtual_sched_ico.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,23 @@ int main(int argc, char** argv) {
srand48(5);

const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX};
topp->inc = 1;
topp->clk = false;
topp->inc1 = 1;
topp->eval();
topp->inc2 = 1;
topp->eval();

bool flop = true;
while (!contextp->gotFinish() && contextp->time() < 100000) {
contextp->timeInc(5);
if (topp->clk) topp->inc += 1;
if (topp->clk) {
if (flop) {
topp->inc1 += 1;
} else {
topp->inc2 += 1;
}
flop = !flop;
}
topp->clk = !topp->clk;
topp->eval();
}
Expand Down
48 changes: 33 additions & 15 deletions test_regress/t/t_interface_virtual_sched_ico.out
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
[0] intf1.inc==0
[0] vif2.inc==0
[0] intf1.inc==1
[0] vif2.inc==1
[0] vif2.inc==0
[0] intf1.inc==1
[0] vif2.inc==0
[0] intf1.inc==1
[0] vif2.inc==1
[5] intf1.inc==1
[5] vif2.inc==1
[10] intf1.inc==2
[10] vif2.inc==2
[10] vif2.inc==1
[15] intf1.inc==2
[15] vif2.inc==2
[20] intf1.inc==3
[20] vif2.inc==3
[25] intf1.inc==3
[25] vif2.inc==3
[30] intf1.inc==4
[30] vif2.inc==4
[35] intf1.inc==4
[35] vif2.inc==4
[40] intf1.inc==5
[40] vif2.inc==5
[45] intf1.inc==5
[45] vif2.inc==5
[15] vif2.inc==1
[20] intf1.inc==2
[20] vif2.inc==2
[25] intf1.inc==2
[25] vif2.inc==2
[30] intf1.inc==3
[30] vif2.inc==2
[35] intf1.inc==3
[35] vif2.inc==2
[40] intf1.inc==3
[40] vif2.inc==3
[45] intf1.inc==3
[45] vif2.inc==3
[50] intf1.inc==4
[50] vif2.inc==3
[55] intf1.inc==4
[55] vif2.inc==3
[60] intf1.inc==4
[60] vif2.inc==4
[65] intf1.inc==4
[65] vif2.inc==4
[70] intf1.inc==5
[70] vif2.inc==4
[75] intf1.inc==5
[75] vif2.inc==4
[80] intf1.inc==5
[80] vif2.inc==5
[85] intf1.inc==5
[85] vif2.inc==5
*-* All Finished *-*
12 changes: 7 additions & 5 deletions test_regress/t/t_interface_virtual_sched_ico.v
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ endinterface

module top (
clk,
inc
inc1,
inc2
);

input clk;
input [31:0] inc;
input [31:0] inc1;
input [31:0] inc2;
int cyc = 0;

If intf1();
If intf2();
virtual If vif1 = intf1;
virtual If vif2 = intf2;

assign vif1.inc = inc;
assign intf2.inc = inc;
assign vif1.inc = inc1;
assign intf2.inc = inc2;

always @(posedge clk) begin
cyc <= cyc + 1;
if (cyc >= 4) begin
if (cyc >= 8) begin
$write("*-* All Finished *-*\n");
$finish;
end
Expand Down

0 comments on commit 23453e5

Please sign in to comment.