Skip to content

WIP: Add an example of how to checkpoint #2088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions checkpointing-example.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -ex

# assuming you have env.sh sourced

CY_DIR=$(git rev-parse --show-toplevel)

# need nodisk version
marshal -v -d build $CY_DIR/software/firemarshal/example-workloads/linux-hello.yaml
FM_WORKLOAD_OUTPUT=$CY_DIR/software/firemarshal/images/firechip/linux-hello/linux-hello-bin-nodisk

## optional: verify it boots with spike (spike will use it's own uart for output)
#spike --pc=0x80000000 $FM_WORKLOAD_OUTPUT

# create dts to checkpoint with in spike
pushd sims/vcs
make CONFIG=dmiCheckpointingRocketConfig verilog
CHECKPOINT_DTS=$CY_DIR/sims/vcs/generated-src/chipyard.harness.TestHarness.dmiCheckpointingRocketConfig/chipyard.harness.TestHarness.dmiCheckpointingRocketConfig.dts
popd

# 0x8013 is the instruction "trigger" given in the workload
./scripts/generate-ckpt.sh -v -b $FM_WORKLOAD_OUTPUT -t 0x8013 -s $CHECKPOINT_DTS
LOADARCH_PATH=$CY_DIR/linux-hello-bin-nodisk.0x80000000.0x8013.0.customdts.loadarch

# make sure you can boot into it in target SW RTL simulation
pushd sims/vcs
make CONFIG=dmiCheckpointingRocketConfig run-binary LOADARCH=$LOADARCH_PATH
popd

echo "Successful checkpoint!"
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ class dmiRocketConfig extends Config(
new chipyard.config.AbstractConfig)
// DOC include end: DmiRocket

class dmiCheckpointingRocketConfig extends Config(
new freechips.rocketchip.rocket.WithCease(false) ++ // disable xrocket extension to match w/ spike
new chipyard.config.WithNoUART ++ // only use htif prints w/ checkpointing
new chipyard.config.WithNPMPs(0) ++ // remove PMPs (reduce non-core arch state)
new chipyard.harness.WithSerialTLTiedOff ++ // don't attach anything to serial-tl
new chipyard.config.WithDMIDTM ++ // have debug module expose a clocked DMI port
new freechips.rocketchip.rocket.WithNHugeCores(1) ++
new chipyard.config.AbstractConfig)

class dmiCospikeCheckpointingRocketConfig extends Config(
new chipyard.harness.WithSerialTLTiedOff ++ // don't attach anything to serial-tl
new chipyard.config.WithDMIDTM ++ // have debug module expose a clocked DMI port
Expand Down
7 changes: 7 additions & 0 deletions generators/firechip/chip/src/main/scala/TargetConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ class FireSimDmiRocketConfig extends Config(
new WithFireSimConfigTweaks ++
new chipyard.dmiRocketConfig)

class FireSimDmiCheckpointingRocketConfig extends Config(
new chipyard.config.WithNoUART ++ // (must be at top) only use htif prints w/ checkpointing
new chipyard.harness.WithSerialTLTiedOff ++ // (must be at top) tieoff any bridges that connect to serialTL so only DMI port is connected
new WithDefaultFireSimBridges ++
new WithFireSimConfigTweaks ++
new chipyard.dmiCheckpointingRocketConfig)

//*****************************************************************
// Boom config, base off chipyard's LargeBoomV3Config
//*****************************************************************
Expand Down
1 change: 1 addition & 0 deletions scripts/generate-ckpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ echo "spike -d --debug-cmd=$CMDS_FILE $SPIKEFLAGS $BINARY" > $SPIKECMD_FILE
echo "Capturing state at checkpoint to spikeout"
echo $NHARTS > $LOADARCH_FILE
spike -d --debug-cmd=$CMDS_FILE $SPIKEFLAGS $BINARY 2>> $LOADARCH_FILE
sed -i '/stdout/d' $LOADARCH_FILE


echo "Finding tohost/fromhost in elf file to inject in new elf"
Expand Down