mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-11-01 18:04:12 +08:00
bank_occupancy.sh takes the main and branch build directories as optional arguments and prints a markdown table, so CI calls it instead of a second script. It gains the HOME, BANK4 and stack rows, and reads the web assets from the build directory, where html_min is now.
41 lines
1.1 KiB
Bash
Executable File
41 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
MACHINE="$1"
|
|
MAIN="${2:-output-main}"
|
|
BRANCH="${3:-output/$MACHINE}"
|
|
if [[ ! -s "$MAIN/rtlplayground.map" ]]; then
|
|
original_branch=$(git branch --show-current)
|
|
#trap 'git switch "$original_branch"' EXIT
|
|
git switch main && make CI=1 MACHINE="$MACHINE" BUILDDIR="$MAIN"
|
|
git switch "$original_branch"
|
|
fi
|
|
if [[ ! -s "$BRANCH/rtlplayground.map" ]]; then
|
|
make CI=1 MACHINE="$MACHINE" BUILDDIR="$BRANCH"
|
|
fi
|
|
|
|
seg() {
|
|
sed -rn "s/^$1[^=]*=\s+([0-9]+)\. bytes.*$/\1/p" "$2/rtlplayground.map" | head -n 1
|
|
}
|
|
|
|
stack() {
|
|
sed -rn 's/.* with ([0-9]+) bytes available.*/\1/p' "$1/rtlplayground.mem"
|
|
}
|
|
|
|
web() {
|
|
du -sb "$1/html_min" | awk '{print $1}'
|
|
}
|
|
|
|
print_line() {
|
|
local name=$1 main=$2 branch=$3
|
|
echo "| $name | $main | $branch | $((${branch:-0} - ${main:-0})) |"
|
|
}
|
|
|
|
echo "### $MACHINE"
|
|
echo
|
|
echo "| segment | main | branch | change |"
|
|
echo "| --- | ---: | ---: | ---: |"
|
|
for s in HOME CSEG BANK1 BANK2 BANK3 BANK4 DSEG XSEG; do
|
|
print_line "$s" "$(seg "$s" "$MAIN")" "$(seg "$s" "$BRANCH")"
|
|
done
|
|
print_line "stack available" "$(stack "$MAIN")" "$(stack "$BRANCH")"
|
|
print_line "WEB" "$(web "$MAIN")" "$(web "$BRANCH")"
|