Skip to content

Commit

Permalink
ghdl: added a more concise alternative
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomelo9 committed Dec 11, 2021
1 parent 6c08653 commit c56d9b5
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions ghdl/vhdl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,36 @@

set -e

FLAGS="--std=08 -fsynopsys -fexplicit -frelaxed"
DIR=../resources/vhdl

ghdl -a $FLAGS --work=blink_lib ../resources/vhdl/blink.vhdl
ghdl -a $FLAGS --work=blink_lib ../resources/vhdl/blink_pkg.vhdl
ghdl -a $FLAGS ../resources/vhdl/top.vhdl
FLAGS="--std=08 -fsynopsys -fexplicit -frelaxed"

GENERICS="-gBOO=true -gINT=255 -gLOG='1' -gVEC="11111111" -gCHR='Z' -gSTR="WXYZ" -gSKIP_REA=1"
ghdl --synth $FLAGS $GENERICS Top ARCH_SEL

###############################################################################
# Alternative 1
###############################################################################

# This alternative is better to specify particular options per file

ghdl -a $FLAGS --work=blink_lib $DIR/blink.vhdl
ghdl -a $FLAGS --work=blink_lib $DIR/blink_pkg.vhdl
ghdl -a $FLAGS $DIR/top.vhdl

ghdl synth $FLAGS $GENERICS Top ARCH_SEL

# This alternative creates .cf files due the ghdl -a
rm -fr *.cf

###############################################################################
# Alternative 2
###############################################################################

# This alternative is more concise

# --work=<LIBNAME> applies to the following files
# The output in this case is a synthesized Verilog (VHDL is the default)

ghdl synth $FLAGS --out=verilog $GENERICS \
--work=blink_lib $DIR/blink.vhdl $DIR/blink_pkg.vhdl \
--work=work $DIR/top.vhdl -e Top ARCH_SEL

0 comments on commit c56d9b5

Please sign in to comment.