#!/bin/bash
# Path to the tools
tool=/dsk/l1/misc/cecile/bin/vis

#liste de fichier to analyse
liste_fichier="env+huff env+huff_vis"

# time limit
ulimit -t 300

# output file

result=resultat_huff_2012012
echo " " > $result
echo $liste_fichier
for fichier in $liste_fichier
do
		echo "Fichier trouve : $fichier"
		
		echo "*******************************" >> $result
		echo ${fichier}.mv >> $result
		echo "*******************************" >> $result
		echo read_blif_mv ${fichier}.mv > vis_rob_script1
		echo "init_verify" >> vis_rob_script1
		echo "dynamic_var_ordering -e sift" >> vis_rob_script1
		echo "read_fairness env.fair" >> vis_rob_script1
		#ROB4
            rob="ROB4"
			cat vis_rob_script1 > vis_rob_usut
			echo "echo ${rob} ${fichier}" >> vis_rob_usut
			echo "echo Class USUT ${rob} ${fichier}" >> vis_rob_usut
			echo "set_init -v 1 -m usut -g  protect_env.reg" >> vis_rob_usut
			echo "robustness -v 1" >> vis_rob_usut
			echo "quit -s" >> vis_rob_usut
			$tool < vis_rob_usut >> $result
		#	cat vis_rob_script1 > vis_rob_usmt
		#	echo "echo Class USMT ${rob} ${fichier}" >> vis_rob_usmt
		#	echo "set_init -v 1 -m usmt -g  protect_env.reg" >> vis_rob_usmt
		#	echo "robustness -v 1" >> vis_rob_usmt
		#	echo "quit -s" >> vis_rob_usmt
		#	$tool < vis_rob_usmt >> $result
		#	cat vis_rob_script1 > vis_rob_msut
		#	echo "echo Class MSUT ${rob} ${fichier}" >> vis_rob_msut
		#	echo "set_init -v 1  -m msut -g  protect_output.reg" >>	vis_rob_msut
		#	echo "robustness -v 1" >> vis_rob_msut
		#	echo "quit -s" >> vis_rob_msut
		#	$tool < vis_rob_msut >> $result
			cat vis_rob_script1 > vis_rob_msmt
			echo "echo Class MSMT ${rob} ${fichier}" >> vis_rob_msmt
			echo "set_init -v 1 -m msmt -g  protect_env.reg" >>	vis_rob_msmt
			echo "robustness -v 1" >> vis_rob_msmt
			echo "quit -s" >> vis_rob_msmt
			$tool < vis_rob_msmt >> $result
		
		#ROB3
            rob="ROB3"
			echo "read_blif_mv comp_${fichier}.mv" >> vis_rob_script1
			echo "init_verify" >> vis_rob_script1
		    echo "dynamic_var_ordering -e sift" >> vis_rob_script1
		    echo "read_fairness env.fair" >> vis_rob_script1
			cat vis_rob_script1 > vis_rob_usut
			echo "echo ${rob} ${fichier}" >> vis_rob_usut
			echo "echo Class USUT ${rob} ${fichier}" >> vis_rob_usut
			echo "set_init -v 1 -m usut -g  protect_golden.reg" >> vis_rob_usut
			echo "robustness -v 1" >> vis_rob_usut
			echo "quit -s" >> vis_rob_usut
			$tool < vis_rob_usut >> $result
		#	cat vis_rob_script1 > vis_rob_usmt
		#	echo "echo Class USMT ${rob} ${fichier}" >> vis_rob_usmt
		#	echo "set_init -v 1 -m usmt -g  protect_golden.reg" >> vis_rob_usmt
		#	echo "robustness -v 1" >> vis_rob_usmt
		#	echo "quit -s" >> vis_rob_usmt
		#	$tool < vis_rob_usmt >> $result
		#	cat vis_rob_script1 > vis_rob_msut
		#	echo "echo Class MSUT ${rob} ${fichier}" >> vis_rob_msut
		#	echo "set_init -v 1  -m msut -g  protect_golden.reg" >>	vis_rob_msut
		#	echo "robustness -v 1" >> vis_rob_msut
		#	echo "quit -s" >> vis_rob_msut
		#	$tool < vis_rob_msut >> $result
			cat vis_rob_script1 > vis_rob_msmt
			echo "echo Class MSMT ${rob} ${fichier}" >> vis_rob_msmt
			echo "set_init -v 1 -m msmt -g  protect_golden.reg" >>	vis_rob_msmt
			echo "robustness -v 1" >> vis_rob_msmt
			echo "quit -s" >> vis_rob_msmt
			$tool < vis_rob_msmt >> $result


			#ROB 1 
            rob="ROB1"
			echo "set_safe safe_rob1.ctl" >> vis_rob_script1
			cat vis_rob_script1 > vis_rob_usut
			echo "echo ${rob} ${fichier}" >> vis_rob_usut
			echo "echo Class USUT ${rob} ${fichier}" >> vis_rob_usut
			echo "set_init -v 1 -m usut -g  protect_golden.reg" >> vis_rob_usut
			echo "robustness -v 1 -r 1" >> vis_rob_usut
			echo "quit -s" >> vis_rob_usut
		    $tool < vis_rob_usut >> $result
			#cat vis_rob_script1 > vis_rob_usmt
			#echo "echo Class USMT ${rob} ${fichier}" >> vis_rob_usmt
			#echo "set_init -v 1 -m usmt -g  protect_golden.reg" >> vis_rob_usmt
			#echo "robustness -v 1 -r 1" >> vis_rob_usmt
			#echo "quit -s" >> vis_rob_usmt
			#$tool < vis_rob_usmt >> $result
			#cat vis_rob_script1 > vis_rob_msut
			#echo "echo Class MSUT ${rob} ${fichier}" >> vis_rob_msut
			#echo "set_init -v 1  -m msut -g  protect_golden.reg" >>	vis_rob_msut
			#echo "robustness -v 1 -r 1" >> vis_rob_msut
			#echo "quit -s" >> vis_rob_msut
			#$tool < vis_rob_msut >> $result
			cat vis_rob_script1 > vis_rob_msmt
			echo "echo Class MSMT ${rob} ${fichier}" >> vis_rob_msmt
			echo "set_init -v 1 -m msmt -g  protect_golden.reg" >>	vis_rob_msmt
			echo "robustness -v 1 -r 1" >> vis_rob_msmt
			echo "quit -s" >> vis_rob_msmt
			$tool < vis_rob_msmt >> $result


done

