> configure(npc)

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:40:32  up 1 day 19:41,  2 users,  load average: 2.01, 1.24, 0.95
This commit is contained in:
tracer-ysyx 2024-01-09 20:40:32 +08:00 committed by xinyangli
parent f715cbd941
commit 3ccbccee77
No known key found for this signature in database
4 changed files with 9 additions and 13 deletions

View file

@ -2,11 +2,6 @@ top=Keyboard
io_ps2_clk PS2_CLK io_ps2_clk PS2_CLK
io_ps2_data PS2_DAT io_ps2_data PS2_DAT
io_seg_0 (SEG0A, SEG0B, SEG0C, SEG0D, SEG0E, SEG0F, SEG0G, DEC0P) io_seg_0 (SEG1A, SEG1B, SEG1C, SEG1D, SEG1E, SEG1F, SEG1G, DEC1P, SEG0A, SEG0B, SEG0C, SEG0D, SEG0E, SEG0F, SEG0G, DEC0P)
io_seg_1 (SEG1A, SEG1B, SEG1C, SEG1D, SEG1E, SEG1F, SEG1G, DEC1P) io_seg_1 (SEG3A, SEG3B, SEG3C, SEG3D, SEG3E, SEG3F, SEG3G, DEC3P, SEG2A, SEG2B, SEG2C, SEG2D, SEG2E, SEG2F, SEG2G, DEC2P)
io_seg_2 (SEG2A, SEG2B, SEG2C, SEG2D, SEG2E, SEG2F, SEG2G, DEC2P) io_seg_2 (SEG5A, SEG5B, SEG5C, SEG5D, SEG5E, SEG5F, SEG5G, DEC5P, SEG4A, SEG4B, SEG4C, SEG4D, SEG4E, SEG4F, SEG4G, DEC4P)
io_seg_3 (SEG3A, SEG3B, SEG3C, SEG3D, SEG3E, SEG3F, SEG3G, DEC3P)
io_seg_4 (SEG4A, SEG4B, SEG4C, SEG4D, SEG4E, SEG4F, SEG4G, DEC4P)
io_seg_5 (SEG5A, SEG5B, SEG5C, SEG5D, SEG5E, SEG5F, SEG5G, DEC5P)
io_seg_6 (SEG6A, SEG6B, SEG6C, SEG6D, SEG6E, SEG6F, SEG6G, DEC6P)
io_seg_7 (SEG7A, SEG7B, SEG7C, SEG7D, SEG7E, SEG7F, SEG7G, DEC7P)

View file

@ -63,7 +63,7 @@ class SegHandler(seg_count: Int) extends Module {
}) })
val seg_regs = RegInit(VecInit(Seq.fill(seg_count)(0.U(4.W)))) val seg_regs = RegInit(VecInit(Seq.fill(seg_count / 2)(0.U(8.W))))
val last_keycode = RegInit(0.U(8.W)) val last_keycode = RegInit(0.U(8.W))
val counter = Counter(0xFF) val counter = Counter(0xFF)
val digit_to_seg = Seq( val digit_to_seg = Seq(

View file

@ -85,14 +85,14 @@ import npc.keyboard._
class Keyboard extends Module { class Keyboard extends Module {
val io = IO(new Bundle { val io = IO(new Bundle {
val ps2 = PS2Port() val ps2 = PS2Port()
val segs = Output(Vec(6, UInt(4.W))) val segs = Output(Vec(3, UInt(8.W)))
}) })
val keyboard_controller = Module(new KeyboardController)
val seg_handler = Module(new SegHandler(6)) val seg_handler = Module(new SegHandler(6))
val keyboard_controller = Module(new KeyboardController)
seg_handler.io.keycode <> keyboard_controller.io.out seg_handler.io.keycode <> keyboard_controller.io.out
io <> keyboard_controller.io keyboard_controller.io.ps2 := io.ps2
io <> seg_handler.io io.segs := seg_handler.io.segs
} }

View file

@ -57,6 +57,7 @@ class KeyboardControllerSpec extends AnyFreeSpec with ChiselScalatestTester {
}) })
} }
} }
import npc.Keyboard
"Keyboard Simulation" in { "Keyboard Simulation" in {
test(new Keyboard) { c => test(new Keyboard) { c =>
} }