3

I'm trying to import a BLIF file into the CUDD package, create a BDD out of it and then perform some manipulations. I've managed to import the BLIF file using the ntr package. However, I can't figure out how I'm supposed to access any of the variables or nodes in the resulting BDD.

If I created my own BDD for a function, I'd create the variables as I go and would be able to call them out to do different manipulations/operations. However, with the BLIF import, all I have is the resulting ddManager (dd) and the boolean network (net1). Does anyone know how to call up the individual variables/nodes? See the BLIF generation code below. Thanks!

NtrOptions *option; 
option = mainInit(); 
FILE *fp1; 
BnetNetwork *net1 = NULL; 
fp1 = fopen("C17.blif","r");
net1 = Bnet_ReadNetwork(fp1,1);
fclose(fp1);

DdManager *dd;
dd = Cudd_Init(0,0,CUDD_UNIQUE_SLOTS,CUDD_CACHE_SLOTS,0); 
Cudd_AutodynEnable(dd,CUDD_REORDER_SIFT);
int result;     
result = Ntr_buildDDs(net1,dd,option,NULL);
red_house
  • 63
  • 3

1 Answers1

0

Well turns out it wasn't that bad. See below. Just loop through the Boolean Network structure (net1) and look for the outputs using BNET_OUTPUT_NODE flag.

  BnetNode *node;
  DdNode **outputArray; /* output array to store BDD for each output */
  outputArray = (DdNode**)malloc(numOutputs * sizeof(DdNode*));
  int outCount = 0;
    for (node = net1->nodes; outCount < numOutputs; node = node->next) {
    if (node->type == BNET_OUTPUT_NODE){
            outputArray[outCount] = node->dd;
            outCount = outCount + 1;
        }
    }
red_house
  • 63
  • 3