Skip to content
This repository has been archived by the owner on Aug 19, 2024. It is now read-only.

Commit

Permalink
vcs: fix assertions at time 0
Browse files Browse the repository at this point in the history
The 'reset' signal cannot glitch from 0 to 1 at power on.
If it does, then all the assertions in a vcs design will fire.
  • Loading branch information
terpstra committed Aug 12, 2022
1 parent 7bc312b commit ab8d7a2
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ private[chiseltest] object VpiVerilogHarnessGenerator {
codeBuffer.append(s"module $testbenchName;\n")
codeBuffer.append(s" reg $clockName = 1;\n")
toplevel.inputs.foreach { case PinInfo(name, width, _) =>
codeBuffer.append(s" reg[${width - 1}:0] $name = 0;\n")
if (name == "reset") {
// This needs to start as 1, otherwise vcs assertions fire at time 0
codeBuffer.append(s" reg reset = 1;\n")
} else {
codeBuffer.append(s" reg[${width - 1}:0] $name = 0;\n")
}
}
toplevel.outputs.foreach { case PinInfo(name, width, _) =>
codeBuffer.append(s" wire[${width - 1}:0] $name;\n")
Expand Down

0 comments on commit ab8d7a2

Please sign in to comment.