⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ntklatch.c

📁 主要进行大规模的电路综合
💻 C
字号:
/**CFile****************************************************************  FileName    [ntkLatch.c]  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]  Synopsis    [Latch handing functions.]  Author      [MVSIS Group]    Affiliation [UC Berkeley]  Date        [Ver. 1.0. Started - February 1, 2003.]  Revision    [$Id: ntkLatch.c,v 1.22 2003/05/27 23:14:22 alanmi Exp $]***********************************************************************/#include "ntkInt.h"///////////////////////////////////////////////////////////////////////////                        DECLARATIONS                              //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////                     FUNCTION DEFITIONS                           ////////////////////////////////////////////////////////////////////////////**Function*************************************************************  Synopsis    [Creates the new latch with the given parameters.]  Description [The network is where the latch belongs. The node  represents the reset condition of the latch. If may have fanins   (the inputs of the latch reset table) but it cannot have the fanouts.  The names are the char strings of the input and the output nodes of the   latch. The latch input and output should be the already existent nodes  in the network. If the latch input/output in an internal node (rather  than the PO/PI of the network), a new PO/PI is created, which is marked   as "latch only" in the subtype field (pNode->Subtype). Latches should   be added to the network after all other nodes have already been added.]                 SideEffects []  SeeAlso     []***********************************************************************/Ntk_Latch_t * Ntk_LatchCreate( Ntk_Network_t * pNet, Ntk_Node_t * pNode, char * pNameInput, char * pNameOutput ){    Ntk_Node_t * pInput, * pOutput;    Ntk_Latch_t * pLatch;    // check if latch input/output already exist as PIs/POs    pInput = Ntk_NetworkFindNodeByName( pNet, pNameInput );    assert( pInput->Type == MV_NODE_INT );    pOutput = Ntk_NetworkFindNodeByName( pNet, pNameOutput );    assert( pOutput->Type == MV_NODE_CI );    // create a new latch    pLatch = (Ntk_Latch_t *)memManFixedEntryFetch( pNet->pManNode );    // clean the memory    memset( pLatch, 0, sizeof(Ntk_Latch_t) );    pLatch->pNet    = pNet;    pLatch->pInput  = pInput;    pLatch->pOutput = pOutput;    pLatch->pNode   = pNode;    return pLatch;}/**Function*************************************************************  Synopsis    [Duplicates the latch.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/Ntk_Latch_t * Ntk_LatchDup( Ntk_Network_t * pNet, Ntk_Latch_t * pLatch ){    Ntk_Latch_t * pLatchNew;    Ntk_Node_t * pInput, * pOutput;    // check if latch input/output already exist as PIs/POs    pInput = Ntk_NetworkFindNodeByName( pNet, pLatch->pInput->pName );    assert( pInput->Type == MV_NODE_CO );    pOutput = Ntk_NetworkFindNodeByName( pNet, pLatch->pOutput->pName );    assert( pOutput->Type == MV_NODE_CI );    // create a new latch    pLatchNew = (Ntk_Latch_t *)memManFixedEntryFetch( pNet->pManNode );    // clean the memory    memset( pLatchNew, 0, sizeof(Ntk_Latch_t) );    pLatchNew->pNet    = pNet;    pLatchNew->pInput  = pLatch->pInput;    pLatchNew->pOutput = pLatch->pOutput;    pLatchNew->pNode   = Ntk_NodeDup( pNet, pLatch->pNode );    // save the pointer to this latch in the old latch    pLatch->pData = (char *)pLatchNew;    return pLatchNew;}/**Function*************************************************************  Synopsis    [Deletes the latch.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/void Ntk_LatchDelete( Ntk_Latch_t * pLatch ){    // remove the latch node    if ( pLatch->pNode )    {        // remove functionality        Fnc_FunctionDelete( Ntk_NodeReadFunc(pLatch->pNode) );        // recycle the node        Ntk_NodeRecycle( pLatch->pNet, pLatch->pNode );    }    // recycle the latch (memory-wise, it is the same as the node)    Ntk_NodeRecycle( pLatch->pNet, (Ntk_Node_t *)pLatch );}/**Function*************************************************************  Synopsis    [Adjusts the latch input after the CO nodes have been added.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/void Ntk_LatchAdjustInput( Ntk_Network_t * pNet, Ntk_Latch_t * pLatch ){    Ntk_Node_t * pFanout;    Ntk_Pin_t * pPin;    if ( pLatch->pInput->pName == NULL )    {        Ntk_NodeForEachFanout( pLatch->pInput, pPin, pFanout )            if ( Ntk_NodeIsCo(pFanout) )            {                pLatch->pInput = pFanout;                break;            }        assert( pLatch->pInput->pName );    }}/**Function*************************************************************  Synopsis    [Adds a new latch to the network.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/void Ntk_NetworkAddLatch( Ntk_Network_t * pNet, Ntk_Latch_t * pLatch ){    // TO DO: create the hash table of latches and add the latch to it    // TO DO: make sure the latch with this I/O does not exist    // add the latch to the linked list of latches    Ntk_NetworkLatchListAddLast( pLatch );}/**Function*************************************************************  Synopsis    [Deletes the latch from the network.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/void Ntk_NetworkDeleteLatch( Ntk_Latch_t * pLatch ){    // delete the latch from the list of latches    Ntk_NetworkLatchListDelete( pLatch );    // delete the latch input/output if it belongs only to the latch    if ( pLatch->pInput->Subtype == MV_BELONGS_TO_LATCH )        Ntk_NetworkDeleteNode( pLatch->pNet, pLatch->pInput, 1, 1 );    if ( pLatch->pOutput->Subtype == MV_BELONGS_TO_LATCH )        Ntk_NetworkDeleteNode( pLatch->pNet, pLatch->pOutput, 1, 1 );    // delete the latch    Ntk_LatchDelete( pLatch );}///////////////////////////////////////////////////////////////////////////                       END OF FILE                                ///////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -