You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
651 B

#!/usr/bin/env bash
CODE_DIR=$(pwd)/code
BUILD_DIR=$(pwd)/build
COMMAND=$1
if [ "$1" == "build" ]; then
mkdir -p $BUILD_DIR
pushd $BUILD_DIR
yosys -q -p 'synth_ice40 -top top -blif top.blif' $CODE_DIR/top.v
arachne-pnr -q -d 8k -P cm81 -o top.asc -p $CODE_DIR/pins.pcf top.blif
icepack top.asc top.bin
icetime -d lp8k -mtr top.rpt top.asc
iverilog -g2005-sv -o testbench $CODE_DIR/cpu_tb.v $CODE_DIR/cpu.v
vvp testbench
popd
elif [ "$1" == "clean" ]; then
rm -r $BUILD_DIR
elif [ "$1" == "program" ]; then
tinyprog -p $BUILD_DIR/top.bin
elif [ "$1" == "sim" ]; then
gtkwave $BUILD_DIR/testbench.vcd
else
echo "Invalid arguments"
fi