Skip to content

Commit c097208

Browse files
authored
Merge pull request #4 from 1138-4EB/stringified
feat #3 split jsonLoadFile to jsonReadFile and jsonParseStream
2 parents 0d8df31 + 02de01d commit c097208

File tree

3 files changed

+335
-341
lines changed

3 files changed

+335
-341
lines changed

Examples/Boards_VUnit.vhdl

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,41 @@
11
library vunit_lib;
22
context vunit_lib.vunit_context;
33

4-
use work.json.all;
4+
use work.json.T_JSON;
5+
use work.json.jsonLoad;
6+
use work.json.jsonGetString;
57

68
entity tb_boards is
79
generic (
8-
runner_cfg : string;
9-
tb_path : string;
10-
filename : string
10+
runner_cfg : string;
11+
tb_path : string;
12+
tb_cfg : string;
13+
tb_cfg_file : string
1114
);
1215
end entity;
1316

1417
architecture tb of tb_boards is
15-
constant JSONContent : T_JSON := jsonLoadFile(tb_path & filename);
18+
constant JSONContent : T_JSON := jsonLoad(tb_cfg);
19+
constant JSONFileContent : T_JSON := jsonLoad(tb_cfg_file);
1620
begin
1721
main: process
1822
begin
1923
test_runner_setup(runner, runner_cfg);
2024
while test_suite loop
2125
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+
info("tb_cfg: " & tb_cfg);
27+
info("JSONContent: " & lf & JSONContent.Content);
28+
info("ML505/FPGA: " & jsonGetString(JSONContent, "ML505/FPGA"));
29+
info("ML505/Eth/0/PHY-Int: " & jsonGetString(JSONContent, "ML505/Eth/0/PHY-Int"));
30+
info("KC705/FPGA: " & jsonGetString(JSONContent, "KC705/FPGA"));
31+
info("KC705/IIC/0/Devices/0/Name: " & jsonGetString(JSONContent, "KC705/IIC/0/Devices/0/Name"));
32+
33+
info("tb_path & tb_cfg_file: " & tb_path & tb_cfg_file);
34+
info("JSONFileContent: " & lf & JSONFileContent.Content);
35+
info("ML505/FPGADevice: " & jsonGetString(JSONFileContent, "ML505/FPGADevice"));
36+
info("ML505/Ethernet/0/PHY_Device: " & jsonGetString(JSONFileContent, "ML505/Ethernet/0/PHY_Device"));
37+
info("KC705/FPGADevice: " & jsonGetString(JSONFileContent, "KC705/FPGADevice"));
38+
info("KC705/IIC/0/Devices/0/Type: " & jsonGetString(JSONFileContent, "KC705/IIC/0/Devices/0/Type"));
2639
end if;
2740
end loop;
2841
test_runner_cleanup(runner);

VUnit/run.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
lib.add_source_files(join(root, "../vhdl/JSON.pkg.vhdl"))
1010
lib.add_source_files(join(root, "../Examples/Boards_VUnit.vhdl"))
1111

12-
vu.set_generic("filename","../Data/Boards2.json")
12+
vu.set_generic('tb_cfg_file', '../Data/Boards2.json' )
13+
14+
import json
15+
file = open('../Data/Boards1.json', 'r')
16+
generics = json.loads(file.read())
17+
vu.set_generic("tb_cfg", json.dumps(generics, separators=(',', ':')) )
1318

1419
vu.main()

0 commit comments

Comments
 (0)