cudd  3.0.0
The University of Colorado Decision Diagram Package
bnet.h
Go to the documentation of this file.
1 
46 #ifndef _BNET
47 #define _BNET
48 
49 /*---------------------------------------------------------------------------*/
50 /* Nested includes */
51 /*---------------------------------------------------------------------------*/
52 
53 #include "util.h"
54 #include "st.h"
55 #include "cudd.h"
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /*---------------------------------------------------------------------------*/
62 /* Constant declarations */
63 /*---------------------------------------------------------------------------*/
64 
65 /* Different types of nodes. (Used in the "BnetNode" type.) */
66 #define BNET_CONSTANT_NODE 0
67 #define BNET_INPUT_NODE 1
68 #define BNET_PRESENT_STATE_NODE 2
69 #define BNET_INTERNAL_NODE 3
70 #define BNET_OUTPUT_NODE 4
71 #define BNET_NEXT_STATE_NODE 5
72 
73 /* Type of DD of a node. */
74 #define BNET_LOCAL_DD 0
75 #define BNET_GLOBAL_DD 1
76 
77 
78 /*---------------------------------------------------------------------------*/
79 /* Stucture declarations */
80 /*---------------------------------------------------------------------------*/
81 
82 /*---------------------------------------------------------------------------*/
83 /* Type declarations */
84 /*---------------------------------------------------------------------------*/
85 
86 /* The following types implement a very simple data structure for a boolean
87 ** network. The intent is to be able to read a minimal subset of the blif
88 ** format in a data structure from which it's easy to build DDs for the
89 ** circuit.
90 */
91 
98 typedef struct BnetTabline {
99  char *values;
100  struct BnetTabline *next;
101 } BnetTabline;
102 
116 typedef struct BnetNode {
117  char *name;
118  int type;
119  int ninp;
120  int nfo;
121  char **inputs;
123  int polarity;
124  int active;
125  int var;
127  int exdc_flag;
128  struct BnetNode *exdc;
129  int count;
130  int level;
131  int visited;
132  struct BnetNode *next;
133 } BnetNode;
134 
138 typedef struct BnetNetwork {
139  char *name;
140  int npis;
141  int ninputs;
142  char **inputs;
143  int npos;
144  int noutputs;
145  char **outputs;
146  int nlatches;
147  char ***latches;
150  char *slope;
151 } BnetNetwork;
152 
153 /*---------------------------------------------------------------------------*/
154 /* Variable declarations */
155 /*---------------------------------------------------------------------------*/
156 
157 /*---------------------------------------------------------------------------*/
158 /* Macro declarations */
159 /*---------------------------------------------------------------------------*/
160 
161 #ifndef TRUE
162 # define TRUE 1
163 #endif
164 #ifndef FALSE
165 # define FALSE 0
166 #endif
167 
170 /*---------------------------------------------------------------------------*/
171 /* Function prototypes */
172 /*---------------------------------------------------------------------------*/
173 
174 extern BnetNetwork * Bnet_ReadNetwork (FILE *fp, int pr);
175 extern void Bnet_PrintNetwork (BnetNetwork *net);
176 extern void Bnet_FreeNetwork (BnetNetwork *net);
177 extern int Bnet_BuildNodeBDD (DdManager *dd, BnetNode *nd, st_table *hash, int params, int nodrop);
178 extern int Bnet_DfsVariableOrder (DdManager *dd, BnetNetwork *net);
179 extern int Bnet_bddDump (DdManager *dd, BnetNetwork *network, char *dfile, int dumpFmt, int reencoded);
180 extern int Bnet_bddArrayDump (DdManager *dd, BnetNetwork *network, char *dfile, DdNode **outputs, char **onames, int noutputs, int dumpFmt);
181 extern int Bnet_ReadOrder (DdManager *dd, char *ordFile, BnetNetwork *net, int locGlob, int nodrop);
182 extern int Bnet_PrintOrder (BnetNetwork * net, DdManager *dd);
183 
187 #ifdef __cplusplus
188 } /* end of extern "C" */
189 #endif
190 
191 #endif /* _BNET */
int Bnet_ReadOrder(DdManager *dd, char *ordFile, BnetNetwork *net, int locGlob, int nodrop)
Reads the variable order from a file.
Definition: bnet.c:1067
Symbol table header.
Definition: st.c:101
int ninputs
Definition: bnet.h:141
int Bnet_bddDump(DdManager *dd, BnetNetwork *network, char *dfile, int dumpFmt, int reencoded)
Writes the network BDDs to a file in dot, blif, or daVinci format.
Definition: bnet.c:829
Decision diagram node.
Definition: cuddInt.h:261
BnetNode * nodes
Definition: bnet.h:148
struct BnetTabline * next
Definition: bnet.h:100
int visited
Definition: bnet.h:131
struct BnetNode * exdc
Definition: bnet.h:128
int npis
Definition: bnet.h:140
DdNode * dd
Definition: bnet.h:126
struct BnetNode BnetNode
Node of the boolean network.
void Bnet_PrintNetwork(BnetNetwork *net)
Prints to stdout a boolean network created by Bnet_ReadNetwork.
Definition: bnet.c:501
void Bnet_FreeNetwork(BnetNetwork *net)
Frees a boolean network created by Bnet_ReadNetwork.
Definition: bnet.c:554
int var
Definition: bnet.h:125
int exdc_flag
Definition: bnet.h:127
Specialized DD symbol table.
Definition: cuddInt.h:399
int level
Definition: bnet.h:130
Very simple boolean network data structure.
Definition: bnet.h:138
int npos
Definition: bnet.h:143
Node of the boolean network.
Definition: bnet.h:116
char * name
Definition: bnet.h:139
st_table * hash
Definition: bnet.h:149
BnetNetwork * Bnet_ReadNetwork(FILE *fp, int pr)
Reads boolean network from blif file.
Definition: bnet.c:140
struct BnetNode * next
Definition: bnet.h:132
int count
Definition: bnet.h:129
char * name
Definition: bnet.h:117
BnetTabline * f
Definition: bnet.h:122
struct BnetNetwork BnetNetwork
Very simple boolean network data structure.
int nfo
Definition: bnet.h:120
The University of Colorado decision diagram package.
char ** inputs
Definition: bnet.h:121
int polarity
Definition: bnet.h:123
char ** inputs
Definition: bnet.h:142
int Bnet_bddArrayDump(DdManager *dd, BnetNetwork *network, char *dfile, DdNode **outputs, char **onames, int noutputs, int dumpFmt)
Writes an array of BDDs to a file in dot, blif, DDcal, factored-form, daVinci, or blif-MV format...
Definition: bnet.c:973
Type to store a line of the truth table of a node.
Definition: bnet.h:98
int Bnet_DfsVariableOrder(DdManager *dd, BnetNetwork *net)
Orders the BDD variables by DFS.
Definition: bnet.c:787
struct BnetTabline BnetTabline
Type to store a line of the truth table of a node.
int type
Definition: bnet.h:118
Low-level utilities.
int noutputs
Definition: bnet.h:144
char *** latches
Definition: bnet.h:147
char * values
Definition: bnet.h:99
char ** outputs
Definition: bnet.h:145
int Bnet_BuildNodeBDD(DdManager *dd, BnetNode *nd, st_table *hash, int params, int nodrop)
Builds the BDD for the function of a node.
Definition: bnet.c:632
char * slope
Definition: bnet.h:150
int active
Definition: bnet.h:124
Symbol table package.
int Bnet_PrintOrder(BnetNetwork *net, DdManager *dd)
Prints the order of the DD variables of a network.
Definition: bnet.c:1175
static char const * onames[]
Definition: ntr.c:67
int nlatches
Definition: bnet.h:146
int ninp
Definition: bnet.h:119