//========================================================================= // $Id$ // //This is the main program for the algorithm presented in WirthlinDAC05 // //TO-DO: // 1. Should be able to parse a .dot file as the algorithm input instead // of creating one by the program //========================================================================= //--------------------------------------------------------------------- // Header files inclusion //--------------------------------------------------------------------- #include #include using namespace std; #include using namespace boost; //--------------------------------------------------------------------- //Interface // An interface for DFG operator types. // // Objects of this class do not show up in DFG (Objects of type Operator are // Nodes within the DFG). OperatorType objects represent a class // of "compatible" operations. // // There will be a notion of relationships between operator types // (i.e. some operatortypes are compatible with others). A partial order. // // Example operator types include Addition, mulitplication, etc. //--------------------------------------------------------------------- class OperatorType { public: virtual string getMnemonic(void); }; //--------------------------------------------------------------------- //Derived class from interface OperatorType //--------------------------------------------------------------------- class BasicOperatorType: public OperatorType{ public: BasicOperatorType(string mnemonic) : _mnemonic(mnemonic) {}; string getMnemonic() {return _mnemonic; } private: string _mnemonic; }; //--------------------------------------------------------------------- //Interface // Represents a specific operator within a DFG. // Objects of this type may appear multiple times within a DFG. // Only operators with "unique" parameters are new objects in DFG. //--------------------------------------------------------------------- class Operator{ public: virtual OperatorType getOperatorType(); }; //--------------------------------------------------------------------- //Derived class from interface Operator //--------------------------------------------------------------------- class BasicOperator : public Operator{ public: BasicOperator() {}; BasicOperator(OperatorType type) : _type(type) {}; BasicOperator(OperatorType type, string cust) : _type(type), _cust(cust) {}; OperatorType getOperatorType(void) { return _type; } private: OperatorType _type; string _cust; }; //--------------------------------------------------------------------- // Global data structures and variables //--------------------------------------------------------------------- static OperatorType portType = BasicOperatorType("Port"); static OperatorType addType = BasicOperatorType("+"); static OperatorType subType = BasicOperatorType("-"); static OperatorType constantType = BasicOperatorType("Const"); static OperatorType constMultType = BasicOperatorType("*c"); static OperatorType multType = BasicOperatorType("X"); static OperatorType delayType = BasicOperatorType("z^-1"); typedef adjacency_list< vecS, vecS, bidirectionalS, BasicOperator> Graph; Graph firGraph(int tapNumber); //--------------------------------------------------------------------- //Function description: // This is the main driver for the algorithm //Input: // None //Output: // A graph showing the scheduling result //--------------------------------------------------------------------- int main(void) { cout << "Algorithm starts..." << endl; //Step 1. Create an 8-tap FIR filter Graph g = firGraph(8); } //--------------------------------------------------------------------- //Function description: // This is a function that creates a FIR filter graph and returns it //Input: // int tap -> tap number //Output: // Graph -> The FIR filter graph //--------------------------------------------------------------------- Graph firGraph(int tapNumber) { Graph fg; return fg; }