Skip to content

Commit

Permalink
Fixed std_reg bug that was causing to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ayakayorihiro committed Feb 1, 2024
1 parent 5c8fa19 commit 44ce33c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tools/firrtl/templates/std_reg.fir
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@
output done : UInt<1>

reg internal_reg : UInt<WIDTH>, clk
out <= internal_reg
when eq(write_en, UInt(1)):
internal_reg <= in
done <= UInt(1)
reg done_reg : UInt<1>, clk

when eq(reset, UInt(1)):
internal_reg <= UInt(0)
done_reg <= UInt(0)
else:
when eq(reset, UInt(1)):
done <= UInt(0)
internal_reg <= UInt(0)
when eq(write_en, UInt(1)):
internal_reg <= in
done_reg <= UInt(1)
else:
done <= UInt(0)
done_reg <= UInt(0)

out <= internal_reg
done <= done_reg

0 comments on commit 44ce33c

Please sign in to comment.