From be72a39c8ff75b3227fb52fc5031a1e95d40897d Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Mon, 25 Mar 2024 20:43:02 +0000 Subject: [PATCH] Run all cocotb regression tests in GitHub Actions --- .github/workflows/build-test.yml | 6 +++++- NEWS.md | 1 + src/nvc.c | 1 + src/vhpi/vhpi-model.c | 7 +++++-- test/regress/vhpi10.vhd | 8 +++++++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 48fe5c9c..4e554e95 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -449,7 +449,7 @@ jobs: cd cocotb python3 -mvirtualenv venv . venv/bin/activate - pip install . + pip install . pytest - name: Run simple_dff example run: | . cocotb/venv/bin/activate @@ -462,6 +462,10 @@ jobs: run: | . cocotb/venv/bin/activate make -C cocotb/examples/adder/tests SIM=nvc TOPLEVEL_LANG=vhdl + - name: Run regression tests + run: | + . cocotb/venv/bin/activate + make -C cocotb/tests SIM=nvc TOPLEVEL_LANG=vhdl msi-installer: name: Windows MSI installer diff --git a/NEWS.md b/NEWS.md index dadde924..d8fe8edb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,7 @@ be any integer type when `--relaxed` is passed (#862). - Resolved several other minor issues (#654, #854, #855, #859, #863). - The default standard version was changed to VHDL-2008. +- The `--vhpi-trace` option now implies `--vhpi-debug`. ## Version 1.11.3 - 2024-02-04 - Fixed incorrect effective value when a signal has multiple sources due diff --git a/src/nvc.c b/src/nvc.c index 0a4f9eb5..8255df10 100644 --- a/src/nvc.c +++ b/src/nvc.c @@ -696,6 +696,7 @@ static int run_cmd(int argc, char **argv, cmd_state_t *state) break; case 'T': opt_set_str(OPT_VHPI_TRACE, "1"); + opt_set_int(OPT_VHPI_DEBUG, 1); break; case 'D': opt_set_int(OPT_VHPI_DEBUG, 1); diff --git a/src/vhpi/vhpi-model.c b/src/vhpi/vhpi-model.c index 2b974e56..9b58be2f 100644 --- a/src/vhpi/vhpi-model.c +++ b/src/vhpi/vhpi-model.c @@ -3519,8 +3519,11 @@ static void vhpi_lazy_component(c_abstractRegion *r) tree_t inner = tree_stmt(r->tree, 0); assert(tree_kind(inner) == T_BLOCK); - vhpi_build_generics(r->tree, r); - vhpi_build_ports(r->tree, r); + // Make sure all lookups happen in the implicit inner region + r->tree = inner; + + vhpi_build_generics(inner, r); + vhpi_build_ports(inner, r); vhpi_build_decls(inner, r); vhpi_build_stmts(inner, r); } diff --git a/test/regress/vhpi10.vhd b/test/regress/vhpi10.vhd index 917547a7..e3f8d0fe 100644 --- a/test/regress/vhpi10.vhd +++ b/test/regress/vhpi10.vhd @@ -10,6 +10,7 @@ entity sub is end entity; architecture test of sub is + signal dyn : bit_vector(1 to g1'length); begin sub_b0: block is @@ -45,6 +46,11 @@ architecture test of vhpi10 is package pkg is new work.counter generic map (MAX => 10D"999"); signal s0: pkg.counter_t; + + function func return string is + begin + return "world"; + end function; begin b0: block is @@ -59,7 +65,7 @@ begin end block; i0: component sub - generic map ( g0 => 100, g1 => "world" ) + generic map ( g0 => 100, g1 => func ) port map ( p0 => "101" ); end architecture; -- 2.39.2