Add: script

This commit is contained in:
brice.boisson
2023-11-20 14:21:26 +09:00
parent ae0d20b5e7
commit 93cb91f022
3 changed files with 103 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ if [ $# -lt 1 ]; then
exit 1
fi
FILE_NAME=$1
TB_FILE_NAME=tb_$1
FILE_NAME=$(echo "$1" | sed 's/\([[:alnum:]_]*\)[-.].*/\1/')
echo 'puts "Simulation script for ModelSim"
' > ./sim/simu.do
@@ -15,14 +16,14 @@ if [ ! -f "rtl/""$FILE_NAME"".v" ]; then
echo "Error: $FILE_NAME.v file not found!"
exit 1
fi
if [ ! -f "tb/tb_""$FILE_NAME"".v" ]; then
echo "Error: tb_$FILE_NAME.v file not found!"
if [ ! -f "tb/""$TB_FILE_NAME"".v" ]; then
echo "Error: ""$TB_FILE_NAME"".v file not found!"
exit 1
fi
echo 'vlib work
vlog ../rtl/*.v
vlog ../tb/tb_'"$FILE_NAME"'.v
vlog ../tb/'"$TB_FILE_NAME"'.v
' >> ./sim/simu.do
echo 'vsim tb_'"$FILE_NAME"'

21
scripts/get_bin.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
if [ ! command -v riscv32-unknown-elf-as &> /dev/null ] \
|| [ ! command -v riscv32-unknown-elf-ld &> /dev/null ] \
|| [ ! command -v riscv32-unknown-elf-objcopy &> /dev/null ]
then
echo "riscv32-unknown-elf could not be found"
exit 1
fi
if [ $# -eq 0 ]
then
echo "Usage: $0 <file>"
exit 1
fi
NAME=$1
riscv32-unknown-elf-as -march=rv32i -mabi=ilp32 ${NAME}.S -o ${NAME}.o
riscv32-unknown-elf-ld -Ttext=0x1000 ${NAME}.o -o ${NAME}.elf
riscv32-unknown-elf-objcopy -O binary ${NAME}.elf ${NAME}.bin