Skip to content

Commit

Permalink
Make instruction bus delay optional
Browse files Browse the repository at this point in the history
  • Loading branch information
martonbognar committed Dec 19, 2024
1 parent abb629d commit 46534bf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
20 changes: 14 additions & 6 deletions src/main/scala/riscv/Core.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,20 @@ object createStaticPipeline {
}

object SoC {
def static(ramType: RamType, extraDbusReadDelay: Int = 0): SoC = {
new SoC(ramType, config => createStaticPipeline()(config), extraDbusReadDelay)
def static(
ramType: RamType,
extraDbusReadDelay: Int = 0,
applyDelayToIBus: Boolean = false
): SoC = {
new SoC(ramType, config => createStaticPipeline()(config), extraDbusReadDelay, applyDelayToIBus)
}

def dynamic(ramType: RamType, extraMemBusDelay: Int = 0): SoC = {
new SoC(ramType, config => createDynamicPipeline()(config), extraMemBusDelay)
def dynamic(
ramType: RamType,
extraMemBusDelay: Int = 0,
applyDelayToIBus: Boolean = false
): SoC = {
new SoC(ramType, config => createDynamicPipeline()(config), extraMemBusDelay, applyDelayToIBus)
}
}

Expand Down Expand Up @@ -168,7 +176,7 @@ object CoreTestSim {

object CoreExtMem {
def main(args: Array[String]) {
SpinalVerilog(SoC.static(RamType.ExternalAxi4(10 MiB), 32))
SpinalVerilog(SoC.static(RamType.ExternalAxi4(10 MiB), 32, applyDelayToIBus = false))
}
}

Expand Down Expand Up @@ -313,7 +321,7 @@ object CoreDynamicSim {

object CoreDynamicExtMem {
def main(args: Array[String]) {
SpinalVerilog(SoC.dynamic(RamType.ExternalAxi4(10 MiB), 32))
SpinalVerilog(SoC.dynamic(RamType.ExternalAxi4(10 MiB), 32, applyDelayToIBus = false))
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/scala/riscv/soc/SoC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ object RamType {
class SoC(
ramType: RamType,
createPipeline: Config => Pipeline,
extraMemBusDelay: Int = 0
extraMemBusDelay: Int = 0,
applyDelayToIBus: Boolean = false
) extends Component {
setDefinitionName("Core")

Expand Down Expand Up @@ -113,6 +114,9 @@ class SoC(
dbus.readRsp << crossbar.readRsp.stage(extraMemBusDelay)
dbus.writeRsp << crossbar.writeRsp
})
}

if (extraMemBusDelay > 0 && applyDelayToIBus) {
axiCrossbar.addPipelining(ibusAxi)((ibus, crossbar) => {
import Utils._

Expand Down

0 comments on commit 46534bf

Please sign in to comment.