This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 76
Parse bitwuzla version number to provide appropriate command line args #721
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ package chiseltest.formal.backends.smt | |
|
||
import firrtl2.backends.experimental.smt._ | ||
import scala.collection.mutable | ||
import scala.util.matching.Regex | ||
|
||
object Yices2SMTLib extends Solver { | ||
private val cmd = List("yices-smt2", "--incremental", "--smt2-model-format") | ||
|
@@ -34,7 +35,34 @@ object BoolectorSMTLib extends Solver { | |
} | ||
|
||
object BitwuzlaSMTLib extends Solver { | ||
private val cmd = List("bitwuzla", "--smt2", "--incremental") | ||
/* Bitwuzla accepts different command line arguments based on it's version | ||
* See: https://github.com/bitwuzla/bitwuzla/blob/main/NEWS.md */ | ||
private def cmd = { | ||
val version_regex: Regex = "([0-9]+).([0-9]+).([0-9]+)".r.unanchored | ||
val version_cmd = List("bitwuzla", "--version") | ||
val r = os.proc(version_cmd).call() | ||
val res = r.out.lines().head.trim | ||
|
||
res match { | ||
case version_regex(major, minor, _) => { | ||
List("bitwuzla") ++ | ||
/* --incremental argument removed as of 0.1.0 - See NEWS.md */ | ||
(if (major.toInt == 0 && minor.toInt == 0) { | ||
List("--incremental") | ||
} else { | ||
List() | ||
}) ++ | ||
/* --lang option is used to specify smt2 as of 0.3.0 - See NEWS.md and | ||
* https://github.com/bitwuzla/bitwuzla/issues/75 */ | ||
(if (major.toInt == 0 && minor.toInt < 3) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here a comment to the issue or PR or documentation of bitwuzla would be great |
||
List("--smt2") | ||
} else { | ||
List("--lang", "smt2") | ||
}) | ||
} | ||
case _ => List("bitwuzla", "--smt2", "--incremental") | ||
} | ||
} | ||
override def name = "bitwuzla-smtlib" | ||
override def supportsConstArrays = false | ||
override def supportsUninterpretedFunctions = false | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a comment to where you found the info for which flags to use?