📄 simpcmd.c
字号:
/**CFile**************************************************************** FileName [simpCmd.c] PackageName [MVSIS 2.0: Multi-valued logic synthesis system.] Synopsis [MV network simplification commands] Author [MVSIS Group] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - February 1, 2003.] Revision [$Id: simpCmd.c,v 1.30 2003/05/27 23:16:13 alanmi Exp $]***********************************************************************/#include "espresso.h"#include "simpInt.h"#include "cmd.h"#include <time.h>/*---------------------------------------------------------------------------*//* Constant declarations *//*---------------------------------------------------------------------------*//**AutomaticStart*************************************************************//*---------------------------------------------------------------------------*//* Static function prototypes *//*---------------------------------------------------------------------------*/static int SimpCommandFullsimp(Mv_Frame_t * pMvsis, int argc, char ** argv);static int SimpCommandSimplify(Mv_Frame_t * pMvsis, int argc, char ** argv);static int SimpNetworkReadCost( Simp_Info_t *pInfo, Ntk_Network_t *pNet );/**AutomaticEnd***************************************************************//*---------------------------------------------------------------------------*//* Definition of exported functions *//*---------------------------------------------------------------------------*//**Function******************************************************************** Synopsis [Initialize the generic data structure for the simp package] Description [Initialize the generic data structure for the simp package. Assign default values for all the options.] SideEffects [] SeeAlso []******************************************************************************/Simp_Info_t *Simp_InfoInit( Mv_Frame_t *pMvsis, Ntk_Network_t *net) { char *sValue; int iCost; Simp_Info_t *pInfo; pInfo = ALLOC(Simp_Info_t, 1); memset(pInfo, 0, sizeof(Simp_Info_t)); pInfo->timeout_net = 5000; pInfo->timeout_node = 10; pInfo->timeout_occur = FALSE; pInfo->verbose = FALSE; pInfo->method = SIMP_SNOCOMP; pInfo->use_bres = TRUE; pInfo->fConser = TRUE; /* global variable used by 'set' command */ sValue = Cmd_FlagReadByName( pMvsis, "cost" ); if ( sValue ) { iCost = atoi( sValue ); } else { iCost = 2; } if ( iCost == 0 ) { pInfo->accept = SIMP_CUBE; } else if ( iCost == 1 ) { pInfo->accept = SIMP_SOP_LIT; } else { pInfo->accept = SIMP_FCT_LIT; } return pInfo;}/**Function******************************************************************** Synopsis [Initialize the simp package.] Description [Initialize the simp package. Called by mvsisInit() one ONCE.] SideEffects [] SeeAlso []******************************************************************************/voidSimp_Init( Mv_Frame_t *pMvsis){ Cmd_CommandAdd(pMvsis, "Synthesis", "simplify", SimpCommandSimplify, 1); Cmd_CommandAdd(pMvsis, "Synthesis", "fullsimp", SimpCommandFullsimp, 1); return;}/**Function******************************************************************** Synopsis [End the simp package.] Description [End the simp package. Called by mvsisInit() one ONCE, when quitting.] SideEffects [] SeeAlso []******************************************************************************/voidSimp_End( void){ /* clean up memory allocated by Cvr_EspressoSetUp() */ sf_cleanup(); Cvr_CubeCleanUp (); return;}/*---------------------------------------------------------------------------*//* Definition of static functions *//*---------------------------------------------------------------------------*//**Function******************************************************************** Synopsis [Simplify each node with mv CODC's] CommandName [fullsimp] CommandSynopsis [Simplify each node with mv CODC's] CommandArguments [\[-h\]] CommandDescription [Simplify each node in the network using Compatible Observability Don't Cares (CODC). The network is traversed in a reverse topological order. At each node, the CODC set is computed for each fanout edge. These are intersected and represented in the global BDD domain. Then image computation maps these don't cares into the local space of the node, which includes the satisfiability don't cares (SDC) for the nodes in the transitive fanin cone. By default, the SDC's for the nodes with a subset of the immediate fanins is also computed, which leads to possible Boolean resubstitution. Finally, the node is minimized by ESPRESSO-MV using the don't cares. The simplified result replaces the old one if it has a lower cost (cube count, literal count, or literal count in the factored forms). Command options:<p> ] SideEffects []******************************************************************************/static intSimpCommandFullsimp( Mv_Frame_t *pMvsis, int argc, char ** argv){ FILE *pErr; char c; int fChanges, nIter, nTimeout, nNodes, nCost, nTemp; bool fTimeout=FALSE; Ntk_Network_t *pNet; Simp_Info_t *pInfo=NULL; nIter = 15; nTimeout = 0; pNet = Mv_FrameReadNet(pMvsis); pErr = Mv_FrameReadErr(pMvsis); /* set up simp info structure */ pInfo = Simp_InfoInit( pMvsis, pNet ); util_getopt_reset(); while ((c = util_getopt(argc, argv, "cfnpsxrvd:m:i:t:T:")) != EOF) { switch(c) { case 'v': pInfo->verbose = TRUE; break; case 'c': pInfo->fConser = TRUE; break; case 'f': pInfo->fFilter = TRUE; break; case 'n': pInfo->fRelatn = TRUE; break; case 'p': pInfo->fPhase = TRUE; break; case 's': pInfo->fSparse = TRUE; break; case 'r': pInfo->use_bres = FALSE; break; case 'd': if (strcmp(util_optarg, "codc") == 0) { pInfo->dc_type = 0; } else if (strcmp(util_optarg, "sdc") == 0) { pInfo->dc_type = 1; } else if (strcmp(util_optarg, "modc") == 0) { pInfo->dc_type = 2; } else if (strcmp(util_optarg, "complete") == 0) { pInfo->dc_type = 3; } else { goto usage; } break; case 'i': nIter = atoi(util_optarg); if (nIter<0) goto usage; break; case 't': pInfo->timeout_node = atoi(util_optarg); if (pInfo->timeout_node < 0) goto usage; break; case 'T': pInfo->timeout_net = atoi(util_optarg); if (pInfo->timeout_net < 0) goto usage; break; case 'm': if (strcmp(util_optarg, "nocomp") == 0) { pInfo->method = SIMP_NOCOMP; } else if (strcmp(util_optarg, "snocomp") == 0) { pInfo->method = SIMP_SNOCOMP; } else if (strcmp(util_optarg, "dcsimp") == 0) { pInfo->method = SIMP_DCSIMP; } else if (strcmp(util_optarg, "espresso") == 0) { pInfo->method = SIMP_ESPRESSO; } else if (strcmp(util_optarg, "exact") == 0) { pInfo->method = SIMP_EXACT; } else if (strcmp(util_optarg, "exactlit") == 0) { pInfo->method = SIMP_EXACT_LITS; } else { goto usage; } break; default: goto usage; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -