
#----------------------------Digicode-------------------------------------------#

digicode: digicode_syf	digicode_asimut \
          digicode_boog digicode_boog_asimut  digicode_proof\
	  digicode_scapin \
          digicode_boom digicode_boom_asimut \
          digicode_boom_boog \
          digicode_boom_loon digicode_boom_loon_asimut digicode_boom_loon_proof \
	  digicode_boom_loon_scapin
            

digicode_syf	: digicodea.vbe	\
			digicodej.vbe	\
			digicodem.vbe	\
			digicodeo.vbe	\
			digicoder.vbe	
	@echo "Encoding <-- Generated"  

digicode_asimut	: digicodea.pat \
			digicodej.pat	\
			digicodem.pat	\
			digicodeo.pat	\
			digicoder.pat	
	@echo "Behavioral Simulation <-- Simulated"
    
    # MAPPING
digicode_boog	: \
			digicoder.vst	
	@echo "Synthesis <-- Generated"

digicode_boog_asimut	:  \
				digicoder_net.pat 
	@echo "Netlist Simulation <-- Simulated"

digicode_proof          : digicodea_net.vbe \
				digicodej_net.vbe \
				digicodem_net.vbe \
				digicodeo_net.vbe \
				digicoder_net.vbe 
	@echo "Formal checking <-- Checked"

 #Scan-path
digicode_scapin	: \
			  digicoder_scan.vst
	@echo "Scan-path insertion <-- Inserted"
 

    # AVEC BOOM
digicode_boom : \
			  digicoder_b.vbe
	@echo "Boolean Optimization <-- ok"

digicode_boom_asimut	: \
			  digicoder_b.pat
	@echo "Behavioral optimized Simulation <-- Simulated"
    
    # Mapping
digicode_boom_boog	: \
			  digicoder_b.vst
	@echo "Behavioral optimized Synthesis <-- ok"

 #Optimisation
digicode_boom_loon	: \
			  digicoder_b_l.vst
	@echo "Netlist Optimisation <-- ok"
 
digicode_boom_loon_asimut	: \
			  digicoder_b_l_net.pat
	@echo "Optimized Netlist Simulation <-- Simulated"

digicode_boom_loon_proof          : \
			  digicoder_b_l_net.vbe 
	@echo "Formal proof on optimization <-- ok"
 
 #Scan-path
digicode_boom_loon_scapin	: \
			  digicoder_b_l_scan.vst
	@echo "Scan-path Insertion in optimized netlist <-- ok"
 





#-------------------Finite State Machine synthesis---------------#

digicodea.vbe: digicode.fsm
	@echo "    Encoding -a -> $@"
	syf -CEV -a digicode
	
digicodej.vbe: digicode.fsm
	@echo "    Encoding -j -> $@"
	syf -CEV -j digicode	

digicodem.vbe: digicode.fsm
	@echo "    Encoding -m -> $@"
	syf -CEV -m digicode

digicodeo.vbe: digicode.fsm
	@echo "    Encoding -o -> $@"
	syf -CEV -o digicode

digicoder.vbe: digicode.fsm
	@echo "    Encoding -r -> $@"
	syf -CEV -r digicode

#------------------Behavioral Simulation------------------------#

%.pat: %.vbe digicode.pat
	@echo "    Behavioral Simulation -> $@ "
	asimut -zerodelay -b $* digicode $*

#------------------Standard Cell Mapping-----------------------#

%.vst : %.vbe
	@echo "    Logical Synthesis -> $@  "
	MBK_OUT_LO=vst; export MBK_OUT_LO ; boog $* 


#------------------Standard Cell Mapping Simulation------------#

%_net.pat: %.vbe digicode.pat
	@echo "    Netlist Simulation -> $@ "
	asimut -zerodelay $* digicode $*_net

#------------------Netlist compare-----------------------------#

%_net.vbe : %.vst %.vbe
	@echo "    Formal checking -> $@ "
	flatbeh $* $*_net
	proof -d $* $*_net

#------------------Scan-path insertion-------------------------#

%_scan.vst : %.vst scan.path
	@echo "    scan-path insertion -> $@ "
	scapin -VRB $* scan $*_scan

#------------------Scan-path simulation------------------------#

%_scan.pat: %_scan.vbe digicode_scan.pat
	@echo "    Simulation comportementale -> $@ "
	asimut -zerodelay $*_scan digicode_scan $*_scan




#------------------Behavioral Optimization---------------------#

%_b.vbe: %.vbe  
	@echo "    Boolean Optimization -> $@  "
	boom -V $* $*_b 

#------------------Netlist Optimization------------------------#

%_l.vst : %.vst paramfile.lax
	@echo "    Netlist Optimization -> $@ "
	loon $* $*_l paramfile

#------------------Netlist compare-----------------------------#

%_b_l_net.vbe : %_b_l.vst %.vbe
	@echo "    Formal checking -> $@ "
	flatbeh $*_b_l $*_b_l_net
	proof -d $* $*_b_l_net




#-------------------Clean up-----------------------------------#

clean :
	@echo "Erase all the files generated by the makefile" 
	rm -f *.vbe *.enc *.vst *.xsc 
	rm -f digicode?_net.pat digicode?_b.pat 
	rm -f digicode?.pat digicode?_b_l_net.pat




