void
DddmpClearVisited(
DdNode * f
)
- Marks a node as not visited
- Side Effects None
- See Also
DddmpVisited()
DddmpSetVisited()
- Defined in
dddmpDdNode.c
int
DddmpNumberDdNodes(
DdManager * dd,
DdNode ** f,
int n
)
- Node numbering is required to convert pointers to integers.
Since nodes are removed from unique, no new nodes shoulld be
generated before re-inserting nodes in unique
(DddmpUnnumberDdNodes()).
- Side Effects Nodes are temporarily removed from unique table
- See Also
RemoveFromUniqueRecur()
NumberNodeRecur()
DddmpUnnumberDdNodes()
- Defined in
dddmpDdNode.c
int
DddmpReadCode(
FILE * fp,
struct binary_dd_code * pcode
)
- Reads a 1 byte node code. See DddmpWriteCode()
for code description
- Side Effects None
- See Also
DddmpWriteCode()
- Defined in
dddmpBinary.c
int
DddmpReadInt(
FILE * fp,
int * pid
)
- Reads an integer coded on a sequence of bytes. See
DddmpWriteInt() for format
- Side Effects None
- See Also
DddmpWriteInt()
- Defined in
dddmpBinary.c
int
DddmpReadNodeIndex(
DdNode * f
)
- Reads the index of a node. LSB is skipped (used as visited flag).
- Side Effects None
- See Also
DddmpWriteNodeIndex()
DddmpSetVisited()
DddmpVisited()
- Defined in
dddmpDdNode.c
void
DddmpSetVisited(
DdNode * f
)
- Marks a node as visited
- Side Effects None
- See Also
DddmpVisited()
DddmpClearVisited()
- Defined in
dddmpDdNode.c
void
DddmpUnnumberDdNodes(
DdManager * dd,
DdNode ** f,
int n
)
- Node indexes are no more needed. Nodes are re-linked in the unique
table.
- Side Effects None
- See Also
DddmpNumberDdNode()
- Defined in
dddmpDdNode.c
int
DddmpVisited(
DdNode * f
)
- Returns true if node is visited
- Side Effects None
- See Also
DddmpSetVisited()
DddmpClearVisited()
- Defined in
dddmpDdNode.c
int
DddmpWriteCode(
FILE * fp,
struct binary_dd_code code
)
- outputs a 1 byte node code using the following format:
Unused : 1 bit;
V : 2 bits; (variable code)
T : 2 bits; (Then code)
Ecompl : 1 bit; (Else complemented)
E : 2 bits; (Else code)
Ecompl is set with complemented edges
- Side Effects None
- See Also
DddmpReadCode()
- Defined in
dddmpBinary.c
int
DddmpWriteInt(
FILE * fp,
int id
)
- Writes an integer as a sequence ob bytes (MSByte first).
For each byte 7 bits are used for data and one (LSBit) as link with
a further byte (LSB = 1 means one more byte)
- Side Effects None
- See Also
DddmpReadInt()
- Defined in
dddmpBinary.c
void
DddmpWriteNodeIndex(
DdNode * f,
int id
)
- The index of the node is written in the "next" field of
a DdNode struct. LSB is not used (set to 0). It is used as
"visited" flag in DD traversals.
- Side Effects None
- See Also
DddmpReadNodeIndex()
DddmpSetVisited()
DddmpVisited()
- Defined in
dddmpDdNode.c
int
Dddmp_Bin2Text(
char * filein,
char * fileout
)
- Converts from binary to ASCII format. A BDD array is loaded and
and stored to the target file.
- Side Effects None
- See Also
Dddmp_Text2Bin()
- Defined in
dddmpConvert.c
int
Dddmp_Text2Bin(
char * filein,
char * fileout
)
- Converts from ASCII to binary format. A BDD array is loaded and
and stored to the target file.
- Side Effects None
- See Also
Dddmp_Bin2Text()
- Defined in
dddmpConvert.c
int
Dddmp_cuddBddArrayLoad(
DdManager * dd, manager
Dddmp_RootMatchType rootmatchmode, storing mode selector
char ** rootmatchnames, sorted names for loaded roots
Dddmp_VarMatchType varmatchmode, storing mode selector
char ** varmatchnames, array of variable names (accessed by ids)
int * varmatchauxids, array of variable auxids (accessed by ids)
int * varcomposeids, array of new ids (accessed by ids)
int mode, requested input file format (checked against file format)
char * file, file name
FILE * fp, file pointer
DdNode *** pproots array of returned BDD roots (by reference)
)
- Reads a dump file representing the argument BDDs. The header is
common to both text and binary mode. The node list is either
in text or binary format. A dynamic vector of DD pointers
is allocated to support conversion from DD indexes to pointers.
Several criteria are supported for variable match between file
and dd manager. Several changes/permutations/compositions are allowed
for variables while loading DDs. Variable of the dd manager are allowed
to match with variables on file on ids, permids, varnames,
varauxids; also direct composition between ids and
composeids is supported. More in detail:
- varmatchmode=DDDMP_VAR_MATCHIDS
allows the loading of a DD keeping variable IDs unchanged
(regardless of the variable ordering of the reading manager); this
is useful, for example, when swapping DDs to file and restoring them
later from file, after possible variable reordering activations.
- varmatchmode=DDDMP_VAR_MATCHPERMIDS
is used to allow variable match according to the position in the ordering.
- varmatchmode=DDDMP_VAR_MATCHNAMES
requires a non NULL varmatchnames parameter; this is a vector of
strings in one-to-one correspondence with variable IDs of the
reading manager. Variables in the DD file read are matched with
manager variables according to their name (a non NULL varnames
parameter was required while storing the DD file).
- varmatchmode=DDDMP_VAR_MATCHIDS
has a meaning similar to DDDMP_VAR_MATCHNAMES, but integer auxiliary
IDs are used instead of strings; the additional non NULL
varmatchauxids parameter is needed.
- varmatchmode=DDDMP_VAR_COMPOSEIDS
uses the additional varcomposeids parameter is used as array of
variable ids to be composed with ids stored in file.
In the present implementation, the array varnames (3), varauxids (4)
and composeids (5) need to have one entry for each variable in the
DD manager (NULL pointers are allowed for unused variables
in varnames). Hence variables need to be already present in the
manager. All arrays are sorted according to IDs.
- Side Effects A vector of pointers to DD nodes is allocated and freed.
- See Also
Dddmp_cuddBddArrayStore
- Defined in
dddmpDump.c
int
Dddmp_cuddBddArrayStore(
DdManager * dd, manager
char * ddname, dd name (or NULL)
int nroots, number of output BDD roots to be stored
DdNode ** f, array of BDD roots to be stored
char ** rootnames, array of root names (or NULL)
char ** varnames, array of variable names (or NULL)
int * auxids, array of converted var IDs
int mode, storing mode selector
Dddmp_VarInfoType varinfo, extra info for variables in text mode
char * fname, file name
FILE * fp pointer to the store file
)
- Dumps the argument array of BDDs to file. Dumping is
either in text or binary form. BDDs are stored to the fp (already
open) file if not NULL. Otherwise the file whose name is fname is opened
in write mode. The header has the same format for both textual and
binary dump. Names are allowed for input variables (vnames) and for
represented functions (rnames). For sake of generality and because
of dynamic variable ordering both variable IDs and permuted IDs are
included. New IDs are also supported (auxids). Variables are identified with incremental
numbers. according with their positiom in the support set.
In text mode, an extra info may be added, chosen among the following options:
name, ID, PermID, or an auxiliary id. Since conversion from DD pointers to integers is
required, DD nodes are temporarily removed from the unique
hash table. This allows the use of the next field to store node IDs.
- Side Effects Nodes are temporarily removed from the unique hash
table. They are re-linked after the store operation in a modified
order.
- See Also
Dddmp_cuddBddStore
Dddmp_cuddBddLoad
Dddmp_cuddBddArrayLoad
- Defined in
dddmpDump.c
int
Dddmp_cuddBddDisplayBinary(
char * filein,
char * fileout name of text file
)
- Display a binary dump file in a text file
- Side Effects None
- See Also
Dddmp_cuddBddStore
Dddmp_cuddBddLoad
- Defined in
dddmpDbg.c
DdNode *
Dddmp_cuddBddLoad(
DdManager * dd, manager
Dddmp_VarMatchType varmatchmode, storing mode selector
char ** varmatchnames, array of variable names (accessed by IDs)
int * varmatchauxids, array of variable auxids (accessed by IDs)
int * varcomposeids, array of new ids (accessed by ids)
int mode, requested input file format (checked against file format)
char * file, file name
FILE * fp file pointer
)
- Reads a dump file representing the argument BDD.
Dddmp_cuddBddArrayLoad is used through a dummy array.
- Side Effects A vector of pointers to DD nodes is allocated and freed.
- See Also
Dddmp_cuddBddStore
Dddmp_cuddBddArrayLoad
- Defined in
dddmpDump.c
int
Dddmp_cuddBddStore(
DdManager * dd, manager
char * ddname, dd name (or NULL)
DdNode * f, BDD root to be stored
char ** varnames, array of variable names (or NULL)
int * auxids, array of converted var ids
int mode, storing mode selector
Dddmp_VarInfoType varinfo, extra info for variables in text mode
char * fname, file name
FILE * fp pointer to the store file
)
- Dumps the argument BDD to file. Dumping is done through
Dddmp_cuddBddArrayStore, And a dummy array of 1 BDD root is
used for this purpose.
- Side Effects Nodes are temporarily removed from unique hash. They are
re-linked after the store operation in a modified order.
- See Also
Dddmp_cuddBddLoad
Dddmp_cuddBddArrayLoad
- Defined in
dddmpDump.c
static int
FindVarname(
char * name,
char ** array,
int n
)
- Binary search of a name within a sorted array of strings.
used when matching names of variables.
- Side Effects None
- Defined in
dddmpDump.c
int
NumberNodeRecur(
DdNode * f,
int id
)
- Number nodes recursively in post-order. The "visited flag is
used with inverse polarity, because all nodes were set "visited"
when removing them from unique.
- Side Effects "visited" flags are reset.
- Defined in
dddmpDdNode.c
static int
QsortStrcmp(
const void * ps1,
const void * ps2
)
- String compare for qsort
- Side Effects None
- Defined in
dddmpDump.c
static int
ReadByteBinary(
FILE * fp,
unsigned char * cp
)
- inputs a byte to file fp. 0x00 has been used as escape character
to filter , and . This is done for
compatibility between unix and dos/windows systems.
- Side Effects None
- See Also
WriteByteBinary()
- Defined in
dddmpBinary.c
static void
RemoveFromUniqueRecur(
DdManager * dd,
DdNode * f
)
- Removes a node from the unique table by locating the proper
subtable and unlinking the node from it. It recurs on son nodes
- Side Effects Nodes are left with the "visited" flag true.
- See Also
RestoreInUniqueRecur()
- Defined in
dddmpDdNode.c
static void
RestoreInUniqueRecur(
DdManager * dd,
DdNode * f
)
- Restores a node in unique table (recursive)
- Side Effects Nodes are not restored in the same order as before removal
- See Also
RemoveFromUnique()
- Defined in
dddmpDdNode.c
static int
StoreNodeRecur(
DdManager * dd, dd manager
DdNode * f, dd node to be stored
int mode, store mode
int * supportids, internal ids for variables
char ** varnames, names of variables: to be stored with nodes
int * outids, output ids for variables
FILE * fp store file
)
- Stores a node to file in either test or
binary mode.
In text mode a node is represented (on a text line basis) as
- node-index [var-extrainfo] var-index Then-index Else-index
where all indexes are integer numbers and var-extrainfo (optional
redundant field) is either an integer or a string (variable name).
Node-index is redundant (due to the node ordering) but we keep it
for readability.
In binary mode nodes are represented as a sequence of bytes,
representing var-index, Then-index, and Else-index in an optimized
way. Only the first byte (code) is mandatory. Integer indexes are
represented in absolute or relative mode, where relative means
offset wrt. a Then/Else node info. Suppose Var(NodeId),
Then(NodeId) and Else(NodeId) represent infos about a given node.
The generic "NodeId" node is stored as
- code-byte
- [var-info]
- [Then-info]
- [Else-info]
where code-byte contains bit fields
- Unused : 1 bit
- Variable: 2 bits, one of the following codes
- DDDMP_ABSOLUTE_ID var-info = Var(NodeId) follows
- DDDMP_RELATIVE_ID Var(NodeId) is represented in relative form as
var-info = Min(Var(Then(NodeId)),Var(Else(NodeId))) -Var(NodeId)
- DDDMP_RELATIVE_1 No var-info follows, because
Var(NodeId) = Min(Var(Then(NodeId)),Var(Else(NodeId)))-1
- DDDMP_TERMINAL Node is a terminal, no var info required
- T : 2 bits, with codes similar to V
- DDDMP_ABSOLUTE_ID Then-info = Then(NodeId) follows
- DDDMP_RELATIVE_ID Then(NodeId) is represented in relative form as
Then-info = Nodeid-Then(NodeId)
- DDDMP_RELATIVE_1 No info on Then(NodeId) follows, because
Then(NodeId) = NodeId-1
- DDDMP_TERMINAL Then Node is a terminal, no info required (for
BDDs)
- Ecompl : 1 bit, if 1 means complemented edge
- E : 2 bits, with codes and meanings as for the Then edge
var-info, Then-info, Else-info (if required) are represented as unsigned
integer values on a sufficient set of bytes (MSByte first).
- Side Effects None
- Defined in
dddmpDump.c
static int
WriteByteBinary(
FILE * fp,
unsigned char c
)
- outputs a byte to file fp. Uses 0x00 as escape character
to filter , and . This is done for
compatibility between unix and dos/windows systems.
- Side Effects None
- See Also
ReadByteBinary()
- Defined in
dddmpBinary.c