From d3812b75e312d63e137ff237ab3f6c7447643009 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Wed, 10 Jan 2024 17:33:36 +0800 Subject: [PATCH] =?UTF-8?q?>=20build=5Fnpc=5FVKeyboard=5Fnvboard=20=20ysyx?= =?UTF-8?q?=5F22040000=20=E6=9D=8E=E5=BF=83=E6=9D=A8=20=20Linux=20calcite?= =?UTF-8?q?=206.1.69=20#1-NixOS=20SMP=20PREEMPT=5FDYNAMIC=20Wed=20Dec=2020?= =?UTF-8?q?=2016:00:29=20UTC=202023=20x86=5F64=20GNU/Linux=20=20=2017:33:3?= =?UTF-8?q?6=20=20up=202=20days=2016:34,=20=202=20users,=20=20load=20avera?= =?UTF-8?q?ge:=202.88,=201.66,=201.14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- npc/core/src/main/scala/Keyboard.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/npc/core/src/main/scala/Keyboard.scala b/npc/core/src/main/scala/Keyboard.scala index 80c25e2..8a5506b 100644 --- a/npc/core/src/main/scala/Keyboard.scala +++ b/npc/core/src/main/scala/Keyboard.scala @@ -62,8 +62,6 @@ class SegGenerator(seg_count: Int) extends Module { val keycode = Flipped(Decoupled(UInt(8.W))) val segs = Output(Vec(seg_count, UInt(8.W))) }) - val counter = Counter(0xFF) - io.keycode.ready := false.B when(io.keycode.valid) { io.keycode.ready := true.B @@ -94,7 +92,8 @@ class SegGenerator(seg_count: Int) extends Module { val ascii = MuxLookup(keycode, 0.U)(keycode_to_ascii) val ascii_digits = VecInit(ascii(3,0)) ++ VecInit(ascii(6,4)) val ascii_seg = ascii_digits.map(MuxLookup(_, 0xFF.U)(digit_to_seg)) - val count_digits = VecInit(counter.value(3,0)) ++ VecInit(counter.value(7,4)) + val (counter, _) = Counter(io.keycode.valid && io.keycode.ready && io.keycode.bits =/= keycode, 0xFF) + val count_digits = VecInit(counter(3,0)) ++ VecInit(counter(7,4)) val count_seg = count_digits.map(MuxLookup(_, 0xFF.U)(digit_to_seg)) seg_regs := keycode_seg ++ ascii_seg ++ count_seg ++ Seq(0xFF.U, 0xFF.U)