| 1 |
35 |
dgisselq |
#!/bin/bash
|
| 2 |
|
|
################################################################################
|
| 3 |
|
|
##
|
| 4 |
|
|
## Filename: vversion.sh
|
| 5 |
|
|
##
|
| 6 |
|
|
## Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
| 7 |
|
|
##
|
| 8 |
|
|
## Purpose: To determine whether or not the verilator prefix for internal
|
| 9 |
|
|
## variables is v__DOT__ or the name of the top level followed by
|
| 10 |
|
|
## __DOT__. If it is the later, output -DNEW_VERILATOR, else be silent.
|
| 11 |
|
|
##
|
| 12 |
|
|
##
|
| 13 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
| 14 |
|
|
## Gisselquist Technology, LLC
|
| 15 |
|
|
##
|
| 16 |
|
|
################################################################################
|
| 17 |
|
|
##
|
| 18 |
|
|
## Copyright (C) 2017, Gisselquist Technology, LLC
|
| 19 |
|
|
##
|
| 20 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
| 21 |
|
|
## modify it under the terms of the GNU General Public License as published
|
| 22 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
| 23 |
|
|
## your option) any later version.
|
| 24 |
|
|
##
|
| 25 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
| 26 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
| 27 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 28 |
|
|
## for more details.
|
| 29 |
|
|
##
|
| 30 |
|
|
## You should have received a copy of the GNU General Public License along
|
| 31 |
|
|
## with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
| 32 |
|
|
## target there if the PDF file isn't present.) If not, see
|
| 33 |
|
|
## <http://www.gnu.org/licenses/> for a copy.
|
| 34 |
|
|
##
|
| 35 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
| 36 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
| 37 |
|
|
##
|
| 38 |
|
|
##
|
| 39 |
|
|
################################################################################
|
| 40 |
|
|
##
|
| 41 |
|
|
##
|
| 42 |
|
|
if [[ -x ${VERILATOR_ROOT}/bin/verilator ]];
|
| 43 |
|
|
then
|
| 44 |
|
|
export VERILATOR=${VERILATOR_ROOT}/bin/verilator
|
| 45 |
|
|
fi
|
| 46 |
|
|
if [[ ! -x ${VERILATOR} ]];
|
| 47 |
|
|
then
|
| 48 |
|
|
export VERILATOR=verilator
|
| 49 |
|
|
fi
|
| 50 |
|
|
if [[ ! -x `which ${VERILATOR}` ]];
|
| 51 |
|
|
then
|
| 52 |
|
|
echo "Verilator not found in environment or in path"
|
| 53 |
|
|
exit -1
|
| 54 |
|
|
fi
|
| 55 |
|
|
|
| 56 |
|
|
VVERLINE=`${VERILATOR} -V | grep -i ^Verilator`
|
| 57 |
|
|
VVER=`echo ${VVERLINE} | cut -d " " -f 2`
|
| 58 |
|
|
LATER=`echo $VVER \>= 3.9 | bc`
|
| 59 |
|
|
if [[ $LATER > 0 ]];
|
| 60 |
|
|
then
|
| 61 |
|
|
echo "-DNEW_VERILATOR"
|
| 62 |
|
|
else
|
| 63 |
|
|
echo "-DOLD_VERILATOR"
|
| 64 |
|
|
fi
|
| 65 |
|
|
exit 0
|