#!/bin/bash
#ise script
#ngdbuild -ise "./edn.ise" -intstyle ise -dd _ngo -sd "../ngc/" -nt timestamp -i -p xc5vlx155t-ff1136-3 "mos8a_fpga_f2.edn" mos8a_fpga_f2.ngd -uc mos8a_fpga_f2.ucf
getdate="date +%Y/%m/%d"
gettime="date +%H:%M:%S"
PATH=/bin:/usr/bin
source /opt/Xilinx/10.1/ISE/settings32.sh
#additioncmd="-global_opt on -retiming on"
#additioncmd=" "
if [ $# -ge 2 ]
then
# echo "number of parameter more than 1"
echo $2 | grep -qv "[^0-9]" > /dev/null
if [ "$?" -eq "0" ]
then
# echo "parameter 2 is digital"
if [ "$2" -ge "0" -a "$2" -le "100" ]
then
# echo "costtab set to $2"
costtab=$2
# echo "costtab is $costtab"
else
echo "parameter 2 is bigger than 100 or less than 0"
echo "shell will use default value 14"
costtab=14
echo "costtab set to $costtab"
fi
else
echo "parameter 2 is no digital"
echo "shell will use default value 14"
costtab=14
echo "costtab set to $costtab"
fi
else
echo "number of parameter less than 1"
echo "shell will use default value 14"
costtab=14
echo "costtab set to $costtab"
fi
echo "costtab has set to $costtab now!"
func_pre()
{
if [ -d work ];
then
echo "Directory work already exist! not create it again!"
else
echo "Directory work no exist! create now"
mkdir work
fi
if [ -d output ];
then
echo "Directory output already exist! not create it again!"
else
echo "Directory output no exist! create now"
mkdir output
fi
if [ -e log.log ];
then
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "" >> log.log
echo "**********************************************************************" >> log.log
echo "**********************************************************************" >> log.log
echo "new round of logic!" > log.log
else
touch log.log
fi
}
func_check()
{
if [ -d work ] && [ -d output ] && [ -e log.log ];
then
echo "check ok! continue."
else
echo "check fail!"
fi
}
func_ngd()
{
# dir=`pwd`
# echo $dir
# #cd ${dir}/work
# cd work
# dir=`pwd`
# echo $dir
# cd ..
# dir=`pwd`
# echo $dir
cd work
echo "finished !...."
starttime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "ngdbuild start at ${starttime} " >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
ngdbuild -intstyle ise -dd _ngo -sd "../../ngc/" -nt timestamp -p xc5vlx155t-ff1136-3 "../mos8a_fpga_f2.edn" ../output/mos8a_fpga_f2.ngd -uc ../../ucf/mos8a_fpga_f2.ucf
cd ..
}
func_map()
{
cd work
echo "" >> ../log.log
echo "" >> ../log.log
ngdbuildtime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "map start at ${ngdbuildtime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
map -intstyle ise -p xc5vlx155t-ff1136-3 -ol high -xe n -t $costtab -w $additioncmd ../output/mos8a_fpga_f2.ngd -o ../output/mos8a_fpga_f2_map.ncd ../output/mos8a_fpga_f2.pcf
cd ..
}
func_par()
{
cd work
echo "" >> ../log.log
echo "" >> ../log.log
maptime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "par start at ${maptime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
par -intstyle ise -ol high -t $costtab -w ../output/mos8a_fpga_f2_map.ncd ../output/mos8a_fpga_f2.ncd ../output/mos8a_fpga_f2.pcf
cd ..
}
func_trce()
{
cd work
echo "" >> ../log.log
echo "" >> ../log.log
trcetime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "trce start at ${trcetime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
trce -intstyle ise -e 3000 -tsi ../output/mos8a_fpga_f2.tsi -xml ../output/mos8a_fpga_f2 ../output/mos8a_fpga_f2.ncd -o ../output/mos8a_fpga_f2.twr ../output/mos8a_fpga_f2.pcf
#trce -intstyle ise -v 5 -tsi ../output/mos8a_fpga_f2.tsi -xml ../output/mos8a_fpga_f2 ../output/mos8a_fpga_f2.ncd -o ../output/mos8a_fpga_f2.twr ../output/mos8a_fpga_f2.pcf
cd ..
}
func_bitgen()
{
cd work
echo "" >> ../log.log
echo "" >> ../log.log
bitgentime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "bitgen start at ${bitgentime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
bitgen -intstyle ise -f ../../.config/mos8a_fpga_f2.ut ../output/mos8a_fpga_f2.ncd
cd ..
}
func_bingen()
{
if [ -d bin ];
then
cd bin
else
mkdir bin
cd bin
fi
echo "" >> ../log.log
echo "" >> ../log.log
## echo 'setMode -pff
##addConfigDevice -size 512 -name "Untitled" -path "../bin"
##setSubmode -pffparallel
##setAttribute -configdevice -attr spiSelected -value "TRUE"
##setAttribute -configdevice -attr dir -value "UP"
##setAttribute -configdevice -attr flashDataWidth -value "8"
##setMode -pff
##setSubmode -pffparallel
##setAttribute -configdevice -attr dir -value "UP"
##addDesign -version 0 -name "0000"
##setMode -pff
##addDeviceChain -index 0
##setAttribute -design -attr name -value "0"
##addDevice -p 1 -file "../../../mos8a_f3_top.bit"
##addDevice -p 2 -file "../output/mos8a_fpga_f2.bit"
##addDevice -p 3 -file "../output/mos8a_fpga_f2.bit"
##setMode -pff
##setSubmode -pffparallel
##setAttribute -configdevice -attr fillValue -value "FF"
##setAttribute -configdevice -attr swapBit -value "true"
##setAttribute -configdevice -attr fileFormat -value "bin"
##setAttribute -configdevice -attr dir -value "UP"
##setAttribute -configdevice -attr path -value "../bin"
##setAttribute -configdevice -attr name -value "Untitled"
##generate -generic -spi
##quit' > ./impact.cmd
bingentime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "bingen start at ${bingentime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
impact -batch ../../.config/impact.cmd
cd ..
}
func_clean()
{
if [ -d work ];
then
rm -rf work
echo "Delete work sucessful!"
else
echo "Work does no exist! Nothing to do!"
fi
if [ -d output ];
then
rm -rf output
echo "Delete output sucessful!"
else
echo "Output does no exist! Nothing to do!"
fi
if [ -d bin ];
then
rm -rf bin
echo "Delete bin sucessful!"
else
echo "Bin does no exist! Nothing to do!"
fi
}
func_finish()
{
cd work
echo "" >> ../log.log
echo "" >> ../log.log
finishtime="`$getdate` `$gettime`"
echo "**********************************************************************" >> ../log.log
echo "process finish at ${finishtime}" >> ../log.log
echo "**********************************************************************" >> ../log.log
echo "" >> ../log.log
#touch report`date +%m%d%H%M`.txt
echo "process finish at ${finishtime} ready to work again!"
cd ..
}
case "$1" in
check)
func_check
;;
pre)
func_pre
;;
ngd)
func_ngd
;;
map)
func_map
;;
par)
func_par
;;
trce)
func_trce
;;
bitgen)
func_bitgen
;;
bingen)
func_bingen
;;
clean)
func_clean
;;
all)
func_pre
func_ngd
func_map
func_par
func_trce
func_bitgen
func_bingen
func_finish
;;
*)
echo "default! your input is: $1"
;;
esac
阅读(290) | 评论(0) | 转发(0) |