Converted cxxrtl

This commit is contained in:
Miodrag Milanovic
2026-04-16 11:00:44 +02:00
parent 4a89ae66ff
commit 149e2f343a
4 changed files with 148 additions and 19 deletions
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
import sys
sys.path.append("..")
import gen_tests_makefile
def run_subtest(name):
gen_tests_makefile.generate_cmd_test(f"cxxrtl_{name}", [
f"$${{CXX:-g++}} -std=c++11 -O2 -o cxxrtl-test-{name} -I../../backends/cxxrtl/runtime test_{name}.cc -lstdc++;",
f"./cxxrtl-test-{name} >/dev/null 2>&1",
])
def compile_only():
gen_tests_makefile.generate_cmd_test("cxxrtl_unconnected_output", [
'$(YOSYS) -p "read_verilog test_unconnected_output.v; select =*; proc; clean; write_cxxrtl cxxrtl-test-unconnected_output.cc" >/dev/null 2>&1;',
f'$${{CXX:-g++}} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc',
])
def main():
def callback():
run_subtest("value")
run_subtest("value_fuzz")
compile_only()
gen_tests_makefile.generate_custom(callback)
if __name__ == "__main__":
main()
-18
View File
@@ -1,18 +0,0 @@
#!/bin/bash
source ../common-env.sh
set -e
run_subtest () {
local subtest=$1; shift
${CXX:-g++} -std=c++11 -O2 -o cxxrtl-test-${subtest} -I../../backends/cxxrtl/runtime test_${subtest}.cc -lstdc++
./cxxrtl-test-${subtest}
}
run_subtest value
run_subtest value_fuzz
# Compile-only test.
../../yosys -p "read_verilog test_unconnected_output.v; select =*; proc; clean; write_cxxrtl cxxrtl-test-unconnected_output.cc" >/dev/null 2>&1
${CXX:-g++} -std=c++11 -c -o cxxrtl-test-unconnected_output -I../../backends/cxxrtl/runtime cxxrtl-test-unconnected_output.cc