-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for parallel threads with vopt
- Loading branch information
1 parent
b1faae5
commit 1ce6bba
Showing
7 changed files
with
271 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,28 @@ | |
# | ||
# Copyright (c) 2014-2024, Lars Asplund [email protected] | ||
|
||
from argparse import Namespace | ||
from pathlib import Path | ||
from vunit import VUnit | ||
from vunit import VUnit, VUnitCLI | ||
from os import environ | ||
|
||
cli = VUnitCLI() | ||
|
||
environ["VUNIT_SIMULATOR"] = "modelsim" | ||
|
||
vu = VUnit.from_argv() | ||
vu.add_vhdl_builtins() | ||
|
||
lib = vu.add_library("lib") | ||
lib.add_source_files(Path(__file__).parent / "*.vhd") | ||
lib1 = vu.add_library("lib1") | ||
lib1.add_source_files(Path(__file__).parent / "sub_module" / "*.vhd") | ||
|
||
lib2 = vu.add_library("lib2") | ||
lib2.add_source_files(Path(__file__).parent / "*.vhd") | ||
|
||
tb = lib.test_bench("tb_example") | ||
test = tb.test("test 2") | ||
tb = lib2.test_bench("tb_example") | ||
test = tb.test("test") | ||
|
||
for value in range(3): | ||
for value in range(5): | ||
test.add_config(name=f"{value}", generics=dict(value=value)) | ||
|
||
vu.set_sim_option("modelsim.three_step_flow", True) | ||
|
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,35 @@ | ||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
-- You can obtain one at http://mozilla.org/MPL/2.0/. | ||
-- | ||
-- Copyright (c) 2014-2024, Lars Asplund [email protected] | ||
|
||
library vunit_lib; | ||
context vunit_lib.vunit_context; | ||
|
||
entity tb_a is | ||
generic ( | ||
runner_cfg : string); | ||
end entity; | ||
|
||
architecture tb of tb_a is | ||
begin | ||
main : process | ||
function recurse(value : integer) return integer is | ||
begin | ||
if value <= 0 then | ||
return 0; | ||
elsif value mod 2 = 0 then | ||
return 1 + recurse(value - 1); | ||
else | ||
return recurse(value - 1); | ||
end if; | ||
end; | ||
begin | ||
test_runner_setup(runner, runner_cfg); | ||
|
||
info("Running tb_a: " & to_string(recurse(17))); | ||
|
||
test_runner_cleanup(runner); | ||
end process; | ||
end architecture; |
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,35 @@ | ||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
-- You can obtain one at http://mozilla.org/MPL/2.0/. | ||
-- | ||
-- Copyright (c) 2014-2024, Lars Asplund [email protected] | ||
|
||
library vunit_lib; | ||
context vunit_lib.vunit_context; | ||
|
||
entity tb_b is | ||
generic ( | ||
runner_cfg : string); | ||
end entity; | ||
|
||
architecture tb of tb_b is | ||
begin | ||
main : process | ||
function recurse(value : integer) return integer is | ||
begin | ||
if value <= 0 then | ||
return 0; | ||
elsif value mod 2 = 0 then | ||
return 1 + recurse(value - 1); | ||
else | ||
return recurse(value - 1); | ||
end if; | ||
end; | ||
begin | ||
test_runner_setup(runner, runner_cfg); | ||
|
||
info("Running tb_b: " & to_string(recurse(17))); | ||
|
||
test_runner_cleanup(runner); | ||
end process; | ||
end architecture; |
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
Oops, something went wrong.