1
0
mirror of https://github.com/Klagarge/Cursor.git synced 2025-06-25 20:02:31 +00:00

Initial commit

This commit is contained in:
Rémi Heredero
2021-11-24 10:50:51 +01:00
commit c7ba678fbb
961 changed files with 501515 additions and 0 deletions

38
Scripts/cleanGenerated.bash Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
#================================================================================
# cleanGenerated.bash - Clean intermediate files form folder
#
base_directory="$(dirname "$(readlink -f "$0")")"
pushd $base_directory
base_directory="$base_directory/.."
SEPARATOR='--------------------------------------------------------------------------------'
INDENT=' '
echo "$SEPARATOR"
echo "-- ${0##*/} Started!"
echo ""
#-------------------------------------------------------------------------------
# Remove generated and cache files
#
find $base_directory -type f -name '.cache.dat' | xargs -r rm -v
find $base_directory -type f -name '*.bak' | xargs -r rm -v
find $base_directory -type f -name '*.lck' | xargs -r rm -v
find $base_directory -type f -name '*.vhd.info' | xargs -r rm -v
find $base_directory -type f -name 'default_view' | xargs -r rm -v
find $base_directory -type f -name '*_entity.vhd' | xargs -r rm -v
find $base_directory -type f -name '*_struct.vhd' | xargs -r rm -v
find $base_directory -type f -name '*_fsm.vhd' | xargs -r rm -v
find $base_directory -type f -name '*.vhg' | xargs -r rm -v
find $base_directory -type f -name '*.DS_Store' | xargs -r rm -v
find $base_directory -type d -name '.xrf' | xargs -r rm -Rv
#-------------------------------------------------------------------------------
# Exit
#
echo ""
echo "-- ${0##*/} Finished!"
echo "$SEPARATOR"
popd

View File

@ -0,0 +1,42 @@
::==============================================================================
:: cleanGenerated.bat
:: Clean intermediate files from folder
::
:start
@echo off
setlocal
set cmd_location="%~dp0"
pushd %cmd_location%
set SEPARATOR="--------------------------------------------------------------------------------"
set INDENT=" "
echo %SEPARATOR%
echo "-- %~nx0 Started!"
echo.
::------------------------------------------------------------------------------
:: Delete intermediate files
::
set base_directory="%cmd_location:"=%.."
echo "Delete intermediate files in: %base_directory%"
del /f /s /a %base_directory%\*cache.dat
del /f /s /a %base_directory%\*.bak
del /f /s /a %base_directory%\*.lck
del /f /s /a %base_directory%\*.vhd.info
del /f /s /a %base_directory%\default_view
del /f /s /a %base_directory%\*_entity.vhd
del /f /s /a %base_directory%\*_struct.vhd
del /f /s /a %base_directory%\*_fsm.vhd
del /f /s /a %base_directory%\*.vhg
del /f /s /a %base_directory%\*.DS_Store
echo "Delete intermediate directories in: %base_directory%"
for /d /r "%base_directory:"=%\" %%a in (.xrf\) do if exist "%%a" rmdir /s /q "%%a"
:end
echo.
echo "-- %~nx0 Finished!"
echo %SEPARATOR%
popd
endlocal
goto:eof

38
Scripts/cleanScratch.bat Normal file
View File

@ -0,0 +1,38 @@
::==============================================================================
:: cleanScratch.bat
:: Clean scratch directory
::
:start
@echo off
setlocal
set cmd_location="%~dp0"
pushd %cmd_location%
set SEPARATOR="--------------------------------------------------------------------------------"
set INDENT=" "
echo %SEPARATOR%
echo "-- %~nx0 Started!"
echo.
::------------------------------------------------------------------------------
:: Delete scratch directory
::
if "%SCRATCH_DIR%" == "" (
set SCRATCH_DIR=C:\temp\eda\
)
echo Delete scratch directory %SCRATCH_DIR%
if exist %SCRATCH_DIR% (
echo Scratch directory found, deleting!
rmdir /S /Q "%SCRATCH_DIR%"
) else (
echo Scratch directory not found!
)
:end
echo.
echo "-- %~nx0 Finished!"
echo %SEPARATOR%
popd
endlocal
goto:eof

154
Scripts/hdlDesigner.bash Executable file
View File

@ -0,0 +1,154 @@
#!/bin/bash
#================================================================================
# hdl_designer.bash - Starts HDL designer
#
base_directory="$(dirname "$(readlink -f "$0")")"
base_directory="$base_directory/.."
pushd $base_directory
SEPARATOR='--------------------------------------------------------------------------------'
INDENT=' '
echo "$SEPARATOR"
echo "-- ${0##*/} Started!"
echo ""
#--------------------------------------------------------------------------------
# Parse command line options
#
command_switches='n:d:p:m:i:u:t:s:c:y:vh'
usage='Usage: hdl_designer.bash [-v] [-h]'
usage="$usage\n\t[-d designDirectory] [-u userPrefsDirectory]"
# set name and base directory
design_name=`basename $0 .bash`
design_directory=`dirname ${BASH_SOURCE[0]}`
while getopts $command_switches options; do
case $options in
n ) design_name=$OPTARG;;
d ) design_directory=$OPTARG;;
esac
done
# continue with preferences directory
prefs_directory="$design_directory/Prefs"
OPTIND=1
while getopts $command_switches options; do
case $options in
n ) design_name=$OPTARG;;
d ) design_directory=$OPTARG;;
p ) prefs_directory=$OPTARG;;
esac
done
# finish with other parameters
library_matchings="$design_name.hdp"
library_matchings='hds.hdp'
simulation_directory="$design_directory/Simulation"
user_prefs_directory="$prefs_directory/hds_user-linux"
team_prefs_directory="$prefs_directory/hds_team"
scratch_directory='/tmp/eda/'
synthesis_subdirectory="Board/ise"
concat_directory="$design_directory/Board/concat"
OPTIND=1
while getopts $command_switches options; do
case $options in
n ) ;;
d ) ;;
m ) library_matchings=$OPTARG;;
i ) simulation_directory=$OPTARG;;
u ) user_prefs_directory=$OPTARG;;
t ) team_prefs_directory=$OPTARG;;
s ) scratch_directory=$OPTARG;;
c ) concat_directory=$OPTARG;;
y ) synthesis_subdirectory=$OPTARG;;
v ) verbose=1;;
h ) echo -e $usage
exit 1;;
* ) echo -e $usage
exit 1;;
esac
done
design_directory=`realpath $design_directory`
library_matchings=`realpath $prefs_directory/$library_matchings`
simulation_directory=`realpath $simulation_directory`
user_prefs_directory=`realpath $user_prefs_directory`
team_prefs_directory=`realpath $team_prefs_directory`
concat_directory=`realpath $concat_directory`
mkdir -p $scratch_directory
scratch_directory=`realpath $scratch_directory`
#================================================================================
# Main script
#
#-------------------------------------------------------------------------------
# System environment variables
#
export HDS_HOME=/usr/opt/HDS
export MODELSIM_HOME=/usr/opt/Modelsim/modeltech/bin/
export SYNTHESIS_HOME=/usr/opt/Xilinx/ISE_DS/ISE
export LC_ALL=C
export LD_LIBRARY_PATH=/usr/openwin/lib:/usr/lib:/usr/dt/lib:/usr/opt/HDS/ezwave/lib:/usr/opt/HDS/bin
export MGLS_HOME=/usr/opt/HDS/license/mgls
#-------------------------------------------------------------------------------
# Project environment variables
#
export DESIGN_NAME=$design_name
export HDS_LIBS=$library_matchings
export HDS_USER_HOME="$user_prefs_directory"
export HDS_TEAM_HOME=$team_prefs_directory
export SIMULATION_DIR=$simulation_directory
export SCRATCH_DIR=$scratch_directory
export CONCAT_DIR=$concat_directory
export SYNTHESIS_BASE_DIR=`realpath $design_directory/$synthesis_subdirectory`
export SYNTHESIS_WORK_DIR=$scratch_directory/$synthesis_subdirectory
#-------------------------------------------------------------------------------
# Display info
#
if [ -n "$verbose" ] ; then
echo "Environment variables:"
echo "${INDENT}Design name is $DESIGN_NAME"
echo "${INDENT}Lib matchings file is $HDS_LIBS"
echo "${INDENT}Simulation directory is $SIMULATION_DIR"
echo "${INDENT}User prefs directory is $HDS_USER_HOME"
echo "${INDENT}Team prefs directory is $HDS_TEAM_HOME"
echo "${INDENT}Scratch directory is $SCRATCH_DIR"
echo "${INDENT}Concat directory is $CONCAT_DIR"
echo "${INDENT}HDS location is $HDS_HOME"
echo "${INDENT}Modelsim location is $MODELSIM_HOME"
echo "${INDENT}Synthesis app location is $SYNTHESIS_HOME"
echo "${INDENT}Synthesis base directory is $SYNTHESIS_BASE_DIR"
echo "${INDENT}Synthesis work directory is $SYNTHESIS_WORK_DIR"
fi
#-------------------------------------------------------------------------------
# Copy synthesis data to scratch
#
if true; then
echo "Copying"
echo "${INDENT}$SYNTHESIS_BASE_DIR"
echo "${INDENT}-> $SYNTHESIS_WORK_DIR"
fi
if [ -e "$SYNTHESIS_BASE_DIR" ]; then
rm -Rf $SYNTHESIS_WORK_DIR
mkdir -p $SYNTHESIS_WORK_DIR
cp -pr $SYNTHESIS_BASE_DIR/* $SYNTHESIS_WORK_DIR/
fi
#-------------------------------------------------------------------------------
# Launch application
#
hdl_designer &
#-------------------------------------------------------------------------------
# Exit
#
echo ""
echo "-- ${0##*/} Finished!"
echo "$SEPARATOR"
popd

246
Scripts/hdlDesigner.bat Normal file
View File

@ -0,0 +1,246 @@
::==============================================================================
:: hdl_designer.bash - Starts HDL designer
::
:start
setlocal EnableExtensions EnableDelayedExpansion
set cmd_location=%~dp0
pushd %cmd_location%
set SEPARATOR="--------------------------------------------------------------------------------"
set INDENT=" "
echo %SEPARATOR%
echo "-- %~nx0 Started!"
echo.
:: -----------------------------------------------------------------------------
:: Define default environment variables
::
::remove trailing backslash
if %cmd_location:~-1%==\ set design_directory=%design_directory:~0,-1%
set design_name=%~n0
set hpd_name=hds
if "%ISE_VERSION%"== "" (
set ISE_VERSION=14.7
)
set prefs_directory="%design_directory:"=%\Prefs"
set library_matchings="%hpd_name%.hdp"
set simulation_directory="%design_directory:"=%\Simulation"
set user_prefs_directory="%prefs_directory:"=%\hds_user"
set team_prefs_directory="%prefs_directory:"=%\hds_team"
if "%SCRATCH_DIR%" == "" (
set scratch_directory=C:\temp\eda\%username%
) else (
set scratch_directory=%SCRATCH_DIR%
)
set synthesis_subdirectory=""
if %REQUIRE_ISE% == 1 (
set synthesis_subdirectory="Board\ise"
)
if %REQUIRE_LIBERO% == 1 (
set synthesis_subdirectory="Board\libero"
)
set concat_directory="%design_directory:"=%\Board\concat"
::------------------------------------------------------------------------------
:: Parse command line options
::
:parse
set usage1="Usage: hdl_designer.bat [-v] [-h]"
set usage2=" [-n designName] [-d designDirectory]"
set usage3=" [-p prefsDirectory] [-u userPrefsDirectory] [-t teamPrefsDirectory]"
set usage4=" [-s scratchDirectory] [-c concatDirectory]"
set usage5=" [-y synthesisDirectory] [-m library_matchings]"
echo "Search Commandline Parameters"
:parseloop
if not "%1"=="" (
if "%1"=="-v" (
set VERBOSE=1
echo "%INDENT:"=%verbose enabled"
shift
)
if "%1"=="-h" (
goto :HELP
shift
)
if "%1"=="-n" (
set design_name=%2
echo "%INDENT:"=%design_name=!design_name:"=! "
shift & shift
)
if "%1"=="-d" (
set design_directory=%2
echo "%INDENT:"=%design_directory=!design_directory:"=! "
shift & shift
)
if "%1"=="-p" (
set prefs_directory=%2
echo "%INDENT:"=%prefs_directory=!prefs_directory:"=! "
shift & shift
)
if "%1"=="-u" (
set user_prefs_directory=%2
echo "%INDENT:"=%user_prefs_directory=%user_prefs_directory:"=% "
shift & shift
)
if "%1"=="-t" (
set team_prefs_directory=%2
echo "%INDENT:"=%team_prefs_directory=%team_prefs_directory:"=% "
shift & shift
)
if "%1"=="-s" (
set scratch_directory=%2
echo "%INDENT:"=%scratch_directory=%scratch_directory:"=% "
shift & shift
)
if "%1"=="-c" (
set concat_directory=%2
echo "%INDENT:"=%concat_directory=%concat_directory:"=% "
shift & shift
)
if "%1"=="-y" (
set synthesis_subdirectory=%2
echo "%INDENT:"=%synthesis_subdirectory=%synthesis_subdirectory:"=% "
shift & shift
)
if "%1"=="-m" (
set set library_matchings="%2.hdp"
echo "%INDENT:"=%library_matchings=%library_matchings:"=% "
shift & shift
)
goto :parseloop
)
echo.
:: Setting all concurrent variables
set prefs_directory="!design_directory:"=!\Prefs"
set user_prefs_directory="!prefs_directory:"=!\hds_user"
set team_prefs_directory="!prefs_directory:"=!\hds_team"
set library_matchings=!prefs_directory:"=!\!library_matchings:"=!
set simulation_directory="!design_directory:"=!\Simulation"
set concat_directory="!design_directory:"=!\Board\concat"
:: Getting realpath
:: TODO
:: create scratch dir
if not exist "%scratch_directory%" (
mkdir "%scratch_directory:"=%"
)
::================================================================================
:: Main script
::
call "./searchPaths.bat"
::------------------------------------------------------------------------------
:: Project environment variables
::
set DESIGN_NAME=%design_name:"=%
set HDS_LIBS=%library_matchings:"=%
set HDS_USER_HOME=%user_prefs_directory:"=%
set HDS_TEAM_HOME=%team_prefs_directory:"=%
set SIMULATION_DIR=%simulation_directory:"=%
:: Changing Slashed (Needed for Modelsim)
set SIMULATION_DIR=%SIMULATION_DIR:\=/%
set SCRATCH_DIR=%scratch_directory:"=%
set CONCAT_DIR=%concat_directory:"=%
set ISE_BASE_DIR=%design_directory:"=%\%synthesis_subdirectory:"=%
set ISE_WORK_DIR=%scratch_directory:"=%\%DESIGN_NAME:"=%\%synthesis_subdirectory:"=%
set LIBERO_BASE_DIR=%design_directory:"=%\%synthesis_subdirectory:"=%
set LIBERO_WORK_DIR=%scratch_directory:"=%\%DESIGN_NAME:"=%\%synthesis_subdirectory:"=%
::------------------------------------------------------------------------------
:: Display info
::
if !VERBOSE! == 1 (
echo "Program Parameters"
echo "%INDENT:"=%DESIGN_NAME is %DESIGN_NAME:"=%"
echo "%INDENT:"=%HEI_LIBS_DIR is %HEI_LIBS_DIR:"=%"
echo "%INDENT:"=%HDS_LIBS is %HDS_LIBS:"=%"
echo "%INDENT:"=%SIMULATION_DIR is %SIMULATION_DIR:"=%"
echo "%INDENT:"=%HDS_USER_HOME is %HDS_USER_HOME:"=%"
echo "%INDENT:"=%HDS_TEAM_HOME is %HDS_TEAM_HOME:"=%"
echo "%INDENT:"=%SCRATCH_DIR is %SCRATCH_DIR:"=%"
echo "%INDENT:"=%CONCAT_DIR is %CONCAT_DIR:"=%"
if %REQUIRE_HDS% == 1 (
echo "%INDENT:"=%HDS_HOME is %HDS_HOME:"=%"
)
if %REQUIRE_MODELSIM% == 1 (
echo "%INDENT:"=%MODELSIM_HOME is %MODELSIM_HOME:"=%"
)
if %REQUIRE_ISE% == 1 (
echo "%INDENT:"=%ISE_HOME is %ISE_HOME:"=%"
echo "%INDENT:"=%ISE_BASE_DIR is %ISE_BASE_DIR:"=%"
echo "%INDENT:"=%ISE_WORK_DIR is %ISE_WORK_DIR:"=%"
)
if %REQUIRE_LIBERO% == 1 (
echo "%INDENT:"=%LIBERO_HOME is %LIBERO_HOME:"=%"
echo "%INDENT:"=%LIBERO_BASE_DIR is %LIBERO_BASE_DIR:"=%"
echo "%INDENT:"=%LIBERO_WORK_DIR is %LIBERO_WORK_DIR:"=%"
)
echo.
)
::------------------------------------------------------------------------------
:: Delete scratch directory
::
call "./cleanScratch.bat"
::------------------------------------------------------------------------------
:: Copy synthesis data to scratch directory
::
if %REQUIRE_ISE% == 1 (
if exist %ISE_BASE_DIR% (
echo "%ISE_BASE_DIR:"=%"
echo " -> %ISE_WORK_DIR:"=%"
if exist %ISE_WORK_DIR% (
rmdir /S /Q "%ISE_WORK_DIR%"
)
mkdir "%ISE_WORK_DIR%"
xcopy /Y "%ISE_BASE_DIR%" "%ISE_WORK_DIR%\"
)
)
if %REQUIRE_LIBERO% == 1 (
if exist %LIBERO_BASE_DIR% (
echo "%LIBERO_BASE_DIR:"=%"
echo " -> %LIBERO_BASE_DIR:"=%"
if exist %LIBERO_WORK_DIR% (
rmdir /S /Q "%LIBERO_WORK_DIR%"
)
mkdir "%LIBERO_WORK_DIR%"
xcopy /S /Y "%LIBERO_BASE_DIR%" "%LIBERO_WORK_DIR%\"
)
)
::------------------------------------------------------------------------------
:: Launch application
::
echo "%SEPARATOR:"=%"
echo "-- Launching program"
echo "%INDENT:"=%Waiting until programs finished..."
echo "-- Finished... YOU CAN CLOSE THIS WINDOW NOW!"
::start /wait !HDS_HOME:"=!\bin\hdldesigner.exe
%windir%\system32\cmd.exe /c start /wait !HDS_HOME!\bin\hdldesigner.exe
echo "%SEPARATOR:"=%"
:end
popd
endlocal
pause&goto:eof
::------------------------------------------------------------------------------
:: Helper Functions
::
:HELP
echo.
echo %usage1:"=%
echo %usage2:"=%
echo %usage3:"=%
echo %usage4:"=%
echo %usage5:"=%
echo.&pause&goto:eof

157
Scripts/searchPaths.bat Normal file
View File

@ -0,0 +1,157 @@
::==============================================================================
:: search_paths.bat - Search for Libraries and HDL Tools
::
:start
@echo off
set cmd_location="%~dp0"
pushd %cmd_location%
set SEPARATOR="--------------------------------------------------------------------------------"
set INDENT=" "
echo %SEPARATOR%
echo "-- %~nx0 Started!"
echo.
echo "Search HEI Library"
::------------------------------------------------------------------------------
:: Search HEI library directory
::
if !REQUIRE_LIBS! == 1 (
if "%HEI_LIBS_DIR%" == "" (
set HEI_LIBS_DIR=%design_directory:"=!%\Libs
if not exist !HEI_LIBS_DIR!\ (
:: check at folder one level above project folder, as used on svn for boards libraries
set HEI_LIBS_DIR=%design_directory:"=!%\..\Libs
if not exist !HEI_LIBS_DIR!\ (
:: check at folder one level above project folder, as used on svn for boards libraries
set HEI_LIBS_DIR=%design_directory:"=!%\..\..\Libs
if not exist !HEI_LIBS_DIR!\ (
:: check on server, as used for ET labs
set HEI_LIBS_DIR=R:\ETE\Ele1_8132\ELN\Labs\Libraries
if not exist !HEI_LIBS_DIR!\ (
:: check on server, as used for SI labs
set HEI_LIBS_DIR=R:\SYND\Ele_2131\ELN\Labs\Libraries
if not exist !HEI_LIBS_DIR!\ (
echo "ERROR: No valid libraries found: please verify your project setup."
pause&goto:end
)
)
)
)
)
)
if exist !HEI_LIBS_DIR!\ (
echo "%INDENT:"=%Found HEI_LIBS_DIR at !HEI_LIBS_DIR:"=!"
) else (
echo "%INDENT:"=%ERROR: No valid HEI_LIBS_DIR found: please verify your HEI_LIBS_DIR settings."
pause&goto:eof
)
)
echo "Search Design Tools: HDL Designer, Modelsim, Xilinx ISE, Microsemi Libero"
::------------------------------------------------------------------------------
:: Search HDL Designer directory
::
if !REQUIRE_HDS! == 1 (
if "%HDS_HOME%" == "" (
set HDS_HOME=C:\eda\MentorGraphics\HDS
if not exist !HDS_HOME!\ (
set HDS_HOME=C:\tools\eda\HDS
if not exist !HDS_HOME!\ (
echo "%INDENT:"=%ERROR: No valid installation of HDL-Designer found: please verify your HDS_HOME settings."
pause&goto:eof
)
)
)
if exist !HDS_HOME! (
echo "%INDENT:"=%Found HDL-Designer at !HDS_HOME!"
) else (
echo "%INDENT:"=%ERROR: No valid installation of HDL-Designer found: please verify your HDS_HOME settings."
pause&goto:eof
)
)
)
::------------------------------------------------------------------------------
:: Search Modelsim directory
::
if !REQUIRE_MODELSIM! == 1 (
if "%MODELSIM_HOME%" == "" (
set MODELSIM_HOME=C:\eda\MentorGraphics\modelsim\win64
if not exist !MODELSIM_HOME!\ (
set MODELSIM_HOME=C:\eda\MentorGraphics\modelsim\win32
if not exist !MODELSIM_HOME!\ (
set MODELSIM_HOME=C:\tools\eda\Modelsim\win64
if not exist !MODELSIM_HOME!\ (
set MODELSIM_HOME=C:\tools\eda\Modelsim\win32
if not exist !MODELSIM_HOME!\ (
echo "%INDENT:"=%ERROR: No valid installation of ModelSim found please verify your MODELSIM_HOME settings."
pause&goto:eof
)
)
)
)
)
if exist !MODELSIM_HOME! (
echo "%INDENT:"=%Found ModelSim at !MODELSIM_HOME:"=!"
) else (
echo "%INDENT:"=%ERROR: No valid installation of ModelSim found please verify your MODELSIM_HOME settings."
pause
goto:eof
)
)
::------------------------------------------------------------------------------
:: Search Xilinx ISE directory
::
if !REQUIRE_ISE! == 1 (
if "%ISE_HOME%" == "" (
set ISE_HOME=C:\eda\Xilinx\!ISE_VERSION:"=!\ISE_DS\ISE
if not exist !ISE_HOME!\ (
set ISE_HOME=C:\tools\eda\Xilinx\!ISE_VERSION:"=!\ISE_DS\ISE
if not exist !ISE_HOME!\ (
echo "%INDENT:"=%ERROR: No valid installation of ISE found please verify your ISE_HOME settings."
pause&goto:eof
)
)
)
if exist !ISE_HOME! (
echo "%INDENT:"=%Found ISE at !ISE_HOME:"=!"
) else (
echo "%INDENT:"=%ERROR: No valid installation of ISE found please verify your ISE_HOME settings."
pause&goto:eof
)
)
::------------------------------------------------------------------------------
:: Search Microsemi Libero directory
::
if %REQUIRE_LIBERO% == 1 (
if "%LIBERO_HOME%" == "" (
set LIBERO_HOME=C:\eda\Microsemi\Libero
if not exist !LIBERO_HOME!\ (
set LIBERO_HOME=C:\tools\eda\Microsemi\Libero
if not exist !LIBERO_HOME!\ (
echo "%INDENT:"=%ERROR: No valid installation of Libero found please verify your LIBERO_HOME settings."
pause&goto:eof
)
)
)
if exist !LIBERO_HOME! (
echo "%INDENT:"=%Found Libero at !LIBERO_HOME:"=!"
) else (
echo "%INDENT:"=%ERROR: No valid installation of Libero found please verify your LIBERO_HOME settings."
pause
goto:eof
)
)
:end
echo.
echo "-- %~nx0 Finished!"
echo %SEPARATOR%
popd
goto:eof

37
Scripts/start_libero.pl Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/perl
# filename: start_libero.pl
# created by: Corthay Francois & Zahno Silvan
#
#-------------------------------------------------------------------------------
#
# Description:
# Starts Libero in the correct timezone for the Synplify License
# Help Parameter : <?>
# Parameter : start_libero.pl <Libero File Spec>
#-------------------------------------------------------------------------------
#
# History:
# V0.1 : zas 08.2019 -- Initial release
#
################################################################################
$separator = '-' x 79;
$indent = ' ' x 2;
$verbose = 1;
$ENV{TZ} = ''; # needed to be able to run Synplify avoinding license error
my $designerExe = "$ENV{LIBERO_HOME}\\Designer\\bin\\libero.exe";
$liberoFileSpec = $ARGV[0];
#-------------------------------------------------------------------------------
# Launch Libero
#
if ($verbose == 1) {
print "\n";
print "launching $designerExe\n";
print $indent, "project file spec: $liberoFileSpec\n";
print "$separator\n";
}
system("$designerExe $liberoFileSpec");

161
Scripts/trimLibs.pl Normal file
View File

@ -0,0 +1,161 @@
#!/usr/bin/perl
# ------------------------------------------------------------------------------
# trimLibs
# Comment regular libraries in an concatenated file
# Help Parameter : <?>
# Parameter : trimlibs.pl <Input File Name> <Output File Name>
# ------------------------------------------------------------------------------
# Authors:
# cof: [Fran<61>ois Corthay](francois.corthay@hevs.ch)
# guo: [Oliver A. Gubler](oliver.gubler@hevs.ch)
# zas: [Silvan Zahno](silvan.zahno@hevs.ch)
# gal: [Laurent Gauch]
# ------------------------------------------------------------------------------
# Changelog:
# 2019.08.23 : cof
# * Comment "omment "FOR xxxx : yyy USE ENTITY zzz;"" instead all "For All ... work" lines
# * Seen problems in ELN_Kart
# 2019.06.11 : zas
# * Comment "For All .... work."" instead all "For All" lines
# * Allow Outputfilename as Env var or as Script parameter
# 2015-08-25 : guo
# * added unisim to the list of excluded libraries
# 2015-05-08 : guo
# * added verbosity debug
# * changed this header
# * minor comment modifications
# 2013-08-13 : zas guo
# Handle error if environment variable not found, character'pos('$') -> ')
# was found as env var, added exception
# 2013-06-13 : cof zas guo
# Remove comments from testline
# 2013-01-09 : cof --
# * Bugfix: no carriage return on commented "use" statements
# * Bugfix: more precise targeting of "library" statement
# * Bugfix: "Library" test after "use" test
# 2012-04-27 : zas
# * Bugfix: on feature added in version 2011-06-10
# 2012-02-02 : zas
# * Write the output into a new file with the name defined in the
# * $DESIGN_NAME variable
# 2012-01-23 : zas
# * Replaces $env_var_name by the value of the found environmemnt variable.
# * Mostly used to replace $SIMULATION_DIR for initialise bram's from a file
# * placed in the Simulation Directory
# 2011-06-10 : zas
# Replaces
# library xxx;use xxx.yyy.all;
# with
# --library xxx;
# use work.yyy.all;
# 2005...2011 : cof
# Improvements
# 2005-01-29 : gal
# initlial release
# ------------------------------------------------------------------------------
$separator = '-' x 79;
$indent = ' ' x 2;
$hdlInFileSpec = $ARGV[0];
if (defined $ARGV[1]) {
$hdlOutFileSpec = $ARGV[1];
}
else {
$hdlOutFileSpec = 'trimmed.vhd';
}
$verbose = 1;
$debug = 0;
#-------------------------------------------------------------------------------
# program I/O files
#
$tempFileSpec = $hdlOutFileSpec . '.tmp';
if ($verbose == 1) {
print "\n$separator\n";
print "Trimming library declarations from $hdlInFileSpec to $hdlOutFileSpec\n";
print $indent, "temporary file spec: $tempFileSpec\n";
}
#-------------------------------------------------------------------------------
# read original file, edit and save to temporary file
#
my $line;
open(HDLFile, $hdlInFileSpec) || die "couldn't open $HDLFileSpec!";
open(tempFile, ">$tempFileSpec");
while (chop($line = <HDLFile>)) {
# remove all comment for the test
my $testline = $line;
$testline =~ s/--.*//;
# Replace 'use xxx.yyy' with 'use work.yyy', except if xxx is ieee or std or unisim
if ($testline =~ m/use\s.*\.all\s*;/i) {
if ( not($testline =~ m/\bieee\./i) and
not($testline =~ m/\bstd\./i) and
not($testline =~ m/\bunisim\./i)) {
# if there is any char before "use" except \s, insert new line \n
if ( ($testline =~ m/[^\s]\s*use/i) ) {
$line =~ s/use\s+.*?\./\nuse work./i;
if ($debug == 1) {
print "TEST0099: ", $testline, "\n"
}
}
else {
$line =~ s/use\s+.*?\./use work./i;
if ($debug == 1) {
print "TEST0105: ", $testline, "\n"
}
}
}
}
# Comment libraries which aren't ieee or std or unisim
if (($testline =~ m/\slibrary\s+/i) or ($testline =~ m/\Alibrary\s+/i)) {
if ( not($testline =~ m/ieee/i) and
not($testline =~ m/std/i) and
not($testline =~ m/unisim/i)) {
$line = '-- ' . $line;
}
}
# Comment "FOR xxxx : yyy USE ENTITY zzz;
if ($line =~ m/for\s+.+:.+\s+use\s+entity/i) {
$line = '-- ' . $line;
}
# Search for $Env_Var_Names and replace them by the value of the env_var
if ($testline =~ m/(\$[^\s\/.'"\\]+)/i) {
$envvar = $1;
$envvar =~ s/^.//;
eval {
$line =~ s/\$$envvar/$ENV{$envvar}/;
};
if ($@) {
print ("WARNING: Environment Variable not found: $envvar \n")
}
}
print tempFile ("$line\n");
}
close(tempFile);
close(HDLFile);
#-------------------------------------------------------------------------------
# delete original file and rename temporary file
#
unlink($hdlOutFileSpec);
rename($tempFileSpec, $hdlOutFileSpec);
if ($verbose == 1) {
print "$separator\n";
}
#if ($verbose == 1) {
# print $indent, "Hit any <CR> to continue";
# $dummy = <STDIN>;
#}

91
Scripts/update_ise.pl Normal file
View File

@ -0,0 +1,91 @@
#!/usr/bin/perl
# ------------------------------------------------------------------------------
# update_ise
# replace ucf and vhd filelocation and name in the Xilinx xise project file
# Help Parameter : <?>
# Parameter : update_ise.pl <ISE File Spec> <VHDL File Spec> <UCF File Spec>
# ------------------------------------------------------------------------------
# Changelog:
# 2019-06-12 : zas
# * All parameters given with agruments instead of env variables
# 2015-05-26 : guo
# * update to environment from HELS v.15.0526
# 2012-05-27 : cof
# * Initial release
# ------------------------------------------------------------------------------
$separator = '-' x 79;
$indent = ' ' x 2;
$iseFileSpec = $ARGV[0];
$vhdlFileSpec = $ARGV[1];
$ucfFileSpec = $ARGV[2];
$verbose = 1;
if ($verbose == 1) {
print "Script Parameters:\n";
print " * iseFileSpec: $iseFileSpec\n";
print " * vhdlFileSpec: $vhdlFileSpec\n";
print " * ucfFileSpec: $ucfFileSpec\n";
}
#-------------------------------------------------------------------------------
# program I/O files
#
$tempFileSpec = $iseFileSpec . '.tmp';
if ($verbose == 1) {
print "\n$separator\n";
print "Updating file specifications in $iseFileSpec\n";
print $indent, "temporary file spec: $tempFileSpec\n";
}
#-------------------------------------------------------------------------------
# read original file, edit and save to temporary file
#
my $line;
open(ISEFile, $iseFileSpec) || die "couldn't open $iseFileSpec!";
open(tempFile, ">$tempFileSpec");
while (chop($line = <ISEFile>)) {
# replace VHDL files
if ($line =~ m/FILE_VHDL/i) {
$line =~ s/<file\s+xil_pn\:name=.*?".+?"/<file xil_pn:name="$vhdlFileSpec"/ig;
}
# replace EDIF files
if ($line =~ m/FILE_EDIF/i) {
$line =~ s/<file\s+xil_pn\:name=.*?".+?"/<file xil_pn:name="$edifFileSpec"/ig;
}
# replace UCF files
if ($line =~ m/FILE_UCF/i) {
$line =~ s/<file\s+xil_pn\:name=.*?".+?"/<file xil_pn:name="$ucfFileSpec"/ig;
}
# Implementation Top files
if ($line =~ m/\.vhd"/i) {
$line =~ s/<property\s+xil_pn:name="Implementation\s+Top\s+File"\s+xil_pn\:value=".+?"/<property xil_pn:name="Implementation Top File" xil_pn:value="$vhdlFileSpec"/ig;
}
if ($line =~ m/\.edf"/i) {
$line =~ s/<property\s+xil_pn:name="Implementation\s+Top\s+File"\s+xil_pn\:value=".+?"/<property xil_pn:name="Implementation Top File" xil_pn:value="$edifFileSpec"/ig;
}
# replace UCF binding
if ($line =~ m/\.ucf"/i) {
$line =~ s/<binding\s+(.+)\s+xil_pn\:name=.*?".+?"/<binding $1 xil_pn:name="$ucfFileSpec"/ig;
}
print tempFile ("$line\n");
}
close(tempFile);
close(ISEFile);
#-------------------------------------------------------------------------------
# delete original file and rename temporary file
#
unlink($iseFileSpec);
rename($tempFileSpec, $iseFileSpec);
if ($verbose == 1) {
print "$separator\n";
}

107
Scripts/update_libero.pl Normal file
View File

@ -0,0 +1,107 @@
#!/usr/bin/perl
# filename: update_libero.pl
# created by: Corthay Francois & Zahno Silvan
#
#-------------------------------------------------------------------------------
#
# Description:
# Updates the file references in the .prjx Actel project file
# and launches the Libero project manager
# Help Parameter : <?>
# Parameter : update_libero.pl <Libero File Spec> <VHDL File Spec> <^PDC File Spec>
#-------------------------------------------------------------------------------
#
# History:
# V0.1 : cof 12.2013 -- Initial release
# V0.2 : zas 08.2019 -- Changed actel to libero
#
################################################################################
$separator = '-' x 79;
$indent = ' ' x 2;
$verbose = 1;
$ENV{TZ} = ''; # needed to be able to run Synplify avoinding license error
my $designerExe = "$ENV{LIBERO_HOME}\\Designer\\bin\\libero.exe";
$liberoFileSpec = $ARGV[0];
$vhdlFileSpec = $ARGV[1];
$pdcFileSpec = $ARGV[2];
if ($verbose == 1) {
print "Script Parameters:\n";
print " * liberoFileSpec: $liberoFileSpec\n";
print " * vhdlFileSpec: $vhdlFileSpec\n";
print " * pdcFileSpec: $pdcFileSpec\n";
}
#-------------------------------------------------------------------------------
# Project variables
#
$liberoWorkFileSpec = $liberoFileSpec . '.tmp';
# source directory
my $sourceDir = "$ENV{CONCAT_DIR}";
my $projectDir = "$ENV{LIBERO_WORK_DIR}";
#-------------------------------------------------------------------------------
# Update paths in the project file
#
if ($verbose == 1) {
print "\n$separator\n";
print "Updating file specifications in $liberoFileSpec\n";
print $indent, "temporary file spec: $liberoWorkFileSpec\n";
}
my $line;
open(LiberoFile, $liberoFileSpec) || die "couldn't open $HDLFileSpec!";
open(workFile, ">$liberoWorkFileSpec");
while (chop($line = <LiberoFile>)) {
# replace source path
if ($line =~ m/DEFAULT_IMPORT_LOC/i) {
$line =~ s/".*"/"$sourceDir"/;
}
# replace project path
if ($line =~ m/ProjectLocation/i) {
$line =~ s/".*"/"$projectDir"/;
}
# replace VHDL file spec
if ($line =~ m/VALUE\s".*,hdl"/i) {
$line =~ s/".*"/"$vhdlFileSpec,hdl"/;
}
# replace PDC file spec
if ($line =~ m/VALUE\s".*\.pdc,pdc"/i) {
$line =~ s/".*"/"$pdcFileSpec,pdc"/;
}
print workFile ("$line\n");
}
close(workFile);
close(LiberoFile);
#-------------------------------------------------------------------------------
# delete original file and rename temporary file
#
unlink($liberoFileSpec);
rename($liberoWorkFileSpec, $liberoFileSpec);
if ($verbose == 1) {
print "$separator\n";
}
#-------------------------------------------------------------------------------
# Launch Libero
#
#if ($verbose == 1) {
# print "\n";
# print "launching $designerExe\n";
# print $indent, "project file spec: $liberoFileSpec\n";
# print "$separator\n";
#}
#system("$designerExe $liberoFileSpec");