00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_DECOMPILER_DECOMPILER_HPP
00017 #define TORC_GENERIC_DECOMPILER_DECOMPILER_HPP
00018
00019 #include <iostream>
00020
00021 #include "torc/generic/om/PointerTypes.hpp"
00022 #include "torc/generic/util/Error.hpp"
00023 #include "torc/generic/decompiler/ObjectVisitor.hpp"
00024 #include "torc/generic/om/VisitorApplier.hpp"
00025 #include "torc/generic/om/Derivation.hpp"
00026
00027 namespace torc {
00028
00029 namespace generic {
00030
00031
00032
00033
00034 class Decompiler : public ObjectVisitor
00035 {
00036 public:
00037 void
00038 visit(Root &inroot) throw(Error);
00039
00040 void
00041 visit(Design &inDesign) throw(Error);
00042
00043 void
00044 visit(Library &inlibrary) throw(Error);
00045
00046 void
00047 visit(Cell &incell) throw(Error);
00048
00049 void
00050 visit(View &inview) throw(Error);
00051
00052 void
00053 visit(ScalarPort &inscalarPort) throw(Error);
00054
00055 void
00056 visit(VectorPort &invectorPort) throw(Error);
00057
00058 void
00059 visit(VectorPortBit &inportBit) throw(Error);
00060
00061 void
00062 visit(PortBundle &inportBundle) throw(Error);
00063
00064 void
00065 visit(ScalarNet &inscalarNet) throw(Error);
00066
00067 void
00068 visit(VectorNet &invectorNet) throw(Error);
00069
00070 void
00071 visit(VectorNetBit &innetBit) throw(Error);
00072
00073 void
00074 visit(NetBundle &innetBundle) throw(Error);
00075
00076 void
00077 visit(SingleInstance &insingleInstance) throw(Error);
00078
00079 void
00080 visit(InstanceArray &ininstanceArray) throw(Error);
00081
00082 void
00083 visit(InstanceArrayMember &ininstanceArray) throw(Error);
00084
00085 void
00086 visit(ScalarPortReference &inScalarPortRef) throw(Error);
00087
00088 void
00089 visit(VectorPortReference &inVectorPortRef) throw(Error);
00090
00091 void
00092 visit(VectorPortBitReference &inVectorPortBitRef) throw(Error);
00093
00094 void
00095 visit(PortBundleReference &inPortBundleRef) throw(Error);
00096
00097 void
00098 visit(SingleParameter &insingleParameter) throw(Error);
00099
00100 void
00101 visit(ParameterArray &inparamArray) throw(Error);
00102
00103 void
00104 visit(ParameterArrayElement &inParamArrayElement) throw(Error);
00105
00106 void
00107 visit(Property &inProperty) throw(Error);
00108
00109 void
00110 visit(PortList &inPortList) throw(Error);
00111
00112 void
00113 visit(PortListAlias &inPortListAlias) throw(Error);
00114
00115 void
00116 visit(Status &inStatus) throw(Error);
00117
00118 void
00119 visit(Permutable &inPermutable) throw(Error);
00120
00121 void
00122 visit(InterfaceJoinedInfo & inInterfaceJoinedInfo) throw(Error);
00123
00124 void
00125 visit(SimulationInfo &simuInfo) throw(Error);
00126
00127 void
00128 visit(Simulate &simulate) throw(Error);
00129
00130 void
00131 visit( Apply & apply ) throw(Error);
00132
00133 void
00134 visit( LogicalResponse & logicalResponse ) throw(Error);
00135
00136 void
00137 visit(LogicValue &logicVal) throw(Error);
00138
00139 void
00140 visit(LogicElement &logicElement) throw(Error);
00141
00142 void
00143 visit(WaveValue & waveValue) throw(Error);
00144
00145 void
00146 visit(Timing & timing) throw(Error);
00147
00148 void
00149 visit(Event & event) throw(Error);
00150
00151 void
00152 visit(ForbiddenEvent & forbiddenevent) throw(Error);
00153
00154 void
00155 printValueType( const Value &value ) throw(Error);
00156
00157 void
00158 printValue( const Value &value ) throw(Error);
00159
00160 void
00161 printUnit( const Unit unit ) throw(Error);
00162
00163 void
00164 printDerivation( const Derivation derivation ) throw(Error);
00165
00166 void
00167 printArray(const std::vector<size_t> &outVector, size_t depth,
00168 std::vector< ParameterSharedPtr >::iterator &itStart,
00169 std::vector< ParameterSharedPtr >::iterator &itEnd) throw(Error);
00170
00171 void
00172 printPortAttributes(
00173 const PortAttributesSharedPtr &inAttrib ) throw(Error);
00174
00175 void
00176 printNetAttributes(
00177 const NetAttributesSharedPtr &inAttrib ) throw(Error);
00178
00179 void
00180 printViewInterfaceAttributes(
00181 const InterfaceAttributesSharedPtr &inAttrib ) throw(Error);
00182
00183 void
00184 printLogicValueAttributes(
00185 const LogicValueAttributesSharedPtr &inAttrib ) throw(Error);
00186
00187 void
00188 printUserData( std::list< std::string > inElements) throw(Error);
00189
00190 void
00191 printComments( std::vector< std::string > & inElements) throw(Error);
00192
00193
00194
00195 void
00196 operator()() throw(Error);
00197
00198
00199
00200
00201
00202
00203 void
00204 decompile() throw(Error);
00205
00206 inline size_t
00207 getIndentation() const throw();
00208
00209 void
00210 setIndentation( size_t inIndentation ) throw();
00211
00212 Decompiler( const RootSharedPtr &inRoot,
00213 std::ostream &outStream = std::cout);
00214
00215 Decompiler(const Decompiler &inSource);
00216
00217 ~Decompiler() throw();
00218
00219 Decompiler &operator=(const Decompiler &inSource);
00220
00221 private:
00222 RootSharedPtr mRoot;
00223 std::ostream &mOut;
00224 bool mIsJoiningContext;
00225 bool mIsPermutableContext;
00226 bool mIsExternContext;
00227 bool mParamAssignContext;
00228 bool mIsPortInstanceContext;
00229 size_t mIndentation;
00230 VisitorApplier<Decompiler> mApplier;
00231 };
00232
00233 inline size_t
00234 Decompiler::getIndentation() const throw()
00235 {
00236 return mIndentation;
00237 }
00238
00239 }
00240
00241 }
00242 #endif // TORC_GENERIC_DECOMPILER_DECOMPILER_HPP