Commit e1948689 by Zachary Snow

support newer iverilog versions

- Add script to drop parameters from VCDs.
- Bump the version of iverilog used in CI. I couldn't use anything never
  than eab37efb due a pending iverilog issue.
- Standardize around Python 3 in test cases.
parent 03610606
...@@ -41,7 +41,7 @@ jobs: ...@@ -41,7 +41,7 @@ jobs:
- macOS-11 - macOS-11
needs: build needs: build
env: env:
IVERILOG_REF: 7c5694e5163e905b7ba85096ae67e5f28862db48 IVERILOG_REF: eab37efb561259df7e27aa26f080a7b0f2ca48a1
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Install Dependencies (macOS) - name: Install Dependencies (macOS)
......
...@@ -39,7 +39,7 @@ All of sv2v's dependencies are free and open-source. ...@@ -39,7 +39,7 @@ All of sv2v's dependencies are free and open-source.
* [Icarus Verilog](https://steveicarus.github.io/iverilog/) - for Verilog * [Icarus Verilog](https://steveicarus.github.io/iverilog/) - for Verilog
simulation simulation
* [shUnit2](https://github.com/kward/shunit2) - test framework * [shUnit2](https://github.com/kward/shunit2) - test framework
* Python (any version) - for generating certain test cases * Python 3.x - for evaluating certain test cases
## Installation ## Installation
......
#!/usr/bin/env python3
import sys
from collections import deque
if __name__ == "__main__":
pending = deque()
replaced = {}
dumping = False
for line in sys.stdin:
# Find and drop dumped parameters.
if line.startswith("$var "):
parts = line.split()
should_drop = parts[1] == "parameter"
if not should_drop and not pending:
print(line, end="")
continue
ident_old = parts[3]
pending.append(ident_old)
if should_drop:
replaced[ident_old] = None
continue
ident_new = pending.popleft()
parts[3] = ident_new
replaced[ident_old] = ident_new
print(" ".join(parts))
# Pass through lines if we have no transformations to do.
elif line.startswith("$dump"):
dumping = True
print(line, end="")
elif line.startswith("$end"):
# dumping = False
print(line, end="")
elif not dumping or not replaced:
print(line, end="")
elif line[0] == "#":
print(line, end="")
# Rename dumped variables.
elif line.startswith("b"):
value, ident = line.split()
ident = replaced.get(ident, ident)
if ident is not None:
print(value, ident)
elif line[0] in "01xz":
value = line[0]
ident = line[1:-1]
ident = replaced.get(ident, ident)
if ident is not None:
print(value + ident)
else:
raise RuntimeError(f"Unhandled: {line.strip()}")
...@@ -36,7 +36,7 @@ simulate() { ...@@ -36,7 +36,7 @@ simulate() {
$sim_prog > $sim_log $sim_prog > $sim_log
assertTrue "simulating $1 failed" $? assertTrue "simulating $1 failed" $?
# remove the date from the VCD # remove the date from the VCD
sed -e "1,3d" < $sim_vcd_tmp > $sim_vcd sed -e "1,3d" < $sim_vcd_tmp | $SCRIPT_DIR/clean_vcd.py > $sim_vcd
} }
assertConverts() { assertConverts() {
......
#!/bin/bash #!/bin/bash
py=$(which python3 || which python) python3 gen.py 4 b 2 01xz > binary.sv
$py gen.py 4 b 2 01xz > binary.sv python3 gen.py 2 o 8 01234567xz > octal.sv
$py gen.py 2 o 8 01234567xz > octal.sv python3 gen.py 2 d 10 0123456789 > decimal.sv
$py gen.py 2 d 10 0123456789 > decimal.sv python3 gen.py 2 h 16 0123456789abcdefxz > hex.sv
$py gen.py 2 h 16 0123456789abcdefxz > hex.sv
source ../lib/runner.sh source ../lib/runner.sh
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment