00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _DOC_COMPILE_SCAL_
00025 #define _DOC_COMPILE_SCAL_
00026
00027
00028 #include <string>
00029 #include <list>
00030 #include <map>
00031
00032 #include "sigtyperules.hh"
00033 #include "occurences.hh"
00034 #include "property.hh"
00035 #include "signals.hh"
00036 #include "lateq.hh"
00037 #include "Text.hh"
00038 #include "doc_Text.hh"
00039 #include "description.hh"
00040
00041
00043
00046
00047
00048 class DocCompiler
00049 {
00050 protected:
00051
00052 property<string> fCompileProperty;
00053 property<string> fVectorProperty;
00054
00055 Lateq* fLateq;
00056 Description* fDescription;
00057
00058 static map<string, int> fIDCounters;
00059 Tree fSharingKey;
00060 OccMarkup fOccMarkup;
00061 int fPriority;
00062
00063
00064 public:
00065
00066 DocCompiler (int numInputs, int numOutputs)
00067 :
00068 fLateq(new Lateq(numInputs, numOutputs)),
00069 fDescription(0),
00070 fPriority(0)
00071 {}
00072
00073 DocCompiler ( Lateq* k, int priority)
00074 :
00075 fLateq(k),
00076 fDescription(0),
00077 fPriority(priority)
00078 {}
00079
00080 ~DocCompiler()
00081 {}
00082
00083 Lateq* compileLateq (Tree L, Lateq* compiledEqn);
00084 Tree annotate(Tree L0);
00085
00086 Lateq* getLateq() { return (Lateq*)fLateq; }
00087 void setDescription(Description* descr) { fDescription= descr; }
00088 Description* getDescription() { return fDescription; }
00089
00090
00091 protected:
00092
00093 string CS (Tree sig, int priority);
00094 string generateCode (Tree sig, int priority);
00095 string generateCacheCode(Tree sig, const string& exp) ;
00096 string generateVariableStore(Tree sig, const string& exp);
00097
00098 string getFreshID (const string& prefix);
00099
00100 bool getCompiledExpression(Tree sig, string& name);
00101 string setCompiledExpression(Tree sig, const string& name);
00102
00103 void setVectorNameProperty(Tree sig, const string& vecname);
00104 bool getVectorNameProperty(Tree sig, string& vecname);
00105
00106 int getSharingCount(Tree t);
00107 void setSharingCount(Tree t, int count);
00108 void sharingAnalysis(Tree t);
00109 void sharingAnnotation(int vctxt, Tree t);
00110
00111 bool isShortEnough(string& s, unsigned int max);
00112
00113
00114
00115
00116 string generateXtended (Tree sig, int priority);
00117 string generateFixDelay (Tree sig, Tree arg, Tree size, int priority);
00118 string generatePrefix (Tree sig, Tree x, Tree e, int priority);
00119 string generateIota (Tree sig, Tree arg);
00120 string generateBinOp (Tree sig, int opcode, Tree arg1, Tree arg2, int priority);
00121
00122 string generateFFun (Tree sig, Tree ff, Tree largs, int priority);
00123
00124 string generateInput (Tree sig, const string& idx);
00125 string generateOutput (Tree sig, const string& idx, const string& arg1);
00126
00127
00128
00129 string generateDocConstantTbl (Tree sig, Tree size, Tree content);
00130 string generateDocWriteTbl (Tree sig, Tree size, Tree content, Tree widx, Tree wsig);
00131 string generateDocAccessTbl (Tree sig, Tree tbl, Tree ridx);
00132
00133 string generateSelect2 (Tree sig, Tree sel, Tree s1, Tree s2, int priority);
00134 string generateSelect3 (Tree sig, Tree sel, Tree s1, Tree s2, Tree s3, int priority);
00135
00136 string generateRecProj (Tree sig, Tree exp, int i, int priority);
00137 void generateRec (Tree sig, Tree var, Tree le, int priority);
00138
00139 string generateIntCast (Tree sig, Tree x, int priority);
00140 string generateFloatCast (Tree sig, Tree x, int priority);
00141
00142 string generateButton (Tree sig, Tree label);
00143 string generateCheckbox (Tree sig, Tree label);
00144 string generateVSlider (Tree sig, Tree label, Tree cur, Tree min, Tree max, Tree step);
00145 string generateHSlider (Tree sig, Tree label, Tree cur, Tree min, Tree max, Tree step);
00146 string generateNumEntry (Tree sig, Tree label, Tree cur, Tree min, Tree max, Tree step);
00147
00148 string generateVBargraph (Tree sig, Tree label, Tree min, Tree max, const string& exp);
00149 string generateHBargraph (Tree sig, Tree label, Tree min, Tree max, const string& exp);
00150 string generateAttach (Tree sig, Tree x, Tree y, int priority);
00151
00152 string generateNumber(Tree sig, const string& exp);
00153 string generateFConst (Tree sig, const string& file, const string& name);
00154 string generateFVar (Tree sig, const string& file, const string& name);
00155
00156 string generateDelayVec(Tree sig, const string& exp, const string& ctype, const string& vname, int mxd);
00157 string generateDelayVecNoTemp(Tree sig, const string& exp, const string& ctype, const string& vname, int mxd);
00158 void generateDelayLine(const string& ctype, const string& vname, int mxd, const string& exp);
00159
00160 void getTypedNames(Type t, const string& prefix, string& ctype, string& vname);
00161 void printGCCall(Tree sig, const string& calledFunction);
00162
00163
00164
00165
00166 void getUIDocInfos(Tree path, string& label, string& unit);
00167 string getUIDir (Tree pathname);
00168 string prepareBinaryUI(const string& name, Tree pathname);
00169 string prepareIntervallicUI(const string& name, Tree path, Tree tcur, Tree tmin, Tree tmax);
00170 };
00171
00172 #endif