Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

oagFpgaOccGraph.h

Go to the documentation of this file.
00001 
00002 #if !defined(oagFpgaOccGraph_P)
00003 #define oagFpgaOccGraph_P
00004 
00005 #include <stdlib.h>
00006 
00007 #include "oaDesignDB.h"
00008 #include "oagFpgaOccRef.h"
00009 #include "oagFpgaManager.h"
00010 #include "oagFpgaRtlGraph.h"
00011 #include <list>
00012 #include <set>
00013 
00014 using namespace std;
00015 
00016 namespace oagFpga {
00017 
00018 // *****************************************************************************
00019 // OccGraph
00020 //
00046 // *****************************************************************************
00047 
00048 class OccGraph {
00049 
00050   private:
00051         
00052                                    OccGraph();   // this is a purely static
00053                                                  // class and can not be
00054                                                  // instantiated
00055   public:
00056 
00057     typedef set<OccRef> Cut;
00058     typedef list<Cut>   CutSet;
00059 
00062 
00063     static OccRef           getNull(oa::oaOccurrence *occurrence) {
00071         return OccRef(RtlGraph::getNull(), occurrence);
00072     }
00073     static inline bool      isNull(OccRef x) {
00077         return x.occurrence == NULL || RtlGraph::isNull(x.ref);
00078     }
00079     static inline OccRef    constantOne(oa::oaOccurrence *occurrence) {
00083         return OccRef(getGraph(occurrence)->constantOne(), occurrence);
00084     }
00085     static inline OccRef    constantZero(oa::oaOccurrence *occurrence) {
00089         return OccRef(getGraph(occurrence)->constantZero(), occurrence);
00090     }
00091     /*
00092     static inline OccRef notOf(OccRef x) {
00099         return OccRef(oagAi::Graph::notOf(x.ref), x.occurrence);
00100     }
00101     static inline bool       isInverted(OccRef x) {
00105         return oagAi::Graph::isInverted(x.ref);
00106     }
00107     static inline OccRef     getNonInverted(OccRef x) {
00111         return OccRef(oagAi::Graph::getNonInverted(x.ref), x.occurrence);
00112     }
00113     */
00114     
00118 
00119     static inline RtlNode::Type     getNodeType(OccRef x) {
00123         return getGraph(x)->getNodeType(x.ref);
00124     }
00125 
00126     //    on terminal nodes...
00127     static OccRef     getTerminalDriver(OccRef terminal, 
00128                                         bool searchThroughHierarchy = false);
00129     static inline bool       isTerminal(OccRef terminal) {
00133         return getGraph(terminal)->isTerminal(terminal.ref);
00134     }
00135     //    on sequential nodes...
00136     static inline OccRef     getNextState(OccRef sequential) {
00143         assert(isSequential(sequential));
00144         return OccRef(getGraph(sequential)->getNextState(sequential.ref), sequential.occurrence);
00145     }
00146     static inline bool       isSequential(OccRef sequential) {
00150         return getGraph(sequential)->isSequential(sequential.ref);
00151     }
00152     /*
00153     static oagAi::Node::SequentialData *getSequentialData(OccRef sequential) {
00160         return getGraph(sequential)->getSequentialData(sequential.ref);    
00161     }
00162     //    on and nodes...
00163     static inline OccRef     getAndLeft(OccRef x) {
00167         return OccRef(getGraph(x)->getAndLeft(x.ref), x.occurrence);
00168     }
00169     static inline OccRef     getAndRight(OccRef x) {
00173         return OccRef(getGraph(x)->getAndRight(x.ref), x.occurrence);
00174     }
00175     */
00176     
00177     static void              getFanout(OccRef x, list<OccRef> &result);
00178     static inline bool       hasFanout(OccRef x) {
00184         return getGraph(x)->hasFanout(x.ref);
00185     }
00186 
00190 
00191     // Net-to-BBRef connections
00192     static oa::oaOccBitNet *   getNetToBBConnection(OccRef ref);
00193     static OccRef              getNetToBBConnection(oa::oaOccBitNet *net);
00194     
00195     static void                getNetToBBAllEquivConnections(OccRef ref, 
00196                                             list<oa::oaOccBitNet *> &result);
00197     
00201 
00202     static void         getOutputs(oa::oaOccurrence *top, list<OccRef> &result);
00203     static void         getOutputs(oa::oaOccurrence *top, list<oa::oaOccBitNet*> &result);
00204     static void         getInputs(oa::oaOccurrence *top, list<OccRef> &result);
00205     static void         getInputs(oa::oaOccurrence *top, list<oa::oaOccBitNet*> &result);
00206     static void         getStates(oa::oaOccurrence *top, list<OccRef> &result);
00207     static void         getLocalStates(oa::oaOccurrence *top, list<OccRef> &result);
00208     static void         getConstants(oa::oaOccurrence *top, list<OccRef> &zeros, 
00209                                                                 list<OccRef> &ones);
00210 
00211     static void                getAllConnections(oa::oaOccBitNet *net,
00212                                     set<oa::oaOccBitNet*> &connectedNets,
00213                                     set<OccRef> &connectedRefs,
00214                                     bool searchForwardThroughGraph = true,
00215                                     bool searchBackwardThroughGraph = true,
00216                                     bool searchThroughHierarchy = true,
00217                                     bool searchThroughEquivNets = true,
00218                                     bool searchThroughEquivRefs = false,
00219                                     bool includeSelf = true);
00220     static void                getAllConnections(OccRef x, 
00221                                     set<oa::oaOccBitNet*> &connectedNets,
00222                                     set<OccRef> &connectedRefs,
00223                                     bool searchForwardThroughGraph = true,
00224                                     bool searchBackwardThroughGraph = true,
00225                                     bool searchThroughHierarchy = true,                                    
00226                                     bool searchThroughEquivNets = true,
00227                                     bool searchThroughEquivRefs = false,
00228                                     bool includeSelf = true);
00229                                     
00233 
00234     /*
00235     static void         enumerateKfeasibleCuts(OccRef x, unsigned int maxCutSize, CutSet &result);
00236     static void         clearKfeasibleCuts(oa::oaOccurrence *occurrence);
00237     */
00238 
00239     static void         getTransitiveFanin(OccRef x, list<OccRef> &transitiveFanin);
00240     static void         getTransitiveFanout(OccRef x, list<OccRef> &transitiveFanout);
00241     /*
00242     static void         getFaninRoots(OccRef x, list<OccRef> &faninRoots);
00243     static void         getFanoutRoots(OccRef x, list<OccRef> &fanoutRoots);
00244 
00248 
00249     static bool         testEquivalence(OccRef x, OccRef y);
00250     static void         getEquivalents(OccRef x, list<OccRef> &result);
00251 
00252     static void         getFanoutOfEquivalentNodes(OccRef x, list<OccRef> &result);
00253 
00255     */
00256 
00257   private:
00258                        
00259     static inline RtlGraph *   getGraph(oa::oaOccurrence *occurrence) {
00267         return &(Manager::get(occurrence->getModule()->getDesign())->bbg);
00268     }
00269     static inline RtlGraph *   getGraph(const OccRef &x) {
00272         return &(Manager::get(x.occurrence->getModule()->getDesign())->bbg);
00273     }
00274     
00275     static void             convertRefListToOccRefList(const list<BBRef> &source,
00276                                                        oa::oaOccurrence *occurrence,
00277                                                        list<OccRef> &result);
00278 };
00279 
00280 }
00281 
00282 #endif

Generated on Mon Jul 9 14:17:20 2007 for OA Gear Fpga by  doxygen 1.3.9.1