mirror of
https://github.com/myhdl/myhdl.git
synced 2024-12-14 07:44:38 +08:00
improve assert conversion to Verilog
make sure x-values trigger assertions
This commit is contained in:
parent
a45c9d4c82
commit
e6b9c54c3d
@ -222,6 +222,7 @@ def _writeSigDecls(f, intf, siglist, memlist):
|
||||
print >> f
|
||||
for s in constwires:
|
||||
print >> f, "assign %s = %s;" % (s._name, int(s._val))
|
||||
print >> f
|
||||
|
||||
|
||||
def _writeModuleFooter(f):
|
||||
@ -460,14 +461,14 @@ class _ConvertVisitor(_ConversionMixin):
|
||||
self.visit(node.expr)
|
||||
|
||||
def visitAssert(self, node, *args):
|
||||
self.write("if (!")
|
||||
self.write("if (")
|
||||
self.visit(node.test)
|
||||
self.write(") begin")
|
||||
self.write(" !== 1) begin")
|
||||
self.indent()
|
||||
self.writeline()
|
||||
self.write('$display("AssertionError");')
|
||||
self.writeline()
|
||||
self.write('$finish;')
|
||||
# self.writeline()
|
||||
# self.write('$finish;')
|
||||
self.dedent()
|
||||
self.writeline()
|
||||
self.write("end")
|
||||
|
Loading…
x
Reference in New Issue
Block a user