#include "abc.h"
#include "main.h"
#include "io.h"
Go to the source code of this file.
Functions | |
void | Abc_ShowFile (char *FileNameDot) |
static void | Abc_ShowGetFileName (char *pName, char *pBuffer) |
void | Abc_NodeShowBdd (Abc_Obj_t *pNode) |
void | Abc_NodeShowCut (Abc_Obj_t *pNode, int nNodeSizeMax, int nConeSizeMax) |
void | Abc_NtkShow (Abc_Ntk_t *pNtk, int fGateNames, int fSeq, int fUseReverse) |
void Abc_NodeShowBdd | ( | Abc_Obj_t * | pNode | ) |
FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Visualizes BDD of the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 51 of file abcShow.c.
00052 { 00053 FILE * pFile; 00054 Vec_Ptr_t * vNamesIn; 00055 char FileNameDot[200]; 00056 char * pNameOut; 00057 00058 assert( Abc_NtkIsBddLogic(pNode->pNtk) ); 00059 // create the file name 00060 Abc_ShowGetFileName( Abc_ObjName(pNode), FileNameDot ); 00061 // check that the file can be opened 00062 if ( (pFile = fopen( FileNameDot, "w" )) == NULL ) 00063 { 00064 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot ); 00065 return; 00066 } 00067 00068 // set the node names 00069 vNamesIn = Abc_NodeGetFaninNames( pNode ); 00070 pNameOut = Abc_ObjName(pNode); 00071 Cudd_DumpDot( pNode->pNtk->pManFunc, 1, (DdNode **)&pNode->pData, (char **)vNamesIn->pArray, &pNameOut, pFile ); 00072 Abc_NodeFreeNames( vNamesIn ); 00073 Abc_NtkCleanCopy( pNode->pNtk ); 00074 fclose( pFile ); 00075 00076 // visualize the file 00077 Abc_ShowFile( FileNameDot ); 00078 }
void Abc_NodeShowCut | ( | Abc_Obj_t * | pNode, | |
int | nNodeSizeMax, | |||
int | nConeSizeMax | |||
) |
Function*************************************************************
Synopsis [Visualizes a reconvergence driven cut at the node.]
Description []
SideEffects []
SeeAlso []
Definition at line 91 of file abcShow.c.
00092 { 00093 FILE * pFile; 00094 char FileNameDot[200]; 00095 Abc_ManCut_t * p; 00096 Vec_Ptr_t * vCutSmall; 00097 Vec_Ptr_t * vCutLarge; 00098 Vec_Ptr_t * vInside; 00099 Vec_Ptr_t * vNodesTfo; 00100 Abc_Obj_t * pTemp; 00101 int i; 00102 00103 assert( Abc_NtkIsStrash(pNode->pNtk) ); 00104 00105 // start the cut computation manager 00106 p = Abc_NtkManCutStart( nNodeSizeMax, nConeSizeMax, 2, ABC_INFINITY ); 00107 // get the recovergence driven cut 00108 vCutSmall = Abc_NodeFindCut( p, pNode, 1 ); 00109 // get the containing cut 00110 vCutLarge = Abc_NtkManCutReadCutLarge( p ); 00111 // get the array for the inside nodes 00112 vInside = Abc_NtkManCutReadVisited( p ); 00113 // get the inside nodes of the containing cone 00114 Abc_NodeConeCollect( &pNode, 1, vCutLarge, vInside, 1 ); 00115 00116 // add the nodes in the TFO 00117 vNodesTfo = Abc_NodeCollectTfoCands( p, pNode, vCutSmall, ABC_INFINITY ); 00118 Vec_PtrForEachEntry( vNodesTfo, pTemp, i ) 00119 Vec_PtrPushUnique( vInside, pTemp ); 00120 00121 // create the file name 00122 Abc_ShowGetFileName( Abc_ObjName(pNode), FileNameDot ); 00123 // check that the file can be opened 00124 if ( (pFile = fopen( FileNameDot, "w" )) == NULL ) 00125 { 00126 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot ); 00127 return; 00128 } 00129 // add the root node to the cone (for visualization) 00130 Vec_PtrPush( vCutSmall, pNode ); 00131 // write the DOT file 00132 Io_WriteDotNtk( pNode->pNtk, vInside, vCutSmall, FileNameDot, 0, 0 ); 00133 // stop the cut computation manager 00134 Abc_NtkManCutStop( p ); 00135 00136 // visualize the file 00137 Abc_ShowFile( FileNameDot ); 00138 }
void Abc_NtkShow | ( | Abc_Ntk_t * | pNtk, | |
int | fGateNames, | |||
int | fSeq, | |||
int | fUseReverse | |||
) |
Function*************************************************************
Synopsis [Visualizes AIG with choices.]
Description []
SideEffects []
SeeAlso []
Definition at line 151 of file abcShow.c.
00152 { 00153 FILE * pFile; 00154 Abc_Obj_t * pNode; 00155 Vec_Ptr_t * vNodes; 00156 char FileNameDot[200]; 00157 int i; 00158 00159 assert( Abc_NtkIsStrash(pNtk) || Abc_NtkIsLogic(pNtk) ); 00160 if ( Abc_NtkIsStrash(pNtk) && Abc_NtkGetChoiceNum(pNtk) ) 00161 { 00162 printf( "Temporarily visualization of AIGs with choice nodes is disabled.\n" ); 00163 return; 00164 } 00165 // convert to logic SOP 00166 if ( Abc_NtkIsLogic(pNtk) ) 00167 Abc_NtkToSop( pNtk, 0 ); 00168 // create the file name 00169 Abc_ShowGetFileName( pNtk->pName, FileNameDot ); 00170 // check that the file can be opened 00171 if ( (pFile = fopen( FileNameDot, "w" )) == NULL ) 00172 { 00173 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot ); 00174 return; 00175 } 00176 fclose( pFile ); 00177 00178 // collect all nodes in the network 00179 vNodes = Vec_PtrAlloc( 100 ); 00180 Abc_NtkForEachObj( pNtk, pNode, i ) 00181 Vec_PtrPush( vNodes, pNode ); 00182 // write the DOT file 00183 if ( fSeq ) 00184 Io_WriteDotSeq( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse ); 00185 else 00186 Io_WriteDotNtk( pNtk, vNodes, NULL, FileNameDot, fGateNames, fUseReverse ); 00187 Vec_PtrFree( vNodes ); 00188 00189 // visualize the file 00190 Abc_ShowFile( FileNameDot ); 00191 }
void Abc_ShowFile | ( | char * | FileNameDot | ) |
CFile****************************************************************
FileName [abcShow.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Visualization procedures using DOT software and GSView.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [
] DECLARATIONS ///
Function*************************************************************
Synopsis [Shows the given DOT file.]
Description []
SideEffects []
SeeAlso []
Definition at line 205 of file abcShow.c.
00206 { 00207 FILE * pFile; 00208 char * FileGeneric; 00209 char FileNamePs[200]; 00210 char CommandDot[1000]; 00211 char * pDotName; 00212 char * pDotNameWin = "dot.exe"; 00213 char * pDotNameUnix = "dot"; 00214 char * pGsNameWin = "gsview32.exe"; 00215 char * pGsNameUnix = "gv"; 00216 int RetValue; 00217 00218 // get DOT names from the resource file 00219 if ( Abc_FrameReadFlag("dotwin") ) 00220 pDotNameWin = Abc_FrameReadFlag("dotwin"); 00221 if ( Abc_FrameReadFlag("dotunix") ) 00222 pDotNameUnix = Abc_FrameReadFlag("dotunix"); 00223 00224 #ifdef WIN32 00225 pDotName = pDotNameWin; 00226 #else 00227 pDotName = pDotNameUnix; 00228 #endif 00229 00230 // check if the input DOT file is okay 00231 if ( (pFile = fopen( FileNameDot, "r" )) == NULL ) 00232 { 00233 fprintf( stdout, "Cannot open the intermediate file \"%s\".\n", FileNameDot ); 00234 return; 00235 } 00236 fclose( pFile ); 00237 00238 // create the PostScript file name 00239 FileGeneric = Extra_FileNameGeneric( FileNameDot ); 00240 sprintf( FileNamePs, "%s.ps", FileGeneric ); 00241 free( FileGeneric ); 00242 00243 // generate the PostScript file using DOT 00244 sprintf( CommandDot, "%s -Tps -o %s %s", pDotName, FileNamePs, FileNameDot ); 00245 RetValue = system( CommandDot ); 00246 if ( RetValue == -1 ) 00247 { 00248 fprintf( stdout, "Command \"%s\" did not succeed.\n", CommandDot ); 00249 return; 00250 } 00251 // check that the input PostScript file is okay 00252 if ( (pFile = fopen( FileNamePs, "r" )) == NULL ) 00253 { 00254 fprintf( stdout, "Cannot open intermediate file \"%s\".\n", FileNamePs ); 00255 return; 00256 } 00257 fclose( pFile ); 00258 00259 00260 // get GSVIEW names from the resource file 00261 if ( Abc_FrameReadFlag("gsviewwin") ) 00262 pGsNameWin = Abc_FrameReadFlag("gsviewwin"); 00263 if ( Abc_FrameReadFlag("gsviewunix") ) 00264 pGsNameUnix = Abc_FrameReadFlag("gsviewunix"); 00265 00266 // spawn the viewer 00267 #ifdef WIN32 00268 _unlink( FileNameDot ); 00269 if ( _spawnl( _P_NOWAIT, pGsNameWin, pGsNameWin, FileNamePs, NULL ) == -1 ) 00270 if ( _spawnl( _P_NOWAIT, "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe", 00271 "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe", FileNamePs, NULL ) == -1 ) 00272 { 00273 fprintf( stdout, "Cannot find \"%s\".\n", pGsNameWin ); 00274 return; 00275 } 00276 #else 00277 { 00278 char CommandPs[1000]; 00279 unlink( FileNameDot ); 00280 sprintf( CommandPs, "%s %s &", pGsNameUnix, FileNamePs ); 00281 if ( system( CommandPs ) == -1 ) 00282 { 00283 fprintf( stdout, "Cannot execute \"%s\".\n", CommandPs ); 00284 return; 00285 } 00286 } 00287 #endif 00288 }
void Abc_ShowGetFileName | ( | char * | pName, | |
char * | pBuffer | |||
) | [static] |
Function*************************************************************
Synopsis [Derives the DOT file name.]
Description []
SideEffects []
SeeAlso []
Definition at line 301 of file abcShow.c.
00302 { 00303 char * pCur; 00304 // creat the file name 00305 sprintf( pBuffer, "%s.dot", pName ); 00306 // get rid of not-alpha-numeric characters 00307 for ( pCur = pBuffer; *pCur; pCur++ ) 00308 if ( !((*pCur >= '0' && *pCur <= '9') || (*pCur >= 'a' && *pCur <= 'z') || 00309 (*pCur >= 'A' && *pCur <= 'Z') || (*pCur == '.')) ) 00310 *pCur = '_'; 00311 }