Skip to content

Commit

Permalink
Merge pull request #4 from 1138-4EB/stringified
Browse files Browse the repository at this point in the history
feat #3 split jsonLoadFile to jsonReadFile and jsonParseStream
  • Loading branch information
Paebbels committed May 19, 2018
2 parents 0d8df31 + 02de01d commit c097208
Show file tree
Hide file tree
Showing 3 changed files with 335 additions and 341 deletions.
31 changes: 22 additions & 9 deletions Examples/Boards_VUnit.vhdl
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
library vunit_lib;
context vunit_lib.vunit_context;

use work.json.all;
use work.json.T_JSON;
use work.json.jsonLoad;
use work.json.jsonGetString;

entity tb_boards is
generic (
runner_cfg : string;
tb_path : string;
filename : string
runner_cfg : string;
tb_path : string;
tb_cfg : string;
tb_cfg_file : string
);
end entity;

architecture tb of tb_boards is
constant JSONContent : T_JSON := jsonLoadFile(tb_path & filename);
constant JSONContent : T_JSON := jsonLoad(tb_cfg);
constant JSONFileContent : T_JSON := jsonLoad(tb_cfg_file);
begin
main: process
begin
test_runner_setup(runner, runner_cfg);
while test_suite loop
if run("test") then
info(tb_path&filename);
info("KC705/FPGADevice: " & jsonGetString(JSONContent, "KC705/FPGADevice"));
info("KC705/IIC/0/Devices/1/Type: " & jsonGetString(JSONContent, "KC705/IIC/0/Devices/1/Type"));
info("DE4/Ethernet/2/PHY_ManagementInterface: " & jsonGetString(JSONContent, "DE4/Ethernet/2/PHY_ManagementInterface"));
info("tb_cfg: " & tb_cfg);
info("JSONContent: " & lf & JSONContent.Content);
info("ML505/FPGA: " & jsonGetString(JSONContent, "ML505/FPGA"));
info("ML505/Eth/0/PHY-Int: " & jsonGetString(JSONContent, "ML505/Eth/0/PHY-Int"));
info("KC705/FPGA: " & jsonGetString(JSONContent, "KC705/FPGA"));
info("KC705/IIC/0/Devices/0/Name: " & jsonGetString(JSONContent, "KC705/IIC/0/Devices/0/Name"));

info("tb_path & tb_cfg_file: " & tb_path & tb_cfg_file);
info("JSONFileContent: " & lf & JSONFileContent.Content);
info("ML505/FPGADevice: " & jsonGetString(JSONFileContent, "ML505/FPGADevice"));
info("ML505/Ethernet/0/PHY_Device: " & jsonGetString(JSONFileContent, "ML505/Ethernet/0/PHY_Device"));
info("KC705/FPGADevice: " & jsonGetString(JSONFileContent, "KC705/FPGADevice"));
info("KC705/IIC/0/Devices/0/Type: " & jsonGetString(JSONFileContent, "KC705/IIC/0/Devices/0/Type"));
end if;
end loop;
test_runner_cleanup(runner);
Expand Down
7 changes: 6 additions & 1 deletion VUnit/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
lib.add_source_files(join(root, "../vhdl/JSON.pkg.vhdl"))
lib.add_source_files(join(root, "../Examples/Boards_VUnit.vhdl"))

vu.set_generic("filename","../Data/Boards2.json")
vu.set_generic('tb_cfg_file', '../Data/Boards2.json' )

import json
file = open('../Data/Boards1.json', 'r')
generics = json.loads(file.read())
vu.set_generic("tb_cfg", json.dumps(generics, separators=(',', ':')) )

vu.main()

0 comments on commit c097208

Please sign in to comment.