mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #3871 from jix/smtbmc-sexpr-scan
smtbmc: Avoid quadratic behavior when scanning s-exprs
This commit is contained in:
commit
701b767736
|
@ -245,6 +245,7 @@ class SmtIo:
|
|||
self.logic_uf = False
|
||||
self.unroll_idcnt = 0
|
||||
self.unroll_buffer = ""
|
||||
self.unroll_level = 0
|
||||
self.unroll_sorts = set()
|
||||
self.unroll_objs = set()
|
||||
self.unroll_decls = dict()
|
||||
|
@ -420,13 +421,15 @@ class SmtIo:
|
|||
self.p_close()
|
||||
|
||||
if unroll and self.unroll:
|
||||
stmt = self.unroll_buffer + stmt
|
||||
self.unroll_buffer = ""
|
||||
|
||||
s = re.sub(r"\|[^|]*\|", "", stmt)
|
||||
if s.count("(") != s.count(")"):
|
||||
self.unroll_buffer = stmt + " "
|
||||
self.unroll_level += s.count("(") - s.count(")")
|
||||
if self.unroll_level > 0:
|
||||
self.unroll_buffer += stmt
|
||||
self.unroll_buffer += " "
|
||||
return
|
||||
else:
|
||||
stmt = self.unroll_buffer + stmt
|
||||
self.unroll_buffer = ""
|
||||
|
||||
s = self.parse(stmt)
|
||||
|
||||
|
|
Loading…
Reference in New Issue