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

📄 cuddaddabs.c

📁 主要进行大规模的电路综合
💻 C
📖 第 1 页 / 共 2 页
字号:
/**CFile***********************************************************************  FileName    [cuddAddAbs.c]  PackageName [cudd]  Synopsis    [Quantification functions for ADDs.]  Description [External procedures included in this module:		<ul>		<li> Cudd_addExistAbstract()		<li> Cudd_addUnivAbstract()		<li> Cudd_addOrAbstract()		</ul>	Internal procedures included in this module:		<ul>		<li> cuddAddExistAbstractRecur()		<li> cuddAddUnivAbstractRecur()		<li> cuddAddOrAbstractRecur()		</ul>	Static procedures included in this module:		<ul>		<li> addCheckPositiveCube()		</ul>]  Author      [Fabio Somenzi]  Copyright   [This file was created at the University of Colorado at  Boulder.  The University of Colorado at Boulder makes no warranty  about the suitability of this software for any purpose.  It is  presented on an AS IS basis.]******************************************************************************/#include	"util.h"#include	"cuddInt.h"/*---------------------------------------------------------------------------*//* Constant declarations                                                     *//*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*//* Stucture declarations                                                     *//*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*//* Type declarations                                                         *//*---------------------------------------------------------------------------*//*---------------------------------------------------------------------------*//* Variable declarations                                                     *//*---------------------------------------------------------------------------*/#ifndef lintstatic char rcsid[] DD_UNUSED = "$Id: cuddAddAbs.c,v 1.1.1.1 2003/02/24 22:23:50 wjiang Exp $";#endifstatic	DdNode	*two;/*---------------------------------------------------------------------------*//* Macro declarations                                                        *//*---------------------------------------------------------------------------*//**AutomaticStart*************************************************************//*---------------------------------------------------------------------------*//* Static function prototypes                                                *//*---------------------------------------------------------------------------*/static int addCheckPositiveCube ARGS((DdManager *manager, DdNode *cube));/**AutomaticEnd***************************************************************//*---------------------------------------------------------------------------*//* Definition of exported functions                                          *//*---------------------------------------------------------------------------*//**Function********************************************************************  Synopsis    [Existentially Abstracts all the variables in cube from f.]  Description [Abstracts all the variables in cube from f by summing  over all possible values taken by the variables. Returns the  abstracted ADD.]  SideEffects [None]  SeeAlso     [Cudd_addUnivAbstract Cudd_bddExistAbstract  Cudd_addOrAbstract]******************************************************************************/DdNode *Cudd_addExistAbstract(  DdManager * manager,  DdNode * f,  DdNode * cube){    DdNode *res;    two = cuddUniqueConst(manager,(CUDD_VALUE_TYPE) 2);    if (two == NULL) return(NULL);    cuddRef(two);    if (addCheckPositiveCube(manager, cube) == 0) {        (void) fprintf(manager->err,"Error: Can only abstract cubes");        return(NULL);    }    do {	manager->reordered = 0;	res = cuddAddExistAbstractRecur(manager, f, cube);    } while (manager->reordered == 1);    if (res == NULL) {	Cudd_RecursiveDeref(manager,two);	return(NULL);    }    cuddRef(res);    Cudd_RecursiveDeref(manager,two);    cuddDeref(res);    return(res);} /* end of Cudd_addExistAbstract *//**Function********************************************************************  Synopsis    [Universally Abstracts all the variables in cube from f.]  Description [Abstracts all the variables in cube from f by taking  the product over all possible values taken by the variable. Returns  the abstracted ADD if successful; NULL otherwise.]  SideEffects [None]  SeeAlso     [Cudd_addExistAbstract Cudd_bddUnivAbstract  Cudd_addOrAbstract]******************************************************************************/DdNode *Cudd_addUnivAbstract(  DdManager * manager,  DdNode * f,  DdNode * cube){    DdNode		*res;    if (addCheckPositiveCube(manager, cube) == 0) {	(void) fprintf(manager->err,"Error:  Can only abstract cubes");	return(NULL);    }    do {	manager->reordered = 0;	res = cuddAddUnivAbstractRecur(manager, f, cube);    } while (manager->reordered == 1);    return(res);} /* end of Cudd_addUnivAbstract *//**Function********************************************************************  Synopsis    [Disjunctively abstracts all the variables in cube from the  0-1 ADD f.]  Description [Abstracts all the variables in cube from the 0-1 ADD f  by taking the disjunction over all possible values taken by the  variables.  Returns the abstracted ADD if successful; NULL  otherwise.]  SideEffects [None]  SeeAlso     [Cudd_addUnivAbstract Cudd_addExistAbstract]******************************************************************************/DdNode *Cudd_addOrAbstract(  DdManager * manager,  DdNode * f,  DdNode * cube){    DdNode *res;    if (addCheckPositiveCube(manager, cube) == 0) {        (void) fprintf(manager->err,"Error: Can only abstract cubes");        return(NULL);    }    do {	manager->reordered = 0;	res = cuddAddOrAbstractRecur(manager, f, cube);    } while (manager->reordered == 1);    return(res);} /* end of Cudd_addOrAbstract *//*---------------------------------------------------------------------------*//* Definition of internal functions                                          *//*---------------------------------------------------------------------------*//**Function********************************************************************  Synopsis    [Performs the recursive step of Cudd_addExistAbstract.]  Description [Performs the recursive step of Cudd_addExistAbstract.  Returns the ADD obtained by abstracting the variables of cube from f,  if successful; NULL otherwise.]  SideEffects [None]  SeeAlso     []******************************************************************************/DdNode *cuddAddExistAbstractRecur(  DdManager * manager,  DdNode * f,  DdNode * cube){    DdNode	*T, *E, *res, *res1, *res2, *zero;    statLine(manager);    zero = DD_ZERO(manager);    /* Cube is guaranteed to be a cube at this point. */	    if (f == zero || cuddIsConstant(cube)) {          return(f);    }    /* Abstract a variable that does not appear in f => multiply by 2. */    if (cuddI(manager,f->index) > cuddI(manager,cube->index)) {	res1 = cuddAddExistAbstractRecur(manager, f, cuddT(cube));	if (res1 == NULL) return(NULL);	cuddRef(res1);	/* Use the "internal" procedure to be alerted in case of	** dynamic reordering. If dynamic reordering occurs, we	** have to abort the entire abstraction.	*/	res = cuddAddApplyRecur(manager,Cudd_addTimes,res1,two);	if (res == NULL) {	    Cudd_RecursiveDeref(manager,res1);	    return(NULL);	}	cuddRef(res);	Cudd_RecursiveDeref(manager,res1);	cuddDeref(res);        return(res);    }    if ((res = cuddCacheLookup2(manager, Cudd_addExistAbstract, f, cube)) != NULL) {	return(res);    }    T = cuddT(f);    E = cuddE(f);    /* If the two indices are the same, so are their levels. */    if (f->index == cube->index) {	res1 = cuddAddExistAbstractRecur(manager, T, cuddT(cube));	if (res1 == NULL) return(NULL);        cuddRef(res1);	res2 = cuddAddExistAbstractRecur(manager, E, cuddT(cube));	if (res2 == NULL) {	    Cudd_RecursiveDeref(manager,res1);	    return(NULL);	}        cuddRef(res2);	res = cuddAddApplyRecur(manager, Cudd_addPlus, res1, res2);	if (res == NULL) {	    Cudd_RecursiveDeref(manager,res1);	    Cudd_RecursiveDeref(manager,res2);	    return(NULL);	}	cuddRef(res);

⌨️ 快捷键说明

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