Skip to content

Commit

Permalink
Merge pull request #1909 from ucb-bar/update-ckpt-script
Browse files Browse the repository at this point in the history
Update checkpointing script
  • Loading branch information
jerryz123 authored Jun 23, 2024
2 parents 2a9fe9b + 0fddd3c commit d5ced1e
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion scripts/generate-ckpt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ usage() {
echo " -i <insns> : Instructions after PC to take checkpoint at [default 0]"
echo " -m <isa> : ISA to pass to spike for checkpoint generation [default rv64gc]"
echo " -o <out> : Output directory to store the checkpoint in. [default <elf>.<pc>.<insns>.loadarch]"
echo " -r <mem> : Memory regions to pass to spike. Passed to spike's '-m' flag. [default starting at 0x80000000 with 256MiB]"
echo " -v : Verbose"
exit "$1"
}

Expand All @@ -22,6 +24,8 @@ PC="0x80000000"
INSNS=0
ISA="rv64gc"
OUTPATH=""
MEMOVERRIDE=""
VERBOSE=0
while [ "$1" != "" ];
do
case $1 in
Expand All @@ -45,14 +49,27 @@ do
-o )
shift
OUTPATH=$1 ;;
-r )
shift
MEMOVERRIDE=$1 ;;
-v )
VERBOSE=1 ;;
* )
error "Invalid option $1"
usage 1 ;;
esac
shift
done

BASEMEM="$((0x80000000)):$((0x10000000))"
if [[ $VERBOSE -eq 1 ]] ; then
set -x
fi

if [ -z "$MEMOVERRIDE" ] ; then
BASEMEM="$((0x80000000)):$((0x10000000))"
else
BASEMEM=$MEMOVERRIDE
fi
SPIKEFLAGS="-p$NHARTS --pmpregions=0 --isa=$ISA -m$BASEMEM"
BASENAME=$(basename -- $BINARY)

Expand Down Expand Up @@ -138,3 +155,5 @@ rm -rf mem.0x80000000.bin

riscv64-unknown-elf-ld -Tdata=0x80000000 -nmagic --defsym tohost=0x$TOHOST --defsym fromhost=0x$FROMHOST -o $LOADMEM_ELF $RAWMEM_ELF
rm -rf $RAWMEM_ELF

echo "Ensure that at minimum you have memory regions corresponding to $BASEMEM in downstream RTL tooling"

0 comments on commit d5ced1e

Please sign in to comment.