f( ! -e ila512_16.ngc ) then 
  echo Failed in ILA 512x16 Generation
  exit
endif

echo Generating VIO
coregen -p . -b vio_async_in256_sync_out72_cg.xco >> ise_flow_results.txt
if( ! -e vio_async_in256_sync_out72.ngc ) then 
  echo Failed in VIO Generation
  exit
endif
##END of ChipScope Cores - QDRIIPLUS SRAM

##Start of ChipScope Cores - RLDRAM II
coregen -b makeproj.sh
echo Generating ICON2
coregen -p . -b icon2_cg.xco >> ise_flow_results.txt
if( ! -e icon2.ngc ) then 
  echo Failed in ICON Generation
  exit
endif

echo Generating ILA 640x32
coregen -p . -b ila640_32_cg.xco >> ise_flow_results.txt
if( ! -e ila640_32.ngc ) then 
  echo Failed in ILA 640x32 Generation
  exit
endif

echo Generating VIO
coregen -p . -b vio_ain256_aout64_sout64_cg.xco >> ise_flow_results.txt
if( ! -e vio_ain256_aout64_sout64.ngc ) then 
  echo Failed in VIO Generation
  exit
endif
##END of ChipScope Cores - RLDRAM II

echo Running TRANSLATE
ngdbuild -nt timestamp -uc example_top.ucf -p %device-%package%speedgrade ../synth/rev_1/example_top.edf example_top.ngd >> ise_flow_results.txt
if( ! -e example_top.ngd ) then 
  echo Failed in TRANSLATE
  exit
endif

echo Running MAP
map -intstyle ise -p %device-%package%speedgrade -w -ol high -xe n -register_duplication off -ir off -pr off -lc off -power off -o example_top_map.ncd example_top.ngd example_top.pcf >> ise_flow_results.txt
if( ! -e example_top_map.ncd ) then 
  echo Failed in MAP
  exit
endif

echo Running PAR
par -w -intstyle ise -ol high -xe n example_top_map.ncd example_top.ncd example_top.pcf >> ise_flow_results.txt
if( ! -e example_top.ncd ) then 
  echo Failed in PAR
  exit
endif


echo Running TRACE 
trce -intstyle ise -v 3 -fastpaths -xml example_top example_top.ncd -o example_top.twr example_top.pcf >> ise_flow_results.txt
echo Running BITGEN
bitgen -intstyle ise example_top.ncd >> ise_flow_results.txt

if( ! -e example_top.bit ) then 
  echo Failed in BITGEN 
  exit
endif

echo IMPLEMENTATION SUCCESSFUL
