
#!/bin/csh -f
# Arguments :
# First is entity
# Second is vhdl file
# third  is chip type
#
if ( $3 == "") then 
  echo "Purpose: to determine a possible pin fit without running Maxplus2" 
  echo "Usage: create_fit entity vhdlfile chiptype"
  echo "eg:    create_fit pll    pll.vhd  EPF10K50GC403"
  echo
  echo "creates a pin fit file that can be used with edit_acf script"
  echo "requires version of ACFread after V7.2"
  exit 1
endif
 
if ($VERTICAL_INIT == "") then
  setenv VERTICAL_INIT /user/mjames/alt_bb/setenv.scr 
endif


set acfread = "vertical.beta"

set entname  = $1
set vhdlname = $2
set chiptype = $3

if (! -e $vhdlname ) then
  echo "cant open $vhdlname"
  exit 1
endif



#########################
#strip out a VHDL entity
#########################

get_entity $entname < $vhdlname > $entname.tmp1.acfp

#####################################
#convert the entity to ACFplus format
#####################################

$acfread << END1 > acfread.log

debug 1
#force the ACFread system variables
setenv  vhdl_bus_format _%d_
setenv  TPATH /user/mjames/alt_bb/data/templates

read $entname.tmp1.acfp
set type $entname $chiptype

route

write acf  $entname.tmp2.acfp
quit
END1

#############################################################
#now apply the template to redefine all of the pins correctly
#############################################################

$acfread << END2 >> acfread.log
read $entname.tmp2.acfp
read \$(TPATH)/10k_templates
route
template
write fit $entname $entname.pins
quit
END2
