forked from verilator/verilator
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Krzysztof Bieganski <[email protected]>
- Loading branch information
1 parent
9f406d6
commit ee0e83c
Showing
15 changed files
with
280 additions
and
66 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
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
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[0] data==0000 | ||
[0] data==0000 | ||
[10] data==0000 | ||
[20] data==dead | ||
[20] data==beef | ||
[20] data==beef | ||
[30] data==beef | ||
[40] data==face | ||
[40] data==cafe | ||
[40] data==cafe | ||
[50] data==cafe | ||
*-* All Finished *-* |
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed under the Creative Commons Public Domain, for | ||
// any use, without warranty, 2023 by Antmicro Ltd. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
interface Bus; | ||
logic [15:0] data; | ||
endinterface | ||
|
||
module t ( | ||
clk | ||
); | ||
input clk; | ||
integer cyc = 0; | ||
Bus intf(); | ||
virtual Bus vif = intf; | ||
logic [15:0] data; | ||
|
||
always @(posedge clk) begin | ||
cyc <= cyc + 1; | ||
end | ||
|
||
// Finish on negedge so that $finish is last | ||
always @(negedge clk) | ||
if (cyc >= 5) begin | ||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
|
||
always @(posedge clk or data) begin | ||
if (cyc == 1) intf.data <= 'hdead; | ||
if (cyc == 2) intf.data <= 'hbeef; | ||
if (cyc == 3) intf.data <= 'hface; | ||
if (cyc == 4) intf.data <= 'hcafe; | ||
end | ||
|
||
assign data = vif.data; | ||
always_comb $write("[%0t] data==%h\n", $time, data); | ||
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// -*- mode: C++; c-file-style: "cc-mode" -*- | ||
//************************************************************************* | ||
// | ||
// Copyright 2023 by Geza Lore. This program is free software; you can | ||
// redistribute it and/or modify it under the terms of either the GNU | ||
// Lesser General Public License Version 3 or the Perl Artistic License | ||
// Version 2.0. | ||
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
// | ||
//************************************************************************* | ||
|
||
#include "verilated.h" | ||
|
||
#include "Vt_interface_virtual_sched_ico.h" | ||
#include "Vt_interface_virtual_sched_ico__Syms.h" | ||
|
||
#include <memory> | ||
|
||
int main(int argc, char** argv) { | ||
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext}; | ||
contextp->debug(0); | ||
contextp->commandArgs(argc, argv); | ||
srand48(5); | ||
|
||
const std::unique_ptr<VM_PREFIX> topp{new VM_PREFIX}; | ||
topp->inc = 1; | ||
topp->clk = false; | ||
topp->eval(); | ||
|
||
while (!contextp->gotFinish() && contextp->time() < 100000) { | ||
contextp->timeInc(5); | ||
if (topp->clk) topp->inc += 1; | ||
topp->clk = !topp->clk; | ||
topp->eval(); | ||
} | ||
|
||
if (!contextp->gotFinish()) { | ||
vl_fatal(__FILE__, __LINE__, "main", "%Error: Timeout; never got a $finish"); | ||
} | ||
return 0; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[0] intf1.inc==0 | ||
[0] vif2.inc==0 | ||
[0] intf1.inc==1 | ||
[0] vif2.inc==1 | ||
[0] intf1.inc==1 | ||
[0] vif2.inc==1 | ||
[5] intf1.inc==1 | ||
[5] vif2.inc==1 | ||
[10] intf1.inc==2 | ||
[10] vif2.inc==2 | ||
[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 | ||
*-* All Finished *-* |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2023 by Wilson Snyder. This program is free software; you | ||
# can redistribute it and/or modify it under the terms of either the GNU | ||
# Lesser General Public License Version 3 or the Perl Artistic License | ||
# Version 2.0. | ||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
|
||
scenarios(vlt_all => 1); | ||
|
||
compile( | ||
make_main => 0, | ||
v_flags2 => ["--exe", "$Self->{t_dir}/$Self->{name}.cpp"], | ||
); | ||
|
||
execute( | ||
check_finished => 1, | ||
expect_filename => $Self->{golden_filename}, | ||
); | ||
|
||
ok(1); | ||
1; |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed into the Public Domain, for any use, | ||
// without warranty, 2023 by Antmicro Ltd. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
interface If; | ||
logic [31:0] inc; | ||
endinterface | ||
|
||
module top ( | ||
clk, | ||
inc | ||
); | ||
|
||
input clk; | ||
input [31:0] inc; | ||
int cyc = 0; | ||
|
||
If intf1(); | ||
If intf2(); | ||
virtual If vif1 = intf1; | ||
virtual If vif2 = intf2; | ||
|
||
assign vif1.inc = inc; | ||
assign intf2.inc = inc; | ||
|
||
always @(posedge clk) begin | ||
cyc <= cyc + 1; | ||
if (cyc >= 4) begin | ||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
end | ||
|
||
always_comb $write("[%0t] intf1.inc==%0h\n", $time, intf1.inc); | ||
always_comb $write("[%0t] vif2.inc==%0h\n", $time, vif2.inc); | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env perl | ||
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } | ||
# DESCRIPTION: Verilator: Verilog Test driver/expect definition | ||
# | ||
# Copyright 2020 by Wilson Snyder. This program is free software; you | ||
# can redistribute it and/or modify it under the terms of either the GNU | ||
# Lesser General Public License Version 3 or the Perl Artistic License | ||
# Version 2.0. | ||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
|
||
scenarios(simulator => 1); | ||
|
||
compile( | ||
); | ||
|
||
execute( | ||
check_finished => 1, | ||
expect_filename => $Self->{golden_filename}, | ||
); | ||
|
||
ok(1); | ||
1; |
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// DESCRIPTION: Verilator: Verilog Test module | ||
// | ||
// This file ONLY is placed under the Creative Commons Public Domain, for | ||
// any use, without warranty, 2023 by Antmicro Ltd. | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
interface Bus1; | ||
logic [15:0] data; | ||
endinterface | ||
|
||
interface Bus2; | ||
logic [15:0] data; | ||
endinterface | ||
|
||
interface Bus3; | ||
logic [15:0] data; | ||
endinterface | ||
|
||
module t ( | ||
clk | ||
); | ||
input clk; | ||
integer cyc = 0; | ||
Bus1 intf1(); | ||
Bus2 intf2(); | ||
Bus3 intf3(); | ||
virtual Bus1 vif1 = intf1; | ||
virtual Bus2 vif2 = intf2; | ||
virtual Bus3 vif3 = intf3; | ||
|
||
logic [15:0] data; | ||
assign vif2.data = data; | ||
|
||
always @(posedge clk) begin | ||
cyc <= cyc + 1; | ||
if (cyc == 1) begin | ||
vif1.data = 'hdead; | ||
end else if (cyc == 2) begin | ||
data = vif1.data; | ||
end else if (cyc == 3) begin | ||
vif1.data = 'hbeef; | ||
end else if (cyc == 4) begin | ||
data = vif1.data; | ||
end else if (cyc == 5) begin | ||
intf3.data <= 'hface; | ||
end else if (cyc == 6) begin | ||
intf3.data <= 'hcafe; | ||
end | ||
end | ||
|
||
// Finish on negedge so that $finish is last | ||
always @(negedge clk) | ||
if (cyc >= 7) begin | ||
$write("*-* All Finished *-*\n"); | ||
$finish; | ||
end | ||
|
||
always_comb $write("[%0t] intf1.data==%h\n", $time, intf1.data); | ||
always_comb $write("[%0t] intf2.data==%h\n", $time, intf2.data); | ||
always_comb $write("[%0t] vif3.data==%h\n", $time, vif3.data); | ||
endmodule |
This file was deleted.
Oops, something went wrong.