diff options
author | jofret | 2009-05-13 09:00:38 +0000 |
---|---|---|
committer | jofret | 2009-05-13 09:00:38 +0000 |
commit | 13e70f4ba368a64c19e260041217b34ccf181066 (patch) | |
tree | 42ab150c158fddb9d00ee2a0f9dd14c1be936ee6 | |
parent | 4edfcc5ea0d6d7d7418e320b04ac2b18421e704b (diff) | |
download | scilab2c-13e70f4ba368a64c19e260041217b34ccf181066.tar.gz scilab2c-13e70f4ba368a64c19e260041217b34ccf181066.tar.bz2 scilab2c-13e70f4ba368a64c19e260041217b34ccf181066.zip |
Makefile generation
-rw-r--r-- | ChangeLog | 60 | ||||
-rw-r--r-- | HowToInstallAndUseSCI2C.txt | 27 | ||||
-rw-r--r-- | etc/scilab2c.start | 1 | ||||
-rw-r--r-- | includes/sci2clib.h (renamed from macros/CFiles/sci2cincludes/sci2clib.h) | 40 | ||||
-rw-r--r-- | macros/CCodeGeneration/C_GenerateMakefile.sci | 21 | ||||
-rw-r--r-- | macros/CCodeGeneration/SCI2CMakefileTemplate.rc | 44 | ||||
-rw-r--r-- | macros/ToolInitialization/INIT_SCI2C.sci | 6 | ||||
-rw-r--r-- | macros/runsci2c.sci | 21 | ||||
-rw-r--r-- | readme.txt (renamed from README) | 0 | ||||
-rw-r--r-- | toyApplication/tols.m | 22 |
10 files changed, 174 insertions, 68 deletions
@@ -1,3 +1,63 @@ +2007-09-07 Bruno JOFRET <bruno.jofret@inria.fr> + + * src/auxiliaryFunctions/includes/rand.h : + Modification of funtions prototypes. + Array generation must be in a given array. + +2007-08-30 Bruno JOFRET <bruno.jofret@inria.fr> + + * src/auxiliaryFunctions/pythag : + Add Pythag mangement for complex type. + +2007-07-11 Bruno JOFRET <bruno.jofret@inria.fr> + + * src/*/Makefile.* : + Update Autotools version. + * src/configure : + Update Autotools version. + +2007-07-11 Bruno JOFRET <bruno.jofret@inria.fr> + + * src/type/doubleComplex.c : + Begin complex operations. Must be improved/tested. + +2007-06-XX Bruno JOFRET <bruno.jofret@inria.fr> + + * src/elementaryFunctions/acos : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/acosh : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/asin : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/asinh : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/atan : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/atanh : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/cos : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/cosh : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/exp : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/exp10 : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/log : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/log10 : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/sin : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/sinh : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/sqrt : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/tan : + Finalise Prototyping, add dummy code with FIXME. + * src/elementaryFunctions/tanh : + Finalise Prototyping, add dummy code with FIXME. + 2007-05-07 Bruno JOFRET <bruno.jofret@inria.fr> * src/AuxiliaryFunctions/isnan : diff --git a/HowToInstallAndUseSCI2C.txt b/HowToInstallAndUseSCI2C.txt new file mode 100644 index 00000000..ec08ab42 --- /dev/null +++ b/HowToInstallAndUseSCI2C.txt @@ -0,0 +1,27 @@ +---------------------------- +--- HOW TO INSTALL SCI2C --- +---------------------------- +1. Install scilab-4.1.2.exe + +2. Configure the following two parameters in Scilab2C/LaunchRunSCI2C.sci: + SCI2CDirectory + SCI2CInputPrmFileName + +3. Configure the following parameters in SCI2CTests\test999_WorkingDir\SCI2CInputParameters.sce + UserSciCodeMainDir + CCompilerPathStyle + Sci2CLibMainHeaderFName + +------------------------ +--- HOW TO USE SCI2C --- +------------------------ +4. Edit mainfunction.sci according to the scilab algorithm to be converted into C + +5. Start SCI2C conversion typing the following command in the Scilab workspace: + mclose('all'); cd <path of "Scilab2C" directory>; exec LaunchRunSCI2C.sci + +6. Compile/Execute C code by using the makefile created in SCI2CTests\test999_WorkingDir\C_Code + +7. Compare the results with the Scilab execution by typing again + mclose('all'); cd <path of "Scilab2C" directory>; exec LaunchRunSCI2C.sci + (answer n when the SCI2C attempts to convert again the scilab code) diff --git a/etc/scilab2c.start b/etc/scilab2c.start index e933c3c4..9e377ff4 100644 --- a/etc/scilab2c.start +++ b/etc/scilab2c.start @@ -24,6 +24,7 @@ sci2c_FunctionListlib = lib(pathmacros + "FunctionList" + filesep()); sci2c_GeneralFunctionslib = lib(pathmacros + "GeneralFunctions" + filesep()); sci2c_SymbolTablelib = lib(pathmacros + "SymbolTable" + filesep()); sci2c_ToolInitializationlib = lib(pathmacros + "ToolInitialization" + filesep()); +sci2c_finDeps = lib(pathmacros + "findDeps" + filesep()); // load gateways //disp('Load gateways'); diff --git a/macros/CFiles/sci2cincludes/sci2clib.h b/includes/sci2clib.h index 7c1e9dcc..05145240 100644 --- a/macros/CFiles/sci2cincludes/sci2clib.h +++ b/includes/sci2clib.h @@ -2,26 +2,26 @@ #include <stdlib.h>
#include <string.h>
#include <math.h> -#include "SCI2CMacroInterface.h"
-#include "constant.h"
-#include "notFound.h"
-#include "doubleComplex.h"
-#include "floatComplex.h"
-#include "RealToComplex.h"
-#include "OpEqual.h"
-#include "OpIns.h"
-#include "OpExt.h"
-#include "FileManagement.h"
-#include "OpLogNe.h"
-#include "OpLogGt.h"
-#include "OpLogLt.h"
-#include "OpLogGe.h"
-#include "OpLogLe.h"
-#include "OpLogEq.h"
-#include "OpLogOr.h"
-#include "OpLogAnd.h"
-#include "OpLogNot.h"
-#include "ConvertPrecision.h" +/* #include "SCI2CMacroInterface.h"
*/ +/* #include "constant.h"
*/ +/* #include "notFound.h"
*/ +/* #include "doubleComplex.h"
*/ +/* #include "floatComplex.h"
*/ +/* #include "RealToComplex.h"
*/ +/* #include "OpEqual.h"
*/ +/* #include "OpIns.h"
*/ +/* #include "OpExt.h"
*/ +/* #include "FileManagement.h"
*/ +/* #include "OpLogNe.h"
*/ +/* #include "OpLogGt.h"
*/ +/* #include "OpLogLt.h"
*/ +/* #include "OpLogGe.h"
*/ +/* #include "OpLogLe.h"
*/ +/* #include "OpLogEq.h"
*/ +/* #include "OpLogOr.h"
*/ +/* #include "OpLogAnd.h"
*/ +/* #include "OpLogNot.h"
*/ +/* #include "ConvertPrecision.h" */ /* LIB */ diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index e591e6f3..ace98c2b 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -38,11 +38,9 @@ PrintStringInfo('# --- USER PARAMETERS ---',FileInfo.MakefileFilename,'file','y' PrintStringInfo('# -----------------------',FileInfo.MakefileFilename,'file','y'); PrintStringInfo('# --- DIRECTORIES AND FILES ---',FileInfo.MakefileFilename,'file','y'); -makeobjpath = pathconvert('..\..\..\Scilab2C\CFiles\sci2cobj', %f, %f, 'u'); -// makeobjpath = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2cobj'; -makecsrcdir = pathconvert('..\..\..\Scilab2C\CFiles\sci2ccode', %f, %f, 'u'); +makecsrcdir = pathconvert('src/c', %f, %f, 'u'); // makecsrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2ccode'; -makehsrcdir = pathconvert('..\..\..\Scilab2C\CFiles\sci2cincludes', %f, %f, 'u'); +makehsrcdir = pathconvert('includes', %f, %f, 'u'); // makehsrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2cincludes'; makeisrcdir = pathconvert('..\..\..\Scilab2C\CFiles\sci2cinterfaces', %f, %f, 'u'); // makeisrcdir = FileInfo.CStyleSCI2CMainDir+'\CFiles\sci2cinterfaces'; @@ -50,7 +48,6 @@ makesci2cdir = FileInfo.CStyleOutCCCodeDir; // makesci2cdir = FileInfo.CStyleOutCCCodeDir; -PrintStringInfo('OBJDIR = '+makeobjpath,FileInfo.MakefileFilename,'file','y'); PrintStringInfo('CSRCDIR = '+makecsrcdir,FileInfo.MakefileFilename,'file','y'); PrintStringInfo('HSRCDIR = '+makehsrcdir,FileInfo.MakefileFilename,'file','y'); PrintStringInfo('ISRCDIR = '+makeisrcdir,FileInfo.MakefileFilename,'file','y'); @@ -61,17 +58,17 @@ PrintStringInfo('EXEFILENAME = mytest.exe',FileInfo.MakefileFilename,'file','y') // ------------------------------- // --- Open template makefile. --- // ------------------------------- -//-- fidfile = SCI2COpenFileRead(FileInfo.MakefileTemplate); +fidfile = SCI2COpenFileRead(FileInfo.MakefileTemplate); // ------------------- // --- Read lines. --- // ------------------- -//-- tmpline = mgetl(fidfile,1); -//-- while (meof(fidfile) == 0) -//-- PrintStringInfo(tmpline,FileInfo.MakefileFilename,'file','y'); -//-- tmpline = mgetl(fidfile,1); -//-- end +tmpline = mgetl(fidfile,1); +while (meof(fidfile) == 0) + PrintStringInfo(tmpline,FileInfo.MakefileFilename,'file','y'); + tmpline = mgetl(fidfile,1); +end -//-- mclose(fidfile); +mclose(fidfile); endfunction diff --git a/macros/CCodeGeneration/SCI2CMakefileTemplate.rc b/macros/CCodeGeneration/SCI2CMakefileTemplate.rc index 3787172a..6d459829 100644 --- a/macros/CCodeGeneration/SCI2CMakefileTemplate.rc +++ b/macros/CCodeGeneration/SCI2CMakefileTemplate.rc @@ -23,17 +23,6 @@ EXEFILE = $(SCI2CDIR)/$(EXEFILENAME) SWSRCS = \ $(CSRCDIR)/doubleComplex.c \ $(CSRCDIR)/floatComplex.c \ - $(CSRCDIR)/RealToComplex.c \ - $(CSRCDIR)/OpIns.c \ - $(CSRCDIR)/OpExt.c \ - $(CSRCDIR)/FileManagement.c \ - $(CSRCDIR)/OpLogLt.c \ - $(CSRCDIR)/OpLogGt.c \ - $(CSRCDIR)/OpLogGe.c \ - $(CSRCDIR)/OpLogLe.c \ - $(CSRCDIR)/OpLogOr.c \ - $(CSRCDIR)/OpLogAnd.c \ - $(CSRCDIR)/ConvertPrecision.c \ $(CSRCDIR)/ssqrts.c \ $(CSRCDIR)/dsqrts.c \ $(CSRCDIR)/csqrts.c \ @@ -489,16 +478,27 @@ SWSRCS = \ $(CSRCDIR)/srounds.c \ $(CSRCDIR)/srounda.c \ $(CSRCDIR)/zrounds.c \ - $(CSRCDIR)/zrounda.c - - - - - - - - - + $(CSRCDIR)/zrounda.c + + + + +# $(CSRCDIR)/RealToComplex.c \ +# $(CSRCDIR)/OpIns.c \ +# $(CSRCDIR)/OpExt.c \ +# $(CSRCDIR)/FileManagement.c \ +# $(CSRCDIR)/OpLogLt.c \ +# $(CSRCDIR)/OpLogGt.c \ +# $(CSRCDIR)/OpLogGe.c \ +# $(CSRCDIR)/OpLogLe.c \ +# $(CSRCDIR)/OpLogOr.c \ +# $(CSRCDIR)/OpLogAnd.c \ +# $(CSRCDIR)/ConvertPrecision.c \ + + + + + # $(CSRCDIR)/clog1ps.c \ # $(CSRCDIR)/zlog1ps.c \ # $(CSRCDIR)/clog1pa.c \ @@ -514,7 +514,7 @@ compileexecute: $(SWOBJS) @echo "============================" @echo "Generation of the executable" @echo "============================" - $(CC) $(CFLAGS) $(SWOBJS) $(SCI2CDIR)/*.c -llapack -lblas -o $(EXEFILE) + $(CC) $(CFLAGS) $(SWOBJS) *.c -llapack -lblas -o $(EXEFILE) @echo " " @echo "==============" @echo "Executing code" diff --git a/macros/ToolInitialization/INIT_SCI2C.sci b/macros/ToolInitialization/INIT_SCI2C.sci index be746c85..0ffe5b58 100644 --- a/macros/ToolInitialization/INIT_SCI2C.sci +++ b/macros/ToolInitialization/INIT_SCI2C.sci @@ -58,7 +58,7 @@ WorkingDir = fullfile(SCI2CResultDir,'SCI2CTmpResultsReports'); // #RNU_RES_B
// --- Directory where the generated C code will be stored. ---
// #RNU_RES_E
-OutCCCodeDir = fullfile(SCI2CResultDir,'C_Code');
+OutCCCodeDir = SCI2CResultDir;
// ------------------------------
// --- Initialize SharedInfo. ---
@@ -68,7 +68,7 @@ OutCCCodeDir = fullfile(SCI2CResultDir,'C_Code'); //-- FIXME : MainLibHeader and Verbose mode are (?) configurable
SharedInfo = INIT_GenSharedInfo(RunMode,UserScilabMainFile, ...
- TotTempScalarVars,EnableTempVarsReuse,"sci2cincludes/sci2clib.h", %t);
+ TotTempScalarVars,EnableTempVarsReuse,"sci2clib.h", %t);
// ----------------------------
// --- Initialize FileInfo. ---
@@ -79,7 +79,7 @@ PrintStepInfo('SCI2C hArtes/POLIBA Tool!!!',FileInfo.GeneralReport,'stdout'); // ----------------------------------------------------
// --- Remove previous versions of SCI2C files/dir. ---
// ----------------------------------------------------
-INIT_RemoveDirs(FileInfo,SharedInfo.RunMode);
+//-- INIT_RemoveDirs(FileInfo,SharedInfo.RunMode);
// ---------------------------
// --- Create Directories. ---
diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index 9356a0b3..f34e4e3d 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -83,6 +83,27 @@ if (RunMode == 'All' | RunMode == 'Translate') end
end
+
+
+// ---------------------------
+// --- Copy library files. ---
+// ---------------------------
+allSources = getAllSources();
+allHeaders = getAllHeaders();
+mkdir(SCI2COutputPath+"/src/");
+mkdir(SCI2COutputPath+"/src/c/");
+mkdir(SCI2COutputPath+"/includes/");
+//pause
+for i = 1:size(allSources, "*")
+ disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
+ copyfile(allSources(i), SCI2COutputPath+"/src/c/");
+end
+for i = 1:size(allHeaders, "*")
+ disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
+ copyfile(allHeaders(i), SCI2COutputPath+"/includes/");
+end
+
+
// --------------------------
// --- Generate Makefile. ---
// --------------------------
diff --git a/toyApplication/tols.m b/toyApplication/tols.m index 51f9306b..2275e436 100644 --- a/toyApplication/tols.m +++ b/toyApplication/tols.m @@ -74,7 +74,7 @@ while hassignal || hastail fprintf(' - loop %i: signal finished, processing tail only.\n', i + 1); end end - + % drop oldest frame and add new one % @real-time: can be implemented using a circular buffer if (i >= R) @@ -93,7 +93,7 @@ while hassignal || hastail % @real-time: during convolution ending rstart = i - xframes + 1; end - + % total length of y ylen = lenx + length(h) - 1; % end of output larger than expected result? @@ -103,23 +103,23 @@ while hassignal || hastail hastail = 0; loops = i; end - + % add most recent frame to convolution result if hastail == 1 yylen = S; - y = [y; zeros(S,1)]; + y = [y; zeros(S,1)]; else yylen = S - (yyend - ylen); y = [y; zeros(yylen,1)]; loops = i; end - + % @real-time: loops over r can be done in parallel, also between % subsequent loops over i for r=rstart:rend rcirc = mod(i - (r - 1), R) + 1; % calculate partial convolution - Y = XX(:,rcirc) .* HH(:,r); + Y = XX(:,rcirc) .* HH(:,r); yy = ifft(Y, L); % select last L-K points yy = yy(S+1:L); @@ -127,16 +127,16 @@ while hassignal || hastail y(end-yylen+1:end) = y(end-yylen+1:end) + yy(1:yylen); end i = i+1; - + end % while fprintf(' - total loops: %i\n', i); % TODO: make this independent of xlen %y = y(1:ylen); -end % convolve +endfunction % convolve %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [HH, R] = segmentir(h, K) -% segment impulse response into columns, the last +% segment impulse response into columns, the last % frame/column is zero-padded as needed. % HH -- matrix of impulse response frames % R -- number of IR frames (=columns of HH) @@ -151,10 +151,10 @@ function [HH, R] = segmentir(h, K) hlast = h((fullframes*K+1):length(h)); hlast = [hlast ; zeros(K - length(hlast),1)]; hh(:,fullframes+1) = hlast; - end + end % column ffts HH = fft(hh, L); % for debugging 1:n: HH = round(ifft(HH)); R = size(HH,2); -end % segmentir +endfunction % segmentir |