File tree Expand file tree Collapse file tree 7 files changed +6
-27
lines changed
Expand file tree Collapse file tree 7 files changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ import chisel3._
44import chisel3 .util ._
55import _root_ .circt .stage .ChiselStage
66
7+ /**
8+ * @param width Bit width (default: 32 bits)
9+ */
710class ALU (val width : Int = 32 ) extends Module {
811 val io = IO (new Bundle {
912 val add = Input (Bool ());
Original file line number Diff line number Diff line change @@ -5,15 +5,14 @@ import _root_.circt.stage.ChiselStage
55import scala .math ._
66
77/**
8- * The Hardware thread "Hart" used in the
8+ * The Hardware thread "Hart" used in the RISC-V spec
99 *
1010 * @param width Bit width (default: 32 bits)
1111 */
12-
1312class Hart (val width : Int = 32 ) extends Module {
1413 val io = IO (new Bundle {})
1514
16- val program_pointer = RegInit ( 0 . U (width. W ))
15+ val program_pointer = Module ( new PC ());
1716
1817 val registers = Module (new Registers ());
1918}
Original file line number Diff line number Diff line change 1- // See README.md for license details.
2-
31package RISCV
42
53import chisel3 ._
64import chisel3 .util ._
7- // _root_ disambiguates from packages like chisel3.util.circt if imported
85import _root_ .circt .stage .ChiselStage
96import scala .math ._
107import os .read
Original file line number Diff line number Diff line change 1- // See README.md for license details.
2-
31package RISCV
42
53import chisel3 ._
6- // _root_ disambiguates from packages like chisel3.util.circt if imported
74import _root_ .circt .stage .ChiselStage
85import scala .math ._
96
Original file line number Diff line number Diff line change 1- // See README.md for license details.
2-
31package RISCV
42
53import chisel3 ._
6- // _root_ disambiguates from packages like chisel3.util.circt if imported
74import _root_ .circt .stage .ChiselStage
85import scala .math ._
96
10- /**
11- * A simple register file module with parameterizable width and number of registers.
12- *
13- * TODO: Set up two simultaneous read ports
14- */
15-
167class Registers () extends Module {
17- // Define input/output interface
188 val io = IO (new Bundle {
199 val in = Input (UInt (32 .W ))
2010 val write_addr = Input (UInt (5 .W ))
@@ -23,14 +13,11 @@ class Registers() extends Module {
2313 val out = Output (UInt (32 .W ))
2414 })
2515
26- // Internal register array
2716 val regs = RegInit (VecInit (Seq .fill(32 .toInt)(0 .U (32 .W ))))
2817
29- // Default output
3018 io.out := regs(io.read_addr)
3119
32- when(io.write_enable && (io.write_addr =/= 0 .U )) { // Write operation; Register 0 is hardwired to 0
20+ when(io.write_enable && (io.write_addr =/= 0 .U )) {
3321 regs(io.write_addr) := io.in
34- // printf(p"Writing value ${io.in} to register ${io.write_addr}\n")
3522 }
3623}
Original file line number Diff line number Diff line change 1- // See README.md for license details.
2-
31package RISCV
42
53import chisel3 ._
Original file line number Diff line number Diff line change 1- // See README.md for license details.
2-
31package RISCV
42
53import chisel3 ._
You can’t perform that action at this time.
0 commit comments