46 for (
int i = 0;
isList(L); L =
tl(L), i++) {
129 }
else if(
isRec(sig,
id, body) ) {
137 vector<Tree> subsigs;
211 if (t->variability() <
kSamp) {
247 return subst(
"$0[i]", vname);
251 return subst(
"$0[($0_idx+i) & $1]", vname, mask);
262 return subst(
"$0[i]", vname);
294 }
else if (
isProj(sig, &i ,x)) {
330 return subst(
"$0[i]", vname);
354 cerr <<
"ERROR no vector name for " <<
ppsig(exp) << endl;
360 return subst(
"$0[i]", vecname);
365 return subst(
"$0[i]", vecname);
367 return subst(
"$0[i-$1]", vecname,
T(d));
370 return subst(
"$0[i-$1]", vecname,
CS(delay));
380 return subst(
"$0[($0_idx+i)&$1]", vecname,
T(N-1));
382 return subst(
"$0[($0_idx+i-$2)&$1]", vecname,
T(N-1),
T(d));
385 return subst(
"$0[($0_idx+i-$2)&$1]", vecname,
T(N-1),
CS(delay));
405 return subst(
"$0[i]", vname);
410 static int pow2limit(
int x)
413 while (n < x) { n = 2*n; }
456 string buf =
subst(
"$0_tmp", dlname);
457 string pmem=
subst(
"$0_perm", dlname);
460 delay = (delay+3)&-4;
463 string dsize =
T(delay);
495 string dsize =
T(delay);
496 string mask =
T(delay-1);
499 string idx =
subst(
"$0_idx", dlname);
500 string idx_save =
subst(
"$0_idx_save", dlname);
void addSharedDecl(const string &str)
virtual void compileMultiSignal(Tree L)
string setCompiledExpression(Tree sig, const string &name)
Set the string of a compiled expression is already compiled.
virtual string generateWaveform(Tree sig)
virtual string CS(Tree sig)
Compile a signal.
virtual string generateCode(Tree sig)
Main code generator dispatch.
Description * fDescription
void getTypedNames(Type t, const string &prefix, string &ctype, string &vname)
int pow2limit(int x)
Compute the minimal power of 2 greater than x.
void addExecCode(const string &str)
Tree prepareUserInterfaceTree(Tree t)
Remove fake root folder if not needed (that is if the UI is completely enclosed in one folder...
void generateUserInterfaceTree(Tree t)
Generate buildUserInterface C++ lines of code corresponding to user interface element t...
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
void openLoop(const string &size)
Open a non-recursive loop on top of the stack of open loops.
bool isSigFixDelay(Tree t, Tree &t0, Tree &t1)
virtual void generateDelayLine(const string &ctype, const string &vname, int mxd, const string &exp)
Generate code for the delay mecchanism without using temporary variables.
Occurences * retrieve(Tree t)
occurences of subtree t within root tree
virtual string generateCacheCode(Tree sig, const string &exp)
Generate cache code for a signal if needed.
void closeLoop(Tree sig)
Close the top loop and either keep it or absorb it within its enclosing loop.
void addInitCode(const string &str)
void generateMacroInterfaceTree(const string &pathname, Tree t)
Generate user interface macros corresponding to user interface element t.
bool needSeparateLoop(Tree sig)
Test if a signal need to be compiled in a separate loop.
virtual string generateCodeNonRec(Tree sig)
void addFirstPrivateDecl(const string &str)
virtual void dlineLoop(const string &tname, const string &dlname, int delay, const string &cexp)
Generate the code for a (short) delay line.
bool getVectorNameProperty(Tree sig, string &vecname)
Get the vector name property of a signal, the name of the vector used to store the previous values of...
bool getLoopProperty(Tree sig, Loop *&l)
Returns the loop used to compute a signal.
void addPreCode(const string &str)
void addZone2(const string &str)
string subst(const string &model, const vector< string > &args)
Text substitution.
int getSharingCount(Tree t)
bool getCompiledExpression(Tree sig, string &name)
Test if a signal is already compiled.
virtual void vectorLoop(const string &tname, const string &dlname, const string &cexp)
Generate the code for a (short) delay line.
virtual string generateVariableStore(Tree sig, const string &exp)
void addZone1(const string &str)
Type getCertifiedSigType(Tree sig)
Retrieve the type of sig and check it exists.
bool hasRecDependencyIn(Tree S)
returns true is this loop or its ancestors define a symbol in S
void generateRec(Tree sig, Tree var, Tree le)
Generate code for a group of mutually recursive definitions.
bool verySimple(Tree exp)
Test if exp is very simple that is it can't be considered a real component.
void addPostCode(const string &str)
bool isRec(Tree t, Tree &body)
is t a de Bruijn recursive tree
bool isSigInt(Tree t, int *i)
virtual string generateCacheCode(Tree sig, const string &exp)
virtual string generateDelayVec(Tree sig, const string &exp, const string &ctype, const string &vname, int mxd)
Generate code for the delay mecchanism.
virtual string generateFixDelay(Tree sig, Tree exp, Tree delay)
Generate code for accessing a delayed signal.
virtual string generateVariableStore(Tree sig, const string &exp)
int getMaxDelay() const
return the maximal delay collected
void declareWaveform(Tree sig, string &vname, int &size)
Generate code for a waveform.
void setVectorNameProperty(Tree sig, const string &vecname)
Set the vector name property of a signal, the name of the vector used to store the previous values of...
virtual string generateLoopCode(Tree sig)
Compile a signal.
bool isProj(Tree t, int *i, Tree &rgroup)
virtual void generateCodeRecursions(Tree sig)
virtual string generateCode(Tree sig)
Main code generator dispatch.
void addZone3(const string &str)
int getSubSignals(Tree sig, vector< Tree > &vsigs, bool visitgen=true)
Extract the sub signals of a signal expression, that is not necesseraly all the subtrees.
set< Loop * > fBackwardLoopDependencies
Loops that must be computed before this one.
void addDeclCode(const string &str)