1 /**CFile**********************************************************************
7 Synopsis [Functions to display BDD files]
9 Description [Functions to display BDD files in binary format
12 Author [Gianpiero Cabodi and Stefano Quer]
15 Copyright (c) 2004 by Politecnico di Torino.
16 All Rights Reserved. This software is for educational purposes only.
17 Permission is given to academic institutions to use, copy, and modify
18 this software and its documentation provided that this introductory
19 message is not removed, that this software and its documentation is
20 used for the institutions' internal research and educational purposes,
21 and that no monies are exchanged. No guarantee is expressed or implied
22 by the distribution of this code.
23 Send bug-reports and/or questions to:
24 {gianpiero.cabodi,stefano.quer}@polito.it.
27 ******************************************************************************/
31 /*---------------------------------------------------------------------------*/
32 /* Stucture declarations */
33 /*---------------------------------------------------------------------------*/
35 /*---------------------------------------------------------------------------*/
36 /* Type declarations */
37 /*---------------------------------------------------------------------------*/
39 /*---------------------------------------------------------------------------*/
40 /* Variable declarations */
41 /*---------------------------------------------------------------------------*/
43 /*---------------------------------------------------------------------------*/
44 /* Macro declarations */
45 /*---------------------------------------------------------------------------*/
48 /**AutomaticStart*************************************************************/
50 /*---------------------------------------------------------------------------*/
51 /* Static function prototypes */
52 /*---------------------------------------------------------------------------*/
55 /**AutomaticEnd***************************************************************/
58 /*---------------------------------------------------------------------------*/
59 /* Definition of exported functions */
60 /*---------------------------------------------------------------------------*/
63 /**Function********************************************************************
65 Synopsis [Display a binary dump file in a text file]
67 Description [Display a binary dump file in a text file]
71 SeeAlso [Dddmp_cuddBddStore , Dddmp_cuddBddLoad ]
73 ******************************************************************************/
76 Dddmp_cuddBddDisplayBinary(
77 char *fileIn
/* IN: name of binary file */,
78 char *fileOut
/* IN: name of text file */
83 struct binary_dd_code code
;
87 fp
= fopen (fileIn
, "rb");
92 fpo
= fopen (fileOut
, "w");
97 while (fgets(buf
, 999,fp
)!=NULL
) {
98 fprintf (fpo
, "%s", buf
);
99 if (strncmp(buf
, ".nnodes", 7) == 0) {
100 sscanf (buf
, "%*s %d", &nnodes
);
102 if (strncmp(buf
, ".rootids", 8) == 0) {
107 for (i
=1; i
<=nnodes
; i
++) {
111 if (DddmpReadCode(fp
,&code
) == 0) {
114 fprintf (fpo
, "c : v %d | T %d | E %d\n",
115 (int)code
.V
, (int)code
.T
,
116 (code
.Ecompl
? -(int)(code
.E
) : (int)(code
.E
)));
117 if (code
.V
== DDDMP_TERMINAL
) {
120 if (code
.V
<= DDDMP_RELATIVE_ID
) {
121 size
= DddmpReadInt(fp
,&id
);
125 fprintf(fpo
, "v(%d): %d\n", size
, id
);
127 if (code
.T
<= DDDMP_RELATIVE_ID
) {
128 size
= DddmpReadInt(fp
,&id
);
132 fprintf(fpo
, "T(%d): %d\n", size
, id
);
134 if (code
.E
<= DDDMP_RELATIVE_ID
) {
135 size
= DddmpReadInt(fp
,&id
);
139 fprintf(fpo
, "E(%d): %d\n", size
, id
);
145 if (strncmp(buf
, ".end", 4) != 0) {
149 fprintf(fpo
, ".end");
158 /*---------------------------------------------------------------------------*/
159 /* Definition of internal functions */
160 /*---------------------------------------------------------------------------*/
162 /*---------------------------------------------------------------------------*/
163 /* Definition of static functions */
164 /*---------------------------------------------------------------------------*/