Skip to content

Commit e17ec78

Browse files
More cleanup
1 parent 70d842e commit e17ec78

File tree

7 files changed

+6
-27
lines changed

7 files changed

+6
-27
lines changed

src/main/scala/RISCV/ALU.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import chisel3._
44
import chisel3.util._
55
import _root_.circt.stage.ChiselStage
66

7+
/**
8+
* @param width Bit width (default: 32 bits)
9+
*/
710
class ALU(val width: Int = 32) extends Module {
811
val io = IO(new Bundle {
912
val add = Input(Bool());

src/main/scala/RISCV/Hart.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ import _root_.circt.stage.ChiselStage
55
import 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-
1312
class 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
}

src/main/scala/RISCV/Main.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
// See README.md for license details.
2-
31
package RISCV
42

53
import chisel3._
64
import chisel3.util._
7-
// _root_ disambiguates from packages like chisel3.util.circt if imported
85
import _root_.circt.stage.ChiselStage
96
import scala.math._
107
import os.read

src/main/scala/RISCV/PC.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
// See README.md for license details.
2-
31
package RISCV
42

53
import chisel3._
6-
// _root_ disambiguates from packages like chisel3.util.circt if imported
74
import _root_.circt.stage.ChiselStage
85
import scala.math._
96

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
1-
// See README.md for license details.
2-
31
package RISCV
42

53
import chisel3._
6-
// _root_ disambiguates from packages like chisel3.util.circt if imported
74
import _root_.circt.stage.ChiselStage
85
import 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-
167
class 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
}

src/test/scala/RISCV/MainSpec.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// See README.md for license details.
2-
31
package RISCV
42

53
import chisel3._

src/test/scala/RISCV/RegistersSpec.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// See README.md for license details.
2-
31
package RISCV
42

53
import chisel3._

0 commit comments

Comments
 (0)