Skip to content

Commit

Permalink
[tracegen] Add tracegen support for the BOOM L1D
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryz123 committed Dec 14, 2019
1 parent 72f9730 commit f6ebd08
Show file tree
Hide file tree
Showing 7 changed files with 287 additions and 8 deletions.
62 changes: 62 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,35 @@ jobs:
key: tracegen-{{ .Branch }}-{{ .Revision }}
paths:
- "/home/riscvuser/project"
prepare-tracegen-boom:
docker:
- image: riscvboom/riscvboom-images:0.0.12
environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb
steps:
- add_ssh_keys:
fingerprints:
- "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e"
- checkout
- run:
name: Create hash of toolchains
command: |
.circleci/create-hash.sh
- restore_cache:
keys:
- riscv-tools-installed-v2-{{ checksum "../riscv-tools.hash" }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run:
name: Building the tracegen-boom subproject using Verilator
command: .circleci/do-rtl-build.sh tracegen-boom
no_output_timeout: 120m
- save_cache:
key: tracegen-boom-{{ .Branch }}-{{ .Revision }}
paths:
- "/home/riscvuser/project"
prepare-firesim:
docker:
- image: riscvboom/riscvboom-images:0.0.12
Expand Down Expand Up @@ -540,6 +569,30 @@ jobs:
- run:
name: Run tracegen tests
command: .circleci/run-tests.sh tracegen
tracegen-boom-run-tests:
docker:
- image: riscvboom/riscvboom-images:0.0.12
environment:
JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit
TERM: dumb
steps:
- checkout
- run:
name: Create hash of toolchains
command: |
.circleci/create-hash.sh
- restore_cache:
keys:
- riscv-tools-installed-v2-{{ checksum "../riscv-tools.hash" }}
- restore_cache:
keys:
- tracegen-boom-{{ .Branch }}-{{ .Revision }}
- restore_cache:
keys:
- verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }}
- run:
name: Run tracegen-boom tests
command: .circleci/run-tests.sh tracegen-boom
firesim-run-tests:
docker:
- image: riscvboom/riscvboom-images:0.0.12
Expand Down Expand Up @@ -665,6 +718,11 @@ workflows:
- install-riscv-toolchain
- install-verilator

- prepare-tracegen-boom:
requires:
- install-riscv-toolchain
- install-verilator

- prepare-firesim:
requires:
- install-riscv-toolchain
Expand Down Expand Up @@ -708,6 +766,10 @@ workflows:
requires:
- prepare-tracegen

- tracegen-boom-run-tests:
requires:
- prepare-tracegen-boom

# Run the firesim tests
- firesim-run-tests:
requires:
Expand Down
1 change: 1 addition & 0 deletions .circleci/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ mapping["rocketchip"]="SUB_PROJECT=rocketchip"
mapping["blockdevrocketchip"]="SUB_PROJECT=example CONFIG=SimBlockDeviceRocketConfig TOP=TopWithBlockDevice"
mapping["hwacha"]="SUB_PROJECT=example CONFIG=HwachaRocketConfig"
mapping["tracegen"]="SUB_PROJECT=tracegen CONFIG=NonBlockingTraceGenL2Config"
mapping["tracegen-boom"]="SUB_PROJECT=tracegen CONFIG=BoomTraceGenConfig"
mapping["firesim"]="DESIGN=FireSim TARGET_CONFIG=DDR3FRFCFSLLC4MB_FireSimRocketChipConfig PLATFORM_CONFIG=BaseF1Config"
mapping["fireboom"]="DESIGN=FireSim TARGET_CONFIG=DDR3FRFCFSLLC4MB_FireSimBoomConfig PLATFORM_CONFIG=BaseF1Config"
3 changes: 3 additions & 0 deletions .circleci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ case $1 in
tracegen)
run_tracegen ${mapping[$1]}
;;
tracegen-boom)
run_tracegen ${mapping[$1]}
;;
*)
echo "No set of tests for $1. Did you spell it right?"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ lazy val example = conditionalDependsOn(project in file("generators/example"))
.settings(commonSettings)

lazy val tracegen = conditionalDependsOn(project in file("generators/tracegen"))
.dependsOn(rocketchip, sifive_cache)
.dependsOn(rocketchip, sifive_cache, boom)
.settings(commonSettings)

lazy val utilities = conditionalDependsOn(project in file("generators/utilities"))
Expand Down
29 changes: 27 additions & 2 deletions generators/tracegen/src/main/scala/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import freechips.rocketchip.rocket.DCacheParams
import freechips.rocketchip.tile.{MaxHartIdBits, XLen}
import scala.math.{max, min}

class WithTraceGen(params: Seq[DCacheParams], nReqs: Int = 8192)
class WithTraceGen(params: Seq[DCacheParams], boom_params: Seq[DCacheParams] = Nil, nReqs: Int = 8192)
extends Config((site, here, up) => {
case TraceGenKey => params.map { dcp => TraceGenParams(
dcache = Some(dcp),
Expand All @@ -32,7 +32,28 @@ class WithTraceGen(params: Seq[DCacheParams], nReqs: Int = 8192)
memStart = site(ExtMem).get.master.base,
numGens = params.size)
}
case MaxHartIdBits => if (params.size == 1) 1 else log2Ceil(params.size)
case BoomTraceGenKey => boom_params.map { dcp => TraceGenParams(
dcache = Some(dcp),
wordBits = site(XLen),
addrBits = 48,
addrBag = {
val nSets = dcp.nSets
val nWays = dcp.nWays
val blockOffset = site(SystemBusKey).blockOffset
val nBeats = min(2, site(SystemBusKey).blockBeats)
val beatBytes = site(SystemBusKey).beatBytes
List.tabulate(2 * nWays) { i =>
Seq.tabulate(nBeats) { j =>
BigInt((j * beatBytes) + ((i * nSets) << blockOffset))
}
}.flatten
},
maxRequests = nReqs,
memStart = site(ExtMem).get.master.base,
numGens = params.size)
}
case MaxHartIdBits => if (params.size + boom_params.size == 1) 1
else log2Ceil(params.size + boom_params.size)
})

class TraceGenConfig extends Config(
Expand All @@ -43,6 +64,10 @@ class NonBlockingTraceGenConfig extends Config(
new WithTraceGen(List.fill(2) { DCacheParams(nMSHRs = 2, nSets = 16, nWays = 2) }) ++
new BaseConfig)

class BoomTraceGenConfig extends Config(
new WithTraceGen(Nil, List.fill(2) { DCacheParams(nMSHRs = 8, nSets = 16, nWays = 2) }) ++
new BaseConfig)

class WithL2TraceGen(params: Seq[DCacheParams], nReqs: Int = 8192)
extends Config((site, here, up) => {
case TraceGenKey => params.map { dcp => TraceGenParams(
Expand Down
15 changes: 12 additions & 3 deletions generators/tracegen/src/main/scala/System.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp, BufferParams}
import freechips.rocketchip.groundtest.{DebugCombiner, TraceGenParams}
import freechips.rocketchip.subsystem._

case object TraceGenKey extends Field[Seq[TraceGenParams]]
case object BoomTraceGenKey extends Field[Seq[TraceGenParams]](Nil)
case object TraceGenKey extends Field[Seq[TraceGenParams]](Nil)

trait HasTraceGenTiles { this: BaseSubsystem =>
val tiles = p(TraceGenKey).zipWithIndex.map { case (params, i) =>
val rocket_tiles = p(TraceGenKey).zipWithIndex.map { case (params, i) =>
LazyModule(new TraceGenTile(i, params, p))
}
val boom_tiles = p(BoomTraceGenKey).zipWithIndex.map { case (params, i) =>
LazyModule(new BoomTraceGenTile(i, params, p))
}

val tiles = rocket_tiles ++ boom_tiles

tiles.foreach { t =>
sbus.fromTile(None, buffer = BufferParams.default) { t.masterNode }
Expand All @@ -26,7 +32,10 @@ trait HasTraceGenTilesModuleImp extends LazyModuleImp {
t.module.constants.hartid := i.U
}

val status = DebugCombiner(outer.tiles.map(_.module.status))
val status = DebugCombiner(
outer.rocket_tiles.map(_.module.status) ++
outer.boom_tiles.map(_.module.status)
)
success := status.finished
}

Expand Down
Loading

0 comments on commit f6ebd08

Please sign in to comment.