quietly set ACTELLIBNAME SmartFusion2
quietly set PROJECT_DIR "E:/Solutions_Repo/Motor Control/Development/MCSK/SK2ABLSLST10_p/RTL/SK2ABLSLST10_5_1"

if {[file exists presynth/_info]} {
   echo "INFO: Simulation library presynth already exists"
} else {
   file delete -force presynth 
   vlib presynth
}
vmap presynth presynth
vmap SmartFusion2 "E:/Microsemi/Libero_v11.6/Designer/lib/modelsim/precompiled/vhdl/SmartFusion2"
if {[file exists ../component/Actel/DirectCore/CoreAHBLite/5.0.100/mti/user_vhdl/COREAHBLITE_LIB/_info]} {
   echo "INFO: Simulation library ../component/Actel/DirectCore/CoreAHBLite/5.0.100/mti/user_vhdl/COREAHBLITE_LIB already exists"
} else {
   file delete -force ../component/Actel/DirectCore/CoreAHBLite/5.0.100/mti/user_vhdl/COREAHBLITE_LIB 
   vlib ../component/Actel/DirectCore/CoreAHBLite/5.0.100/mti/user_vhdl/COREAHBLITE_LIB
}
vmap COREAHBLITE_LIB "../component/Actel/DirectCore/CoreAHBLite/5.0.100/mti/user_vhdl/COREAHBLITE_LIB"
if {[file exists COREAPB3_LIB/_info]} {
   echo "INFO: Simulation library COREAPB3_LIB already exists"
} else {
   file delete -force COREAPB3_LIB 
   vlib COREAPB3_LIB
}
vmap COREAPB3_LIB "COREAPB3_LIB"

vcom -93 -explicit  -work presynth "${PROJECT_DIR}/component/Microsemi/SolutionCore/SVM/3.0.2/Encrypted/svm.vhd"
vcom -93 -explicit  -work COREAPB3_LIB "${PROJECT_DIR}/component/Actel/DirectCore/CoreAPB3/4.1.100/rtl/vhdl/core/components.vhd"
vcom -93 -explicit  -work presynth "${PROJECT_DIR}/component/Microsemi/SolutionCore/SVM/3.0.2/Test/sim_pkg.vhd"
vcom -93 -explicit  -work presynth "${PROJECT_DIR}/component/Microsemi/SolutionCore/SVM/3.0.2/Test/svm_tb.vhd"

vsim -L SmartFusion2 -L presynth -L COREAHBLITE_LIB -L COREAPB3_LIB  -t 1fs presynth.svm_tb
add wave /svm_tb/*
run 1000ns
