aboutsummaryrefslogtreecommitdiffstats
path: root/backends
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-09-02 13:46:56 +0200
committerClifford Wolf <clifford@clifford.at>2016-09-02 13:46:56 +0200
commit948aac9e1eaed04aa8de08e62cfb078d6337e9c9 (patch)
tree2da60b83ac46997fbadf9001500887f1591a4dd7 /backends
parentd88cd0ae7f8761637722d5d2c6cc1c8bac762ce3 (diff)
downloadyosys-948aac9e1eaed04aa8de08e62cfb078d6337e9c9.tar.gz
yosys-948aac9e1eaed04aa8de08e62cfb078d6337e9c9.tar.bz2
yosys-948aac9e1eaed04aa8de08e62cfb078d6337e9c9.zip
Don't re-create hex_dict for each value
Diffstat (limited to 'backends')
-rw-r--r--backends/smt2/smtio.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/backends/smt2/smtio.py b/backends/smt2/smtio.py
index 56ae8dcfe..dad63e567 100644
--- a/backends/smt2/smtio.py
+++ b/backends/smt2/smtio.py
@@ -23,6 +23,16 @@ from select import select
from time import time
+hex_dict = {
+ "0": "0000", "1": "0001", "2": "0010", "3": "0011",
+ "4": "0100", "5": "0101", "6": "0110", "7": "0111",
+ "8": "1000", "9": "1001", "A": "1010", "B": "1011",
+ "C": "1100", "D": "1101", "E": "1110", "F": "1111",
+ "a": "1010", "b": "1011", "c": "1100", "d": "1101",
+ "e": "1110", "f": "1111"
+}
+
+
class SmtModInfo:
def __init__(self):
self.inputs = set()
@@ -294,13 +304,6 @@ class SmtIo:
if v.startswith("#b"):
return v[2:]
if v.startswith("#x"):
- hex_dict = {
- "0": "0000", "1": "0001", "2": "0010", "3": "0011",
- "4": "0100", "5": "0101", "6": "0110", "7": "0111",
- "8": "1000", "9": "1001", "A": "1010", "B": "1011",
- "C": "1100", "D": "1101", "E": "1110", "F": "1111",
- "a": "1010", "b": "1011", "c": "1100", "d": "1101",
- "e": "1110", "f": "1111"}
return "".join(hex_dict.get(x) for x in v[2:])
assert False