From 64f891308eca0372362d6ea1e197cc554a2a9aec Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Thu, 7 Mar 2024 18:16:48 +0800 Subject: [PATCH] =?UTF-8?q?>=20configure(npc)=20=20ysyx=5F22040000=20?= =?UTF-8?q?=E6=9D=8E=E5=BF=83=E6=9D=A8=20=20Linux=20calcite=206.6.19=20#1-?= =?UTF-8?q?NixOS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Mar=20=201=2012:35:11?= =?UTF-8?q?=20UTC=202024=20x86=5F64=20GNU/Linux=20=20=2018:16:48=20=20up?= =?UTF-8?q?=20=20=203:36,=20=202=20users,=20=20load=20average:=200.28,=200?= =?UTF-8?q?.25,=200.34?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- npc/core/src/main/scala/Main.scala | 13 ++++++++++++- npc/core/src/main/scala/ProgramCounter.scala | 11 +++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 npc/core/src/main/scala/ProgramCounter.scala diff --git a/npc/core/src/main/scala/Main.scala b/npc/core/src/main/scala/Main.scala index c06bc8e..95b9e61 100644 --- a/npc/core/src/main/scala/Main.scala +++ b/npc/core/src/main/scala/Main.scala @@ -2,8 +2,10 @@ package npc import chisel3._ import chisel3.util.{MuxLookup, Fill, Decoupled, Counter, Queue, Reverse} +import chisel3.util.{SRAM} import chisel3.stage.ChiselOption -import npc.util.KeyboardSegController +import npc.util.{ KeyboardSegController, RegisterFile } +import flowpc.components.ProgramCounter class Switch extends Module { val io = IO(new Bundle { @@ -31,3 +33,12 @@ class Keyboard extends Module { io.segs := seg_handler.io.segs } +<<<<<<< Updated upstream +======= +class Flowpc extends Module { + val io = IO(new Bundle { }) + val register_file = new RegisterFile(readPorts = 2); + val pc = new ProgramCounter(32); + val adder = new SRAM() +} +>>>>>>> Stashed changes diff --git a/npc/core/src/main/scala/ProgramCounter.scala b/npc/core/src/main/scala/ProgramCounter.scala new file mode 100644 index 0000000..0687f9a --- /dev/null +++ b/npc/core/src/main/scala/ProgramCounter.scala @@ -0,0 +1,11 @@ +package flowpc.components +import chisel3._ +import chisel3.util.{Valid} + +class ProgramCounter (width: Int) extends Module { + val io = new Bundle { + val next_pc = Input(Flipped(Valid(UInt(width.W)))) + val pc = Output(UInt(width.W)) + } + io.pc := Mux(io.next_pc.valid, io.next_pc.bits, io.pc) +}