Skip to content

Commit

Permalink
[src] clean-up conversion script
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Aug 31, 2024
1 parent 6df65e7 commit 978d925
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/convert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,32 @@ set -e

cd $(dirname "$0")

NEORV32_RTL=${NEORV32_RTL:-../neorv32/rtl}
# NEORV32 home folder
NEORV32_HOME=${NEORV32_RTL:-../neorv32}
# Additional sources (i.e. the top unit)
SRC_FOLDER=${SRC_FOLDER:-.}
#Name of the top unit
TOP=neorv32_verilog_wrapper

mkdir -p build

# show NEORV32 version
echo "NEORV32 Version:"
grep -rni "$NEORV32_RTL"/core/neorv32_package.vhd -e 'hw_version_c'
grep -rni $NEORV32_HOME/rtl/core/neorv32_package.vhd -e 'hw_version_c'
echo ""
sleep 2

# Import sources
ghdl -i --std=08 --work=neorv32 --workdir=build -Pbuild "$NEORV32_RTL"/core/*.vhd "$SRC_FOLDER"/neorv32_verilog_wrapper.vhd

# Top entity
ghdl -m --std=08 --work=neorv32 --workdir=build neorv32_verilog_wrapper

# Synthesize: generate Verilog output
ghdl synth --std=08 --work=neorv32 --workdir=build -Pbuild --out=verilog neorv32_verilog_wrapper > "$SRC_FOLDER"/neorv32_verilog_wrapper.v
# Import and analyze sources
ghdl -i --std=08 --work=neorv32 --workdir=build -Pbuild $NEORV32_HOME/rtl/core/*.vhd $SRC_FOLDER/$TOP.vhd
ghdl -m --std=08 --work=neorv32 --workdir=build $TOP
# Synthesize Verilog
ghdl synth --std=08 --work=neorv32 --workdir=build -Pbuild --out=verilog $TOP > $SRC_FOLDER/$TOP.v

# Show interface of generated Verilog module
echo ""
echo "------ neorv32_verilog_wrapper interface ------"
sed -n "/module neorv32_verilog_wrapper/,/);/p" "$SRC_FOLDER"/neorv32_verilog_wrapper.v
echo "-----------------------------------------------"
echo "Verilog instantiation prototype"
echo "-----------------------------------------------"
sed -n "/module $TOP/,/);/p" $SRC_FOLDER/$TOP.v
echo "-----------------------------------------------"
echo ""

0 comments on commit 978d925

Please sign in to comment.