diff options
author | Alberto Gonzalez <boqwxp@airmail.cc> | 2020-07-20 22:09:44 +0000 |
---|---|---|
committer | Alberto Gonzalez <boqwxp@airmail.cc> | 2020-07-20 22:09:44 +0000 |
commit | 42fb75c57092714fce0394817154cdd5d63e9d2b (patch) | |
tree | a607d91aff5aeaea54c51fa813f75a3030a3fee8 /backends/smt2 | |
parent | 654864658f17a26d760995462e57481ff81b037c (diff) | |
download | yosys-42fb75c57092714fce0394817154cdd5d63e9d2b.tar.gz yosys-42fb75c57092714fce0394817154cdd5d63e9d2b.tar.bz2 yosys-42fb75c57092714fce0394817154cdd5d63e9d2b.zip |
smtio: Emit `mode: start` options before `set-logic` command and any other options after it.
Refer to the SMT-LIB specification, section 4.1.7. According to the spec, some options can only be specified in `start` mode. Once the solver sees `set-logic`, it moves to `assert` mode.
Diffstat (limited to 'backends/smt2')
-rw-r--r-- | backends/smt2/smtio.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/backends/smt2/smtio.py b/backends/smt2/smtio.py index 6191eabf6..516091011 100644 --- a/backends/smt2/smtio.py +++ b/backends/smt2/smtio.py @@ -262,13 +262,20 @@ class SmtIo: if self.produce_models: self.write("(set-option :produce-models true)") + #See the SMT-LIB Standard, Section 4.1.7 + modestart_options = [":global-declarations", ":interactive-mode", ":produce-assertions", ":produce-assignments", ":produce-models", ":produce-proofs", ":produce-unsat-assumptions", ":produce-unsat-cores", ":random-seed"] + for key, val in self.smt2_options.items(): + if key in modestart_options: + self.write("(set-option {} {})".format(key, val)) + self.write("(set-logic %s)" % self.logic) if self.forall and self.solver == "yices": self.write("(set-option :yices-ef-max-iters 1000000000)") for key, val in self.smt2_options.items(): - self.write("(set-option {} {})".format(key, val)) + if key not in modestart_options: + self.write("(set-option {} {})".format(key, val)) def timestamp(self): secs = int(time() - self.start_time) |