Explorar o código

provide scoped Yosys read_rtlil compatibility wrapper

高宇轩 hai 3 meses
pai
achega
e46c934d57
Modificáronse 2 ficheiros con 21 adicións e 1 borrados
  1. 1 1
      tests/formal/6400_host_i2c_properties.sby
  2. 20 0
      tools/formal-bin/yosys

+ 1 - 1
tests/formal/6400_host_i2c_properties.sby

@@ -9,7 +9,7 @@ depth 8
 boolector: smtbmc boolector
 
 [script]
-read_verilog -formal ../../src/transport/host_i2c_register_slave.v
+read_verilog -formal host_i2c_register_slave.v
 read_verilog -formal 6400_host_i2c_properties_formal.v
 prep -top host_i2c_properties_formal
 

+ 20 - 0
tools/formal-bin/yosys

@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+import os
+import subprocess
+import sys
+from pathlib import Path
+
+args = list(sys.argv[1:])
+temporary = None
+for index, value in enumerate(args):
+    path = Path(value)
+    if path.suffix == ".ys" and path.is_file():
+        temporary = path.with_name(path.name + ".compat")
+        temporary.write_text(path.read_text(encoding="utf-8").replace("read_ilang", "read_rtlil"), encoding="utf-8")
+        args[index] = str(temporary)
+        break
+try:
+    raise SystemExit(subprocess.call(["/usr/bin/yosys", *args]))
+finally:
+    if temporary is not None:
+        temporary.unlink(missing_ok=True)