diff --git a/prjxray/util.py b/prjxray/util.py index 1c5621be..87278062 100644 --- a/prjxray/util.py +++ b/prjxray/util.py @@ -163,3 +163,9 @@ def gen_tile_bits(db_root, tilej, strict=False, verbose=False): # 31_06 _bit_inv, (bit_addroff, bit_bitoff) = parse_tagbit(bitstr) yield (baseaddr + bit_addroff, bitbase + bit_bitoff, tag) + + +def specn(): + # ex: build/specimen_001 + specdir = os.getenv("SPECDIR") + return int(re.match(".*specimen_([0-9]*)", specdir).group(1), 10) diff --git a/utils/genheader.sh b/utils/genheader.sh index 39094a44..2bb93edd 100644 --- a/utils/genheader.sh +++ b/utils/genheader.sh @@ -10,14 +10,14 @@ set -ex # for some reason on sourced script set -e doesn't work # Scripts may have additional arguments, but first is reserved for build directory test $# -ge 1 || exit 1 -test ! -e "$SPECN" -SPECN=$1 +test ! -e "$SPECDIR" +export SPECDIR=$1 -rm -rf "$SPECN" -mkdir -p "$SPECN" -cd "$SPECN" +rm -rf "$SPECDIR" +mkdir -p "$SPECDIR" +cd "$SPECDIR" -export SEED="$(echo $SPECN | md5sum | cut -c1-8)" +export SEED="$(echo $SPECDIR | md5sum | cut -c1-8)" export SEEDN="$(basename $(pwd) |sed s/specimen_0*//)" function seed_vh () {