-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5831328
commit 0a1b6c9
Showing
7 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
generated | ||
build | ||
fusesoc_libraries | ||
|
||
# Generated by scala | ||
.bsp | ||
targer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package riscv.stage.reg | ||
|
||
import riscv.stage.regfile.Regfile | ||
import chisel3._ | ||
import chisel3.util._ | ||
|
||
/* Control inputs */ | ||
class RegStageControl(numregs: Int, width: Int) extends Bundle { | ||
val selectWidth = log2Ceil(numregs).W | ||
val s1 = Input(UInt(selectWidth)) | ||
val s2 = Input(UInt(selectWidth)) | ||
val sd = Input(UInt(selectWidth)) | ||
} | ||
|
||
class WbStageControl extends Bundle { | ||
val wen = Input(Bool()) | ||
} | ||
|
||
/* IO */ | ||
class RegStageIn(numregs: Int, width: Int) extends Bundle { | ||
val controlReg = Input(new RegStageControl(numregs, width)) | ||
val controlWb = Input(new WbStageControl) | ||
val din = Input(UInt(width.W)); | ||
} | ||
|
||
class RegStageOut(width: Int) extends Bundle { | ||
val rs1 = Output(UInt(width.W)) | ||
val rs2 = Output(UInt(width.W)) | ||
} | ||
|
||
class RegStageIO(numregs: Int, width: Int) extends Bundle { | ||
val in = Input(new RegStageIn(numregs, width)) | ||
val out = Output(new RegStageOut(width)) | ||
} | ||
|
||
class RegStage(numregs: Int, width: Int) extends Module { | ||
val io = IO(new RegStageIO(numregs, width)) | ||
|
||
val regfile = Module(new Regfile(numregs, width)) | ||
|
||
regfile.io.s1 := io.in.controlReg.s1 | ||
regfile.io.s2 := io.in.controlReg.s2 | ||
regfile.io.sd := io.in.controlReg.sd | ||
regfile.io.din := io.in.din | ||
regfile.io.wen := io.in.controlWb.wen | ||
|
||
io.out.rs1 := regfile.io.rs1 | ||
io.out.rs2 := regfile.io.rs2 | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../test/scala/riscv/stage/RegfileSpec.scala → ...t/scala/riscv/stage/reg/RegfileSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package riscv.stage.regfile | ||
package riscv.stage.reg.regfile | ||
|
||
import chisel3._ | ||
import chiseltest._ | ||
|