mirror of
https://github.com/YosysHQ/yosys
synced 2026-03-24 05:19:15 +00:00
Convert gen-tests shell script to python
This commit is contained in:
parent
486c3715fb
commit
2fb0ca49ff
60 changed files with 421 additions and 237 deletions
35
tests/sim/generate_mk.py
Normal file
35
tests/sim/generate_mk.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
sys.path.append("..")
|
||||
|
||||
import gen_tests_makefile
|
||||
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
print("Generate FST for sim models")
|
||||
|
||||
for name in Path("tb").rglob("tb*.v"):
|
||||
test_name = name.stem
|
||||
print(f"Test {test_name}")
|
||||
|
||||
verilog_name = f"{test_name[3:]}.v"
|
||||
|
||||
out_file = Path("tb") / f"{test_name}.out"
|
||||
|
||||
subprocess.run(
|
||||
["iverilog", "-o", str(out_file), str(name), verilog_name],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=True
|
||||
)
|
||||
|
||||
subprocess.run(
|
||||
[str(out_file), "-fst"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
check=True
|
||||
)
|
||||
|
||||
gen_tests_makefile.generate(["--yosys-scripts", "--bash", "--yosys-args", "-w 'Yosys has only limited support for tri-state logic at the moment.'" ])
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
source ../gen-tests-makefile.sh
|
||||
echo "Generate FST for sim models"
|
||||
find tb/* -name tb*.v | while read name; do
|
||||
test_name=$(basename $name .v)
|
||||
echo "Test $test_name"
|
||||
verilog_name=${test_name:3}.v
|
||||
iverilog -o tb/$test_name.out $name $verilog_name >/dev/null 2>&1
|
||||
./tb/$test_name.out -fst >/dev/null 2>&1
|
||||
done
|
||||
generate_mk --yosys-scripts --bash --yosys-args "-w 'Yosys has only limited support for tri-state logic at the moment.'"
|
||||
Loading…
Add table
Add a link
Reference in a new issue