00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef STILSignalBlock_H
00014 #define STILSignalBlock_H
00015
00016 #include <vector>
00017
00018 #include "stilblock.h"
00019 #include "stiltermination.h"
00020 #include "stilwfcs.h"
00021
00022
00023
00030
00031 class STILSignalBlock : public STILBlock {
00032
00033
00034 friend std::ostream& operator<<( std::ostream &os, const STILSignalBlock &);
00035
00036
00037 public:
00038
00039
00040 enum STILDefaultState {
00041 UndefinedDefaultState,
00042 ForceUp,
00043 ForceDown,
00044 ForceOff
00045 };
00046
00047
00048 enum STILBase {
00049 UndefinedBase,
00050 Hex,
00051 Dec
00052
00053 };
00054
00055
00056 enum STILAlignment {
00057 UndefinedAlignment,
00058 MSB,
00059 LSB
00060 };
00061
00062
00063
00065 struct WFCSTranslateStruct {
00066 char wfc;
00067 char * binstr;
00068 };
00069 typedef struct WFCSTranslateStruct WFCSTranslator;
00070
00071
00072 STILSignalBlock();
00073
00074
00075 STILSignalBlock(Type);
00076
00077
00078 STILSignalBlock(const STILSignalBlock &);
00079
00080
00081 virtual ~STILSignalBlock();
00082
00083
00084 STILSignalBlock & operator=(const STILSignalBlock &);
00085
00086
00087 void init();
00088
00089
00090 void setTermination(STILTermination);
00091 STILTermination getTermination() const;
00092
00093
00094 void setDefaultState(STILDefaultState);
00095 STILDefaultState getDefaultState() const;
00096
00097
00098 void setBase(STILBase b, const STILWFCS & wfcs);
00099 STILBase getBase() const;
00100 const STILWFCS & getBaseWFCS() const;
00101
00102 LONG getBaseNumBits() const;
00103
00104
00105 void setAlignment(STILAlignment);
00106 STILAlignment getAlignment() const;
00107
00108
00109
00110
00111
00112 void setScanIn(LONG length);
00113 LONG getScanIn() const;
00114
00115
00116
00117
00118
00119 void setScanOut(LONG length);
00120 LONG getScanOut() const;
00121
00122
00123
00124
00125 void setDataBitCount(LONG count);
00126 LONG getDataBitCount() const;
00127
00128
00129 static const sstring & convertTermination(STILTermination);
00130 static const sstring & convertDefaultState(STILDefaultState);
00131 static const sstring & convertBase(STILBase);
00132 static const sstring & convertAlignment(STILAlignment);
00133
00134 void print_vectortrans() const;
00135 void print_vectortrans(std::ofstream& ttofs) const;
00137 char evalTrans (sstring &, LONG ln=0) const ;
00138
00139
00140 protected:
00141
00142
00143 const sstring WFC2Bin(const char) const;
00144
00145 const sstring Bin2WFC(const sstring) const;
00146
00147
00148 STILTermination m_termination;
00149 STILDefaultState m_defaultState;
00150 STILBase m_base;
00151 STILWFCS m_baseWFCS;
00152 STILAlignment m_alignment;
00153 LONG m_scanin;
00154 LONG m_scanout;
00155 LONG m_databitcount;
00156
00157
00158 int m_numbits;
00159 std::vector<WFCSTranslator> m_WFCSTransVec;
00160
00161
00162 };
00163
00164
00165
00166
00174
00175 inline LONG STILSignalBlock::getBaseNumBits() const { return m_numbits; }
00176
00177
00185
00186 inline void STILSignalBlock::setTermination(STILTermination t) {
00187 m_termination = t;
00188 addEntity(Termination,"Termination",convertTermination(t));
00189 }
00190
00191
00199
00200 inline STILTermination STILSignalBlock::getTermination() const { return m_termination; }
00201
00202
00210
00211 inline void STILSignalBlock::setDefaultState(STILDefaultState ds) {
00212 m_defaultState = ds;
00213 addEntity(DefaultState,"DefaultState",convertDefaultState(ds));
00214 }
00215
00216
00224
00225 inline STILSignalBlock::STILDefaultState STILSignalBlock::getDefaultState() const { return m_defaultState; }
00226
00227
00235
00236 inline STILSignalBlock::STILBase STILSignalBlock::getBase() const { return m_base; }
00237
00238
00246
00247 inline const STILWFCS & STILSignalBlock::getBaseWFCS() const { return m_baseWFCS; }
00248
00249
00257
00258 inline void STILSignalBlock::setAlignment(STILAlignment a) {
00259 m_alignment = a;
00260 addEntity(Alignment,"Alignment",convertAlignment(a));
00261 }
00262
00263
00271
00272 inline STILSignalBlock::STILAlignment STILSignalBlock::getAlignment() const { return m_alignment; }
00273
00274
00282
00283 inline void STILSignalBlock::setScanIn(LONG si) {
00284 m_scanin = si;
00285 char tmp[32];
00286 sprintf(tmp,"%d",si);
00287 addEntity(ScanIn,"ScanIn",tmp);
00288 }
00289
00290
00298
00299 inline LONG STILSignalBlock::getScanIn() const { return m_scanin; }
00300
00301
00309
00310 inline void STILSignalBlock::setScanOut(LONG so) {
00311 m_scanout = so;
00312 char tmp[32];
00313 sprintf(tmp,"%d",so);
00314 addEntity(ScanOut,"ScanOut",tmp);
00315 }
00316
00317
00325
00326 inline LONG STILSignalBlock::getScanOut() const { return m_scanout; }
00327
00328
00336
00337 inline void STILSignalBlock::setDataBitCount(LONG dbc) {
00338 m_databitcount = dbc;
00339 char tmp[32];
00340 sprintf(tmp,"%d",dbc);
00341 addEntity(DataBitCount,"DataBitCount",tmp);
00342 }
00343
00344
00352
00353 inline LONG STILSignalBlock::getDataBitCount() const { return m_databitcount; }
00354
00355 inline void destroy(STILSignalBlock::WFCSTranslateStruct*) { }
00356
00357
00358
00359
00360
00361
00362 #endif