From fca282d7486f2006353eec4974725c553d952b08 Mon Sep 17 00:00:00 2001 From: bhuvan-somisetty Date: Fri, 6 Nov 2026 16:36:31 +0530 Subject: [PATCH 1/3] fix: stop the 10th Verilog read in a step from hanging The read state arrays hold MAXFILES entries, but readdata only bailed out when filenum went above MAXFILES, so one extra read wrote past the end and then looped forever. Use >= so it hits the "too many reads" check, and add a test for it. --- .github/workflows/ci.yml | 7 +++++++ concore.v | 2 +- concoredocker.v | 2 +- tests/verilog/test_read_limit.v | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tests/verilog/test_read_limit.v diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb47fa0..635494f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,6 +121,13 @@ jobs: iverilog -g2012 -I. -o "$RUNNER_TEMP/verilog/test_read_simtime" tests/verilog/test_read_simtime.v cd "$RUNNER_TEMP/verilog" && vvp test_read_simtime + - name: Run Verilog read limit test + run: | + iverilog -g2012 -I. -o "$RUNNER_TEMP/verilog/test_read_limit" tests/verilog/test_read_limit.v + cd "$RUNNER_TEMP/verilog" + timeout 60 vvp test_read_limit | tee read_limit.log + grep -q "too many reads in loop" read_limit.log + - name: Run Verilog interop tests run: julia --color=yes tests/julia/test_verilog_interop.jl diff --git a/concore.v b/concore.v index 3576989..8c186aa 100644 --- a/concore.v +++ b/concore.v @@ -132,7 +132,7 @@ module concore; integer i; begin filenum = filenum + 1; - if (filenum > `MAXFILES) + if (filenum >= `MAXFILES) begin $display("too many reads in loop"); $finish; diff --git a/concoredocker.v b/concoredocker.v index 4871fdd..d6ef83d 100644 --- a/concoredocker.v +++ b/concoredocker.v @@ -132,7 +132,7 @@ module concore; integer i; begin filenum = filenum + 1; - if (filenum > `MAXFILES) + if (filenum >= `MAXFILES) begin $display("too many reads in loop"); $finish; diff --git a/tests/verilog/test_read_limit.v b/tests/verilog/test_read_limit.v new file mode 100644 index 0000000..ebf3dda --- /dev/null +++ b/tests/verilog/test_read_limit.v @@ -0,0 +1,21 @@ +`include "concore.v" + +// readdata keeps state for at most MAXFILES reads per step. Reading more +// than that must stop with "too many reads in loop" instead of hanging. +// run from a directory that has an empty in1/ folder +module test_read_limit; +reg [8*10-1:0] init = "[0.0, 1.0]"; +integer k; + +initial begin + for (k = 0; k < `MAXFILES; k = k + 1) begin + concore.readdata(1, "missing", init); + if (concore.data[0] != 1.0) $fatal(1, "read %0d: data[0] is %f, expected 1.0", k + 1, concore.data[0]); + end + $display("%0d reads in one step ok", `MAXFILES); + + // this one is over the limit, readdata should call $finish itself + concore.readdata(1, "missing", init); + $fatal(1, "read %0d went past the MAXFILES limit", `MAXFILES + 1); +end +endmodule From 367c6870418d8541b342c5c528c5502b0763160a Mon Sep 17 00:00:00 2001 From: bhuvan-somisetty Date: Mon, 2 Nov 2026 21:38:27 +0530 Subject: [PATCH 2/3] test: write the comma params test file to in1 in TestConcoreHpp.cpp --- TestConcoreHpp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestConcoreHpp.cpp b/TestConcoreHpp.cpp index 6b6ad2c..f7311af 100644 --- a/TestConcoreHpp.cpp +++ b/TestConcoreHpp.cpp @@ -333,7 +333,7 @@ static void test_load_params_semicolon_format() { static void test_tryparam_comma_in_value() { setup_dirs(); - write_file("in/1/concore.params", "{'channels': [1, 2], 'gain': '0.5'}"); + write_file("in1/concore.params", "{'channels': [1, 2], 'gain': '0.5'}"); Concore c; c.delay = 0; @@ -342,7 +342,7 @@ static void test_tryparam_comma_in_value() { check("tryparam preserves list with comma", c.tryparam("channels", "") == "[1, 2]"); check("tryparam preserves subsequent key", c.tryparam("gain", "") == "0.5"); - rm("in/1/concore.params"); + rm("in1/concore.params"); } // ------------- main ------------------------------------------------------- From 5804d3cf0e0b9488817c1e7f1e1048a80943b993 Mon Sep 17 00:00:00 2001 From: bhuvan-somisetty Date: Fri, 6 Nov 2026 16:40:09 +0530 Subject: [PATCH 3/3] ci: run the python test matrix on ubuntu-24.04 ubuntu-latest moved to 26.04, which has no Python 3.9, so the 3.9 job fails at setup and cancels the rest of the matrix. requires-python is still >=3.9, so pin the runner instead of dropping it. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 635494f..97dd68e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: run: ruff check . --output-format=github test: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 strategy: matrix: python-version: ['3.9', '3.10', '3.11', '3.12']