diff --git a/docs/bne/classes/index.rst b/docs/bne/classes/index.rst index 4b83e340..fca074ea 100644 --- a/docs/bne/classes/index.rst +++ b/docs/bne/classes/index.rst @@ -6,3 +6,6 @@ BNE classes .. doxygenclass:: naja::BNE::ActionTree :members: + +.. doxygenclass:: naja::BNE::Action + :members: diff --git a/docs/bne/index.rst b/docs/bne/index.rst index 63492bc6..efc1d8b0 100644 --- a/docs/bne/index.rst +++ b/docs/bne/index.rst @@ -4,7 +4,7 @@ BNE .. image:: ../images/Naja-BNE.png Once a DNL representation of the SNL is established, the BNE allows to cache directives from DNL-based algorithms, which are purely computational. -BNE apply these directives to the SNL in an optimized manner, focusing on eliminating redundant unification and enhancing usability for the user. +BNE apply these directives to the SNL in an optimized manner, focusing on eliminating redundant uniquification and enhancing usability for the user. .. toctree:: :maxdepth: 1 diff --git a/docs/images/Naja-Clone.png b/docs/images/Naja-Clone.png new file mode 100644 index 00000000..a1fa13ab Binary files /dev/null and b/docs/images/Naja-Clone.png differ diff --git a/docs/snl/index.rst b/docs/snl/index.rst index 31833d33..871eaeb1 100644 --- a/docs/snl/index.rst +++ b/docs/snl/index.rst @@ -9,6 +9,7 @@ Naja SNL (Structured Netlist) identification.rst classes/index.rst + uniquification.rst snl_cpp_api_examples.rst snl_python_api_examples.rst - primitives.rst \ No newline at end of file + primitives.rst diff --git a/docs/snl/uniquification.rst b/docs/snl/uniquification.rst new file mode 100644 index 00000000..6456a6c0 --- /dev/null +++ b/docs/snl/uniquification.rst @@ -0,0 +1,18 @@ +Uniquification +========= + +.. image:: ../images/Naja-Clone.png + :alt: Naja SNL + +In an hierarchical netlist, there are models who are being used multiple times as implementation for different instances. + +The action of uniquification of an instance means to create a unique model for the context of the instance alone by cloning its original model. + +In order to implement the operations of the BNE(Batch Netlist Editor), we will have to be able to uniquify models as there will be times when we will want to edit a specific context without affecting the rest of the instances of the current model. + +In order to enable uniquification in SNL, we are providing 2 APIs: + + 1) clone() API for SNLDesign. + 2) setModel(SNLModel* model) for SNLInstance. + +These 2 APIs are the atomic actions that together can implement Uniquification. diff --git a/src/bne/ActionTree.h b/src/bne/ActionTree.h index 36009aab..825b1711 100644 --- a/src/bne/ActionTree.h +++ b/src/bne/ActionTree.h @@ -172,54 +172,54 @@ class ActionTree { public: /** * \brief Create an ActionTree. - * \param blockNormalization true if the normalization is blocked. - * \param keepOrder true if the order is kept. - * \return the created ActionTree. + * \param blockNormalization True if the normalization is blocked. + * \param keepOrder True if the order is kept. + * \return The created ActionTree. */ ActionTree(bool blockNormalization = false, bool keepOrder = false); /** - * \brief get the node for the context. - * \param context the context of the node. - * \return the node for the context. + * \brief Get the node for the context. + * \param context The context of the node. + * \return The node for the context. */ ActionTreeNode* getNodeForContext( const std::vector& context); /** - * \brief add a node childe for the context path. - * \param context the context of the node. - * \return the node for the context. + * \brief Add a node childe for the context path. + * \param context The context of the node. + * \return The node for the context. */ ActionTreeNode& addHierChild( const std::vector& context); /** - * \brief add a node childe for the context path. - * \param context the context of the node. - * \return the node for the context. + * \brief Add a node childe for the context path. + * \param context The context of the node. + * \return The node for the context. */ void addAction(Action* action); /** - * \brief normalize the tree. + * \brief Normalize the tree. */ void normalize(); /** - * \brief get the root of the tree. - * \return the root of the tree. + * \brief Get the root of the tree. + * \return The root of the tree. */ ActionTreeNode& getRoot() { return nodes_[0]; } /** - * \brief get the node of the id. - * \param id the id of the node. - * \return the node of the id. + * \brief Get the node of the id. + * \param id The id of the node. + * \return The node of the id. */ ActionTreeNode& getNode(size_t id) { return nodes_[id]; } /** - * \brief process the tree. + * \brief Process the tree. */ void process(); /** - * \brief get the action of the id. - * \param id the id of the action. - * \return the action of the id. + * \brief Get the action of the id. + * \param id The id of the action. + * \return The action of the id. */ Action* getAction(size_t id) { return actions_[id]; } // Destructor that releases all the actions diff --git a/src/bne/actions.h b/src/bne/actions.h index ae3816f8..dad00bf5 100644 --- a/src/bne/actions.h +++ b/src/bne/actions.h @@ -22,10 +22,27 @@ enum ActionType { DELETE, DRIVE_WITH_CONSTANT, REDUCTION, NONE }; class Action { public: + /** + * \brief Create an Action. + * \param type The type of the action. + * \return The created Action. + */ Action(ActionType type) : type_(type) {} + /** + * \brief Process the action on the context. + * \param design The design to process the action on. + */ virtual void processOnContext(SNLDesign* design) = 0; + /** + * \brief Get the type of the action. + * \return The type of the action. + */ ActionType getType() const { return type_; } // get context + /** + * \brief Get the context of the action. + * \return The context of the action. + */ virtual const std::vector& getContext() const = 0; // comparator virtual bool operator==(const Action& action) const = 0; diff --git a/src/bne/bne.h b/src/bne/bne.h index 4b8b3795..285ffedd 100644 --- a/src/bne/bne.h +++ b/src/bne/bne.h @@ -13,19 +13,21 @@ class BNE { public: /** * \brief Create a BNE. - * \param blockNormalization true if the normalization is blocked. - * \param blockOptimization true if the optimization is blocked. + * \param blockNormalization True if the normalization is blocked. + * \param blockOptimization True if the optimization is blocked. */ BNE(bool blockNormalization = false, bool blockOptimization = false) : tree_(blockNormalization, blockOptimization) {} /** - * \brief add a delete action to the BNE. - * \param pathToDelete the path to delete. + * \brief Add a delete action to the BNE. + * \param pathToDelete The path to delete. */ void addDeleteAction(const std::vector& pathToDelete); /** - * \brief add a delete action to the BNE. - * \param pathToDelete the path to delete. + * \brief Add a drive with constant action to the BNE. + * \param pathToDrive The context. + * \param termToDrive The term to drive. + * \param value The value to drive. */ void addDriveWithConstantAction( const std::vector& context, @@ -34,16 +36,17 @@ class BNE { const double& value, SNLBitTerm* topTermToDrive = nullptr); /** - * \brief add a delete action to the BNE. - * \param pathToDelete the path to delete. + * \brief Add a reduction action to the BNE. + * \param context The context. + * \param instance The instance that can be reduced. + * \param result The interface reduction needed. */ void addReductionCommand( const std::vector& context, SNLID::DesignObjectID instance, const std::pair& result); /** - * \brief add a delete action to the BNE. - * \param pathToDelete the path to delete. + * \brief Process the commands. */ void process(); private: diff --git a/src/dnl/DNL.h b/src/dnl/DNL.h index 57052f98..e868386c 100644 --- a/src/dnl/DNL.h +++ b/src/dnl/DNL.h @@ -85,72 +85,72 @@ class DNLInstanceFull { DNLInstanceFull() = default; /** * \brief Create a DNLInstanceFull. - * \param instance the SNLInstsance. + * \param instance The SNLInstsance. * \param id DNL ID of the DNLInstance. * \param parent DNL ID of the parent DNLInstance. * \return the created DNLInstanceFull. */ DNLInstanceFull(SNLInstance* instance, DNLID id, DNLID parent); /** - * \brief display content of the DNLInstanceFull. + * \brief Display content of the DNLInstanceFull. */ void display() const; /** - * \brief get the DNL ID of the DNLInstanceFull. - * \return the DNL ID of the DNLInstanceFull. + * \brief Get the DNL ID of the DNLInstanceFull. + * \return The DNL ID of the DNLInstanceFull. */ DNLID getID() const; /** - * \brief get the SNLInstance of the DNLInstanceFull. - * \return the SNLInstance of the DNLInstanceFull. + * \brief Get the SNLInstance of the DNLInstanceFull. + * \return The SNLInstance of the DNLInstanceFull. */ std::string getFullPath() const; /** - * \brief get the parent DNL ID of the DNLInstanceFull. - * \return the parent DNL ID of the DNLInstanceFull. + * \brief Get the parent DNL ID of the DNLInstanceFull. + * \return The parent DNL ID of the DNLInstanceFull. */ DNLID getParentID() const; /** - * \brief get the DNLInstanceFull of the parent DNLInstanceFull. - * \return the DNLInstanceFull of the parent DNLInstanceFull. + * \brief Get the DNLInstanceFull of the parent DNLInstanceFull. + * \return The DNLInstanceFull of the parent DNLInstanceFull. */ const DNLInstanceFull& getParentInstance() const; /** - * \brief get the SNLInstance of the DNLInstanceFull. - * \return the SNLInstance of the DNLInstanceFull. + * \brief Get the SNLInstance of the DNLInstanceFull. + * \return The SNLInstance of the DNLInstanceFull. */ SNLInstance* getSNLInstance() const; /** - * \brief get the SNLDesign of the DNLInstanceFull. - * \return the SNLDesign of the DNLInstanceFull. + * \brief Get the SNLDesign of the DNLInstanceFull. + * \return The SNLDesign of the DNLInstanceFull. */ const SNLDesign* getSNLModel() const; /** - * \brief set the DNL ID of instancde terms. - * \param termsIndexes the DNL ID of instance terms. + * \brief Set the DNL ID of instancde terms. + * \param termsIndexes The DNL ID of instance terms. */ void setTermsIndexes(const std::pair& termsIndexes); /** - * \brief set the DNL ID of children instances. - * \param childrenIndexes the DNL ID of children instances. + * \brief Set the DNL ID of children instances. + * \param childrenIndexes The DNL ID of children instances. */ void setChildrenIndexes(const std::pair& childrenIndexes); /** - * \brief get the DNLInstanceFull of the child snlInstance. - * \param snlInst the SNLInstance of the child DNLInstanceFull. - * \return the DNLInstanceFull of the snlInst in current context. + * \brief Get the DNLInstanceFull of the child snlInstance. + * \param snlInst The SNLInstance of the child DNLInstanceFull. + * \return The DNLInstanceFull of the snlInst in current context. */ const DNLInstanceFull& getChildInstance(const SNLInstance* snlInst) const; /** - * \brief get the DNLTerminalFull by the SNLInstTerm. - * \param snlTerm the SNLInstTerm of the DNLTerminalFull. - * \return the DNLTerminalFull of the snlTerm in current context. + * \brief Get the DNLTerminalFull by the SNLInstTerm. + * \param snlTerm The SNLInstTerm of the DNLTerminalFull. + * \return The DNLTerminalFull of the snlTerm in current context. */ const DNLTerminalFull& getTerminal(const SNLInstTerm* snlTerm) const; /** - * \brief get the DNLTerminalFull by the SNLBiterm. - * \param snlTerm the SNLBitTerm of the DNLTerminalFull. - * \return the DNLTerminalFull of the snlTerm in current context. + * \brief Get the DNLTerminalFull by the SNLBiterm. + * \param snlTerm The SNLBitTerm of the DNLTerminalFull. + * \return The DNLTerminalFull of the snlTerm in current context. */ const DNLTerminalFull& getTerminalFromBitTerm( const SNLBitTerm* snlTerm) const; @@ -158,21 +158,21 @@ class DNLInstanceFull { return termsIndexes_; } /** - * \brief check if the DNLInstanceFull is null. - * \return true if the DNLInstanceFull is null. + * \brief Check if the DNLInstanceFull is null. + * \return True if the DNLInstanceFull is null. */ bool isNull() const { return id_ == (DNLID)DNLID_MAX; } /** - * \brief check if the DNLInstanceFull is top. - * \return true if the DNLInstanceFull is top. + * \brief Check if the DNLInstanceFull is top. + * \return True if the DNLInstanceFull is top. */ bool isTop() const { return parent_ == (DNLID)DNLID_MAX; } const std::pair& getChildren() const { return childrenIndexes_; } /** - * \brief check if the DNLInstanceFull is leaf. - * \return true if the DNLInstanceFull is leaf. + * \brief Check if the DNLInstanceFull is leaf. + * \return True if the DNLInstanceFull is leaf. */ bool isLeaf() const { return childrenIndexes_.first == childrenIndexes_.second; @@ -197,54 +197,54 @@ class DNLTerminalFull { /** * \brief Create a DNLTerminalFull. * \param DNLInstID DNL ID of the DNLInstanceFull. - * \param terminal the SNLInstTerm of the DNLTerminalFull. + * \param terminal The SNLInstTerm of the DNLTerminalFull. * \param id DNL ID of the DNLTerminalFull. */ DNLTerminalFull(DNLID DNLInstID, SNLInstTerm* terminal, DNLID id); /** * \brief Create a DNLTerminalFull. * \param DNLInstID DNL ID of the DNLInstanceFull. - * \param terminal the SNLBitTerm of the DNLTerminalFull. + * \param terminal The SNLBitTerm of the DNLTerminalFull. * \param id DNL ID of the DNLTerminalFull. */ DNLTerminalFull(DNLID DNLInstID, SNLBitTerm* terminal, DNLID id); /** - * \brief display content of the DNLTerminalFull. + * \brief Display content of the DNLTerminalFull. */ DNLID getID() const; /** - * \brief get the SNLInstTerm of the DNLTerminalFull. - * \return the SNLInstTerm of the DNLTerminalFull. + * \brief Get the SNLInstTerm of the DNLTerminalFull. + * \return The SNLInstTerm of the DNLTerminalFull. */ SNLInstTerm* getSnlTerm() const; /** - * \brief get the SNLBitTerm of the DNLTerminalFull. - * \return the SNLBitTerm of the DNLTerminalFull. + * \brief Get the SNLBitTerm of the DNLTerminalFull. + * \return The SNLBitTerm of the DNLTerminalFull. */ SNLBitTerm* getSnlBitTerm() const; /** - * \brief get the DNLInstanceFull of the DNLTerminalFull. - * \return the DNLInstanceFull of the DNLTerminalFull. + * \brief Get the DNLInstanceFull of the DNLTerminalFull. + * \return The DNLInstanceFull of the DNLTerminalFull. */ const DNLInstanceFull& getDNLInstance() const; /** - * \brief check if the DNLTerminalFull is null. - * \return true if the DNLTerminalFull is null. + * \brief Check if the DNLTerminalFull is null. + * \return True if the DNLTerminalFull is null. */ bool isNull() const { return id_ == (DNLID)DNLID_MAX; } /** - * \brief set the DNL ID of the DNLTerminalFull. - * \param id the DNL ID of the DNLTerminalFull. + * \brief Set the DNL ID of the DNLTerminalFull. + * \param id The DNL ID of the DNLTerminalFull. */ void setIsoID(DNLID isoID); /** - * \brief get the DNL ID of the DNLTerminalFull. - * \return the DNL ID of the DNLTerminalFull. + * \brief Get the DNL ID of the DNLTerminalFull. + * \return The DNL ID of the DNLTerminalFull. */ DNLID getIsoID() const; /** - * \brief check if the DNLTerminalFull is top port. - * \return true if the DNLTerminalFull is top port. + * \brief Check if the DNLTerminalFull is top port. + * \return True if the DNLTerminalFull is top port. */ bool isTopPort() const { return terminal_ == nullptr; } @@ -259,57 +259,57 @@ class DNLIso { public: DNLIso(DNLID id = DNLID_MAX); /** - * \brief clear the DNLIso. + * \brief Clear the DNLIso. */ void clear() { drivers_.clear(); readers_.clear(); } /** - * \brief set the DNL ID of the DNLIso. - * \param id the DNL ID of the DNLIso. + * \brief Set the DNL ID of the DNLIso. + * \param id The DNL ID of the DNLIso. */ void setId(DNLID id) { id_ = id; } /** - * \brief add a driver to the DNLIso. - * \param driver the DNL ID of the driver. + * \brief Add a driver to the DNLIso. + * \param driver The DNL ID of the driver. */ virtual void addDriver(DNLID driver); /** - * \brief add a reader to the DNLIso. - * \param reader the DNL ID of the reader. + * \brief Add a reader to the DNLIso. + * \param reader The DNL ID of the reader. */ virtual void addReader(DNLID reader); /** - * \brief add a hier term to the DNLIso. - * \param hier the DNL ID of the hier term. + * \brief Add a hier term to the DNLIso. + * \param hier The DNL ID of the hier term. */ virtual void addHierTerm(DNLID hier) {} /** - * \brief add a net to the DNLIso. - * \param net the SNLBitNet of the net. + * \brief Add a net to the DNLIso. + * \param net The SNLBitNet of the net. */ virtual void addNet(SNLBitNet* net) {} /** - * \brief display content of the DNLIso. + * \brief Display content of the DNLIso. */ virtual void display(std::ostream& stream = std::cout) const; /** - * \brief get the DNL ID of the DNLIso. - * \return the DNL ID of the DNLIso. + * \brief Get the DNL ID of the DNLIso. + * \return The DNL ID of the DNLIso. */ virtual DNLID getIsoID() const { return id_; } /** - * \brief get the drivers of the DNLIso. - * \return the drivers of the DNLIso. + * \brief Get the drivers of the DNLIso. + * \return The drivers of the DNLIso. */ virtual const std::vector>& getDrivers() const { return drivers_; } /** - * \brief get the readers of the DNLIso. - * \return the readers of the DNLIso. + * \brief Get the readers of the DNLIso. + * \return The readers of the DNLIso. */ virtual const std::vector>& getReaders() const { @@ -342,68 +342,68 @@ class DNLIsoDB { */ DNLIsoDB(); /** - * \brief display content of the DNLIsoDB. + * \brief Display content of the DNLIsoDB. */ void display() const; /** - * \brief add a DNLIso to the DNLIsoDB. - * \return the added DNLIso. + * \brief Add a DNLIso to the DNLIsoDB. + * \return The added DNLIso. */ DNLIso& addIso(); /** - * \brief get the DNLIso from the DNL ID. - * \param isoID the DNL ID of the DNLIso. - * \return the DNLIso of the isoID. + * \brief Get the DNLIso from the DNL ID. + * \param isoID The DNL ID of the DNLIso. + * \return The DNLIso of the isoID. */ DNLIso& getIsoFromIsoID(DNLID isoID) { return isos_[isoID]; } /** - * \brief get the DNLIso from the DNL ID. - * \param isoID the DNL ID of the DNLIso. - * \return the DNLIso of the isoID. + * \brief Get the DNLIso from the DNL ID. + * \param isoID The DNL ID of the DNLIso. + * \return The DNLIso of the isoID. */ const DNLIso& getIsoFromIsoIDconst(DNLID isoID) const { if (isoID == DNLID_MAX) {return isos_.back();} return isos_[isoID]; } /** - * \brief get the number of DNLIso in the DNLIsoDB. - * \return the number of DNLIso in the DNLIsoDB. + * \brief Get the number of DNLIso in the DNLIsoDB. + * \return The number of DNLIso in the DNLIsoDB. */ size_t getNumIsos() const { return isos_.size() - 1/* due to null iso*/; } /** - * \brief get the number of non empty DNLIso in the DNLIsoDB. - * \return the number of non empty DNLIso in the DNLIsoDB. + * \brief Get the number of non empty DNLIso in the DNLIsoDB. + * \return The number of non empty DNLIso in the DNLIsoDB. */ size_t getNumNonEmptyIsos() const { return isos_.size() - 1/* due to null iso*/ - shadowIsos_.size(); } /** - * \brief get the number of DNLIso in the DNLIsoDB. - * \return the number of DNLIso in the DNLIsoDB. + * \brief Get the number of DNLIso in the DNLIsoDB. + * \return The number of DNLIso in the DNLIsoDB. */ std::vector getFullIso(DNLID); /** - * \brief clear the DNLIsoDB. + * \brief Clear the DNLIsoDB. */ void emptyIsos() { isos_.clear();} /** - * \brief add a shadow DNLIso to the DNLIsoDB. - * \param isoid the DNL ID of the shadow DNLIso. + * \brief Add a shadow DNLIso to the DNLIsoDB. + * \param isoid The DNL ID of the shadow DNLIso. */ void makeShadow(DNLID isoid) { getIsoFromIsoID(isoid).clear(); shadowIsos_.push_back(isoid); } /** - * \brief add a constant 0 DNLIso to the DNLIsoDB. - * \param isoid the DNL ID of the constant 0 DNLIso. + * \brief Add a constant 0 DNLIso to the DNLIsoDB. + * \param isoid The DNL ID of the constant 0 DNLIso. */ void addConstant0Iso(DNLID isoid) { constant0Isos_.insert(isoid); } /** - * \brief get the constant 0 DNLIso in the DNLIsoDB. - * \return the constant 0 DNLIso in the DNLIsoDB. + * \brief Get the constant 0 DNLIso in the DNLIsoDB. + * \return The constant 0 DNLIso in the DNLIsoDB. */ const std::set& getConstant0Isos() const { return constant0Isos_; } /** - * \brief add a constant 1 DNLIso to the DNLIsoDB. - * \param isoid the DNL ID of the constant 1 DNLIso. + * \brief Add a constant 1 DNLIso to the DNLIsoDB. + * \param isoid The DNL ID of the constant 1 DNLIso. */ void addConstant1Iso(DNLID isoid) { constant1Isos_.insert(isoid); } /** - * \brief get the constant 1 DNLIso in the DNLIsoDB. - * \return the constant 1 DNLIso in the DNLIsoDB. + * \brief Get the constant 1 DNLIso in the DNLIsoDB. + * \return The constant 1 DNLIso in the DNLIsoDB. */ const std::set& getConstant1Isos() const { return constant1Isos_; } private: @@ -418,39 +418,39 @@ class DNLIsoDBBuilder { public: /** * \brief Create a DNLIsoDBBuilder. - * \param db the DNLIsoDB to build. - * \param dnl the DNL to build the DNLIsoDB. + * \param db The DNLIsoDB to build. + * \param dnl The DNL to build the DNLIsoDB. */ DNLIsoDBBuilder(DNLIsoDB& db, const DNL& dnl); /** - * \brief treat the driver of the DNLTerminal. - * \param term the DNLTerminal to treat. - * \param DNLIso the DNLIso to update. - * \param visitedDB the visited terms. - * \param updateReadersIsoID update the readers iso ID. - * \param updateDriverIsoID update the driver iso ID. - * \param updateConst update the constant iso. + * \brief Treat the driver of the DNLTerminal. + * \param term The DNLTerminal to treat. + * \param DNLIso The DNLIso to update. + * \param visitedDB The visited terms. + * \param updateReadersIsoID Update the readers iso ID. + * \param updateDriverIsoID Update the driver iso ID. + * \param updateConst Update the constant iso. */ void treatDriver(const DNLTerminal& term, DNLIso& DNLIso, visited& visitedDB, bool updateReadersIsoID = false, bool updateDriverIsoID = false, bool updateConst = false); /** - * \brief process the DNLIsoDBBuilder. + * \brief Process the DNLIsoDBBuilder. */ void process(); private: /** - * \brief register a constant 0 DNLIso to the DNLIsoDB. - * \param isoid the DNL ID of the DNLIso. + * \brief Register a constant 0 DNLIso to the DNLIsoDB. + * \param isoid The DNL ID of the DNLIso. */ void addConstantIso0(DNLID iso) { db_.addConstant0Iso(iso); } /** - * \brief register a constant 1 DNLIso to the DNLIsoDB. - * \param isoid the DNL ID of the DNLIso. + * \brief Register a constant 1 DNLIso to the DNLIsoDB. + * \param isoid The DNL ID of the DNLIso. */ void addConstantIso1(DNLID iso) { db_.addConstant1Iso(iso); } /** - * \brief add a DNLIso to the DNLIsoDB. - * \return the added DNLIso. + * \brief Add a DNLIso to the DNLIsoDB. + * \return The added DNLIso. */ DNLIso& addIsoToDB() { return db_.addIso(); } DNLIsoDB& db_; @@ -462,50 +462,50 @@ class DNL { public: /** * \brief Create a DNL. - * \param top the SNLDesign of the DNL. + * \param top The SNLDesign of the DNL. */ DNL(const SNLDesign* top); /** - * \brief process the DNL. + * \brief Process the DNL. */ void process(); /** - * \brief display content of the DNL. + * \brief Display content of the DNL. */ void display() const; /** - * \brief get the custom iso for isoid. - * \param dnlIsoId the DNL ID of the DNLIso. - * \param DNLIso the DNLIso to update. + * \brief Get the custom iso for isoid. + * \param dnlIsoId The DNL ID of the DNLIso. + * \param DNLIso The DNLIso to update. */ void getCustomIso(DNLID dnlIsoId, DNLIso& DNLIso) const; /** - * \brief get the DNLInstances of the DNL. - * \return the DNLInstances of the DNL. + * \brief Get the DNLInstances of the DNL. + * \return The DNLInstances of the DNL. */ const std::vector>& getDNLInstances() const { return DNLInstances_; } /** - * \brief get the leaves of the DNL. - * \return the DNLInstances leaves of the DNL. + * \brief Get the leaves of the DNL. + * \return The DNLInstances leaves of the DNL. */ const std::vector>& getLeaves() { return leaves_; } /** - * \brief get the DNLTerms of the DNL. - * \return the DNLTerms of the DNL. + * \brief Get the DNLTerms of the DNL. + * \return The DNLTerms of the DNL. */ const std::vector>& getDNLTerms() const { return DNLTerms_; } /** - * \brief get the DNLTerminal from the DNL ID. - * \param id the DNL ID of the DNLTerminal. - * \return the DNLTerminal of the id. + * \brief Get the DNLTerminal from the DNL ID. + * \param id The DNL ID of the DNLTerminal. + * \return The DNLTerminal of the id. */ const DNLTerminal& getDNLTerminalFromID(DNLID id) const { if (id == DNLID_MAX) { @@ -514,9 +514,9 @@ class DNL { return DNLTerms_[id]; } /** - * \brief get the DNLTerminal from the DNL ID. - * \param id the DNL ID of the DNLTerminal. - * \return the DNLTerminal of the id. + * \brief Get the DNLTerminal from the DNL ID. + * \param id The DNL ID of the DNLTerminal. + * \return The DNLTerminal of the id. */ DNLTerminal& getNonConstDNLTerminalFromID(DNLID id) { if (id == DNLID_MAX) { @@ -525,9 +525,9 @@ class DNL { return DNLTerms_[id]; } /** - * \brief get the DNLInstance from the DNL ID. - * \param id the DNL ID of the DNLInstance. - * \return the DNLInstance of the id. + * \brief Get the DNLInstance from the DNL ID. + * \param id The DNL ID of the DNLInstance. + * \return The DNLInstance of the id. */ const DNLInstance& getDNLInstanceFromID(DNLID id) const { if (id == DNLID_MAX) { @@ -536,9 +536,9 @@ class DNL { return DNLInstances_[id]; } /** - * \brief get the DNLInstance from the DNL ID. - * \param id the DNL ID of the DNLInstance. - * \return the DNLInstance of the id. + * \brief Get the DNLInstance from the DNL ID. + * \param id The DNL ID of the DNLInstance. + * \return The DNLInstance of the id. */ DNLInstance& getNonConstDNLInstanceFromID(DNLID id) { if (id == DNLID_MAX) { @@ -548,32 +548,32 @@ class DNL { } const DNLTerminal& getDNLNullTerminal() const { return DNLTerms_.back(); } /** - * \brief get the number of terms in the DNL. - * \return the number of terms in the DNL. + * \brief Get the number of terms in the DNL. + * \return The number of terms in the DNL. */ DNLID getNBterms() const { return DNLTerms_.size() - 1; } const DNLInstance& getDNLNullInstance() const { return DNLInstances_.back(); } /** - * \brief get the DNLIsoDB of the DNL. - * \return the DNLIsoDB of the DNL. + * \brief Get the DNLIsoDB of the DNL. + * \return The DNLIsoDB of the DNL. */ const DNLIsoDB& getDNLIsoDB() const { return fidb_; } /** - * \brief get number of leaves under parent DNLinstance. - * \param parent the DNL ID of the parent DNLInstance. - * \return the number of leaves under parent DNLinstance. + * \brief Get number of leaves under parent DNLinstance. + * \param parent The DNL ID of the parent DNLInstance. + * \return The number of leaves under parent DNLinstance. */ std::vector getLeavesUnder(DNLID parent) const; /** - * \brief get the top DNLInstance of the DNL. - * \return the top DNLInstance of the DNL. + * \brief Get the top DNLInstance of the DNL. + * \return The top DNLInstance of the DNL. */ const DNLInstance& getTop() const { return DNLInstances_[0]; } /** - * \brief check if the DNLInstance is child of the parent DNLInstance. - * \param parent the DNL ID of the parent DNLInstance. - * \param child the DNL ID of the child DNLInstance. - * \return true if the DNLInstance is child of the parent DNLInstance. + * \brief Check if the DNLInstance is child of the parent DNLInstance. + * \param parent The DNL ID of the parent DNLInstance. + * \param child The DNL ID of the child DNLInstance. + * \return True if the DNLInstance is child of the parent DNLInstance. */ bool isInstanceChild(DNLID parent, DNLID child) const; std::vector> getLeaves() const { @@ -583,18 +583,18 @@ class DNL { termId2isoId_ = std::vector(DNLTerms_.size(), DNLID_MAX); } /** - * \brief set the iso ID for the term ID. - * \param isoId the DNL ID of the DNLIso. - * \param termId the DNL ID of the DNLTerminal. + * \brief Set the iso ID for the term ID. + * \param isoId The DNL ID of the DNLIso. + * \param termId The DNL ID of the DNLTerminal. */ void setIsoIdforTermId(DNLID isoId, DNLID termId) { assert(termId < termId2isoId_.size()); termId2isoId_[termId] = isoId; } /** - * \brief get the iso ID for the term ID. - * \param termId the DNL ID of the DNLTerminal. - * \return the DNL ID of the DNLIso. + * \brief Get the iso ID for the term ID. + * \param termId The DNL ID of the DNLTerminal. + * \return The DNL ID of the DNLIso. */ DNLID getIsoIdfromTermId(DNLID termId) const { if (termId < termId2isoId_.size()) { @@ -603,8 +603,8 @@ class DNL { return DNLID_MAX; } /** - * \brief get the top SNLDesign of the DNL. - * \return the top SNLDesign of the DNL. + * \brief Get the top SNLDesign of the DNL. + * \return The top SNLDesign of the DNL. */ const SNLDesign* getTopDesign() const { return top_; } diff --git a/src/snl/snl/kernel/SNLDesign.h b/src/snl/snl/kernel/SNLDesign.h index 3bd524da..d74333bb 100644 --- a/src/snl/snl/kernel/SNLDesign.h +++ b/src/snl/snl/kernel/SNLDesign.h @@ -239,9 +239,31 @@ class SNLDesign final: public SNLObject { ///\return true if this SNLDesign is a top design. bool isTopDesign() const; + /** + * \brief Cloning interface for SNLDesign. + * \param name SNLName of the the clone. + * \return a new SNLDesign with the same interface as this SNLDesign. + */ SNLDesign* cloneInterface(const SNLName& name=SNLName()) const; + /** + * \brief Cloning interface for SNLDesign to a specific SNLLibrary. + * \param library SNLLibrary where the clone will be created. + * \param name SNLName of the the clone. + * \return a new SNLDesign with the same interface as this SNLDesign. + */ SNLDesign* cloneInterfaceToLibrary(SNLLibrary* library, const SNLName& name=SNLName()) const; + /** + * \brief Cloning for SNLDesign. + * \param name SNLName of the the clone. + * \return a new SNLDesign with the same interface and content as this SNLDesign. + */ SNLDesign* clone(const SNLName& name=SNLName()) const; + /** + * \brief Cloning for SNLDesign to a specific SNLLibrary. + * \param library SNLLibrary where the clone will be created. + * \param name SNLName of the the clone. + * \return a new SNLDesign with the same interface and content as this SNLDesign. + */ SNLDesign* cloneToLibrary(SNLLibrary* library, const SNLName& name=SNLName()) const; class CompareType { diff --git a/src/snl/snl/kernel/SNLInstance.h b/src/snl/snl/kernel/SNLInstance.h index 09f627c7..d77bee36 100644 --- a/src/snl/snl/kernel/SNLInstance.h +++ b/src/snl/snl/kernel/SNLInstance.h @@ -138,6 +138,10 @@ class SNLInstance final: public SNLDesignObject { SNLNet* net, SNLID::Bit netMSB, SNLID::Bit netLSB); + /** + * \brief Seting new model for this instance. + * \param newModel new model for this instance. + */ void setModel(SNLDesign* newModel); SNLID::DesignObjectID getOrderID() const { return orederID_; }