Avoid conflicting assigments to registers in timers. Give priority to start over stop.
This commit is contained in:
parent
137b77d780
commit
04be438847
@ -22,12 +22,10 @@ class Timer(initCount: Int) extends Module {
|
||||
countdown := UInt(initCount - 1)
|
||||
active := Bool(true)
|
||||
}
|
||||
|
||||
when (io.stop) {
|
||||
.elsewhen (io.stop) {
|
||||
active := Bool(false)
|
||||
}
|
||||
|
||||
when (active) {
|
||||
.elsewhen (active) {
|
||||
countdown := countdown - UInt(1)
|
||||
}
|
||||
|
||||
@ -64,14 +62,13 @@ class DynamicTimer(width: Int) extends Module {
|
||||
countdown := io.period
|
||||
active := Bool(true)
|
||||
}
|
||||
.elsewhen (io.stop) {
|
||||
active := Bool(false)
|
||||
}
|
||||
.elsewhen (active) {
|
||||
countdown := countdown - UInt(1)
|
||||
}
|
||||
|
||||
when (io.stop) {
|
||||
active := Bool(false)
|
||||
}
|
||||
|
||||
io.timeout := countdown === UInt(0) && active
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user