diff --git a/npc/core/src/main/scala/Keyboard.scala b/npc/core/src/main/scala/Keyboard.scala index 30159e0..16e39f1 100644 --- a/npc/core/src/main/scala/Keyboard.scala +++ b/npc/core/src/main/scala/Keyboard.scala @@ -80,8 +80,10 @@ class KeyboardSegController extends Module { when(io.keycode.bits === 0xF0.U) { release_state := true.B }.elsewhen(!release_state) { + when(io.keycode.bits =/= keycode) { + counter.inc() + } keycode := io.keycode.bits - counter.inc() }.otherwise{ // Release code on io.keycode.bits release_state := false.B