Skip to content

Commit 0d8df31

Browse files
authored
Merge pull request #2 from 1138-4EB/master
add vunit example
2 parents 8bc2b85 + 3cbd53f commit 0d8df31

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

Examples/Boards_VUnit.vhdl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
library vunit_lib;
2+
context vunit_lib.vunit_context;
3+
4+
use work.json.all;
5+
6+
entity tb_boards is
7+
generic (
8+
runner_cfg : string;
9+
tb_path : string;
10+
filename : string
11+
);
12+
end entity;
13+
14+
architecture tb of tb_boards is
15+
constant JSONContent : T_JSON := jsonLoadFile(tb_path & filename);
16+
begin
17+
main: process
18+
begin
19+
test_runner_setup(runner, runner_cfg);
20+
while test_suite loop
21+
if run("test") then
22+
info(tb_path&filename);
23+
info("KC705/FPGADevice: " & jsonGetString(JSONContent, "KC705/FPGADevice"));
24+
info("KC705/IIC/0/Devices/1/Type: " & jsonGetString(JSONContent, "KC705/IIC/0/Devices/1/Type"));
25+
info("DE4/Ethernet/2/PHY_ManagementInterface: " & jsonGetString(JSONContent, "DE4/Ethernet/2/PHY_ManagementInterface"));
26+
end if;
27+
end loop;
28+
test_runner_cleanup(runner);
29+
wait;
30+
end process;
31+
end architecture;

VUnit/run.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from os.path import join, dirname
2+
from vunit import VUnit
3+
4+
root = dirname(__file__)
5+
6+
vu = VUnit.from_argv()
7+
8+
lib = vu.add_library("lib")
9+
lib.add_source_files(join(root, "../vhdl/JSON.pkg.vhdl"))
10+
lib.add_source_files(join(root, "../Examples/Boards_VUnit.vhdl"))
11+
12+
vu.set_generic("filename","../Data/Boards2.json")
13+
14+
vu.main()

VUnit/run.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
cd $(dirname $0)
4+
5+
$(command -v winpty) docker run --rm -it \
6+
-v /$(realpath $(pwd)/..)://work \
7+
-w //work \
8+
ghdl/ext:vunit-master bash -c "cd ./VUnit && VUNIT_SIMULATOR=ghdl python3 run.py -v"

0 commit comments

Comments
 (0)