StanfordAHA / garnet

Next generation CGRA generator
BSD 3-Clause "New" or "Revised" License
105 stars 11 forks source link

mflowgen: Scripts fail silently (ish) if GARNET_HOME not set #412

Open steveri opened 4 years ago

steveri commented 4 years ago

My latest attempt at building a default Tile_PE failed for the following reason: It looks as though there is a requirement to have an env var GARNET_HOME in order for the mflowgen scripts to work.

%cd garnet/mflowgen; grep -r GARNET_HOME *
  common/rtl/gen_rtl.sh:cd $GARNET_HOME
  glb_tile/rtl/gen_rtl.sh:    cat $GARNET_HOME/global_buffer/rtl/$F >> outputs/design.v
  glb_tile/rtl/gen_rtl.sh:done <$GARNET_HOME/global_buffer/rtl/global_buffer.filelist
  glb_top/glb_tile/get_glb_outputs.sh:../../configure --design $GARNET_HOME/mflowgen/glb_tile/
  glb_top/rtl/gen_rtl.sh:cat $GARNET_HOME/global_buffer/rtl/global_buffer_pkg.sv >> outputs/design.v
  glb_top/rtl/gen_rtl.sh:cat $GARNET_HOME/global_buffer/rtl/global_buffer.sv >> outputs/design.v
  Tile_MemCore/rtl/gen_rtl.sh:cd $GARNET_HOME

Seems like this should be documented in the README (which I can do) and there should be an env-var check somewhere in the scripts (which somebody else should probably do) e.g.

if test [ "$GARNET_HOME" == "" ]; then
  echo ERROR oops looks like you forgot to set env var GARNET_HOME
  exit 13
fi

...or am I missing something?

steveri commented 4 years ago

Also: looks like gen_rtl scripts assume that python points to python3 although there are apparently no specification or checks to make sure;

% make rtl
  File "garnet.py", line 28
    def __init__(self, width, height, add_pd, interconnect_only: bool = False,
                                                               ^
  SyntaxError: invalid syntax

Scripts should probably use python3 instead of simply python and/or do a check ` v=python -c 'import sys; print(sys.version_info[0]*1000+sys.version_info[1])'` if [ $v -lt 3000 ] ; then echo ""; echo "ERROR found python version $v -- should be at least 3000"; exit 13 fi