fttriv.c

来自「主要进行大规模的电路综合」· C语言 代码 · 共 130 行

C
130
字号
/**CFile****************************************************************  FileName    [ftTriv.c]  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]  Synopsis    [Trivial case of factoring.]  Author      [MVSIS Group]    Affiliation [UC Berkeley]  Date        [Ver. 1.0. Started - February 1, 2003.]  Revision    [$Id: ftTriv.c,v 1.2 2003/05/27 23:14:49 alanmi Exp $]***********************************************************************/#include "ft.h"///////////////////////////////////////////////////////////////////////////                        DECLARATIONS                              //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////                     FUNCTION DEFITIONS                           ////////////////////////////////////////////////////////////////////////////**Function*************************************************************  Synopsis    [Factoring the cover, which has no algebraic divisors.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/Ft_Node_t * Ft_FactorTrivial( Ft_Tree_t * pTree, Mvc_Cover_t * pCover ){    Ft_Node_t * pNode;    Mvc_Cube_t * pCube;    // iterate through the cubes    pNode = NULL;    Mvc_CoverForEachCube( pCover, pCube )    {        if ( pNode == NULL )            pNode = Ft_FactorTrivialCube( pTree, pCover, pCube );        else            pNode = Ft_TreeNodeCreate( pTree, FT_NODE_OR, pNode, Ft_FactorTrivialCube( pTree, pCover, pCube ) );    }    assert( pNode ); // if this assertion fails, the input cover is not SCC-free    return pNode;}/**Function*************************************************************  Synopsis    [Factoring the cube.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/Ft_Node_t * Ft_FactorTrivialCube( Ft_Tree_t * pTree, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube ){    Ft_Node_t * pNode;    int iLit, Value;    // iterate through the literals    pNode = NULL;    Mvc_CubeForEachLiteral( pCover, pCube, iLit, Value )    {        if ( Value )        {            if ( pNode == NULL )                pNode = Ft_FactorTrivialNode( pTree, iLit );            else                pNode = Ft_TreeNodeCreate( pTree, FT_NODE_AND, pNode, Ft_FactorTrivialNode( pTree, iLit ) );        }    }    assert( pNode ); // if this assertion fails, the input cover is not SCC-free    return pNode;}/**Function*************************************************************  Synopsis    [Factoring the cube.]  Description []                 SideEffects []  SeeAlso     []***********************************************************************/Ft_Node_t * Ft_FactorTrivialNode( Ft_Tree_t * pTree, int iLit ){    Vm_VarMap_t * pVm;    int * pValuesFirst, * pValues;    int nValuesIn, nVarsIn;    Ft_Node_t * pNode;    int iVar;    pVm = pTree->pVm;    pValues      = Vm_VarMapReadValuesArray(pVm);    pValuesFirst = Vm_VarMapReadValuesFirstArray(pVm);    nValuesIn    = Vm_VarMapReadValuesInNum(pVm);    nVarsIn      = Vm_VarMapReadVarsInNum(pVm);    assert( iLit < nValuesIn );    for ( iVar = 0; iVar < nVarsIn; iVar++ )        if ( iLit < pValuesFirst[iVar] + pValues[iVar] )            break;    assert( iVar < nVarsIn );    pNode = Ft_TreeNodeCreate( pTree, FT_NODE_LEAF, NULL, NULL );    pNode->VarNum  = iVar;    pNode->nValues = pValues[iVar];    pNode->uData   = FT_MV_MASK(pNode->nValues) ^ (1 << (iLit - pValuesFirst[iVar]));    return pNode;}///////////////////////////////////////////////////////////////////////////                       END OF FILE                                ///////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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