#!/bin/tcsh
set SIMV = 'false'
set SIMV_ONLY = 'false'
set IESL = 'true'
#set options = "-uselic IESL"
set options = ""
# mode X8 or X16
set mode = "X8"
while ($#argv != 0)
    switch($argv[1])
    case "-simv_only":
      set SIMV_ONLY = "true"
    case "-simv":
      set SIMV = 'true';
    breaksw
    case "-noiesl":
      set options = ""
    breaksw
    case "-nospecify"
      set options = `echo $options "-nospecify"`
    breaksw
    case "-x16"
      set mode = 'X16'
    breaksw
    case "-h":
    case "--help":
    default:
      echo "Usage: run_sim [-noiesl] [-simv] [-simv_only] [-notiming][-x16]"
      echo "       -noiesl      : don't force use of the IESL license"
      echo "       -simv        : run simvision after sim"
      echo "       -simv_only   : run simvision only, no sim"
      echo "       -nospecify   : run simulation without specify block"
      echo "       -x16         : X16 mode (default is X8)"
      exit 1
    breaksw
  endsw
  shift
end
if($SIMV_ONLY == 'false') then
    #irun +access+rwc +define+$mode -64bit $options -licqueue ddr4_st_mram_tb.v st_mram_ddr4_model.sv
    irun +access+rwc +define+$mode -64bit $options -licqueue st_mram_ddr4_tb.sv st_mram_ddr4_model.sv
endif
if($SIMV == 'true' || $SIMV_ONLY == 'true') then
    simvision waves.shm -input simvision.svcf
endif
