> build_npc_VKeyboard_nvboard

ysyx_22040000 李心杨
 Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
  20:50:18  up 1 day 19:51,  2 users,  load average: 0.65, 0.62, 0.77
This commit is contained in:
tracer-ysyx 2024-01-09 20:50:18 +08:00 committed by xinyangli
parent b30b2170cb
commit e28c482d5d
No known key found for this signature in database

View file

@ -59,11 +59,11 @@ class KeyboardController extends Module {
class SegHandler(seg_count: Int) extends Module {
val io = IO(new Bundle {
val keycode = Flipped(Decoupled(UInt(8.W)))
val segs = Output(Vec(seg_count / 2, UInt(8.W)))
val segs = Output(Vec(seg_count / 2, UInt(16.W)))
})
val seg_regs = RegInit(VecInit(Seq.fill(seg_count / 2)(0.U(8.W))))
val seg_regs = RegInit(VecInit(Seq.fill(seg_count / 2)(0.U(16.W))))
val last_keycode = RegInit(0.U(8.W))
val counter = Counter(0xFF)
val digit_to_seg = Seq(
@ -103,7 +103,7 @@ class SegHandler(seg_count: Int) extends Module {
}
seg_regs := Seq(counter.value, last_keycode, last_keycode).map(d => {
MuxLookup(d & 0xF.U, 0.U)(digit_to_seg) | (MuxLookup((d >> 4.U) & 0xF.U, 0.U)(digit_to_seg) << 4.U)
MuxLookup(d & 0xF.U, 0.U)(digit_to_seg) | (MuxLookup((d >> 4.U) & 0xF.U, 0.U)(digit_to_seg) << 8.U)
})
}