#!/bin/csh -f

alias BEGIN 'cat <<END'

set vbase = "/im/cam8/vsim/"
set vsource = release
foreach arg ($*)
  if ($arg =~ td) then
    set vsource = td
  else if ($arg =~ df) then
    set vsource = df
  endif
end


BEGIN

-v $vbase$vsource/sys_hdr.v
-v $vbase$vsource/sys_halt.v
-v $vbase$vsource/sbreva.v
-v $vbase$vsource/sbrevad.v
-v $vbase$vsource/iboard.v

-v $vbase$vsource/ctlsvtop.v
-v $vbase$vsource/ctlsvchip.edf.v

-v $vbase$vsource/fsmtop.v
-v $vbase$vsource/fsmchip.edf.v

-v $vbase$vsource/datatop.v
-v $vbase$vsource/dataregs.edf.v

-v $vbase$vsource/ifc.v
-v $vbase$vsource/prom.v
-v $vbase$vsource/test.v
-v $vbase$vsource/sbutil.v
-v $vbase$vsource/slaveout.v
-v $vbase$vsource/sbmemout.v
-v $vbase$vsource/pull_slow.v
END

foreach arg ($*)
  if ($arg =~ "+idebug") then

BEGIN

-v $vbase$vsource/ifcout.v
-v ./camout.v
END

  break
  endif
end


BEGIN

-v ./cammod.v
END


foreach arg ($*)
  if ( ($arg =~ "sram") || ($1 > 3) ) then
BEGIN

-v $vbase$vsource/sram.v
END

  break
  endif
end


foreach arg ($*)
  if ( ($arg =~ "+vectors") && ($1 > 3) ) then
BEGIN

-v $vbase$vsource/cvout4.v
END

  break
  else if ( ($arg =~ "+vectors") && ($1 < 4) ) then
BEGIN

-v $vbase$vsource/cvout1.v
END

  break
  endif
end

# check whether to include behavioral models in
#   cam chip
@ b = 0
foreach arg ($*)
  if ($arg =~ [Bb]) then
    @ b = 1
  endif
end


if ($b == 1) then
  BEGIN
-v $vbase$vsource/chip1.edf.v.b
END

else

  BEGIN
-v $vbase$vsource/chip1.edf.v
END
endif


BEGIN

-v /im/verilog/lai_mods.v
-y /im/verilog/vlsi/vlsi_1.0u/verilog/vgt300 +libext+.vmd+
-v /im/verilog/vlsi/vlsi_1.0u/udp/vlsi_udps.vmd

END

