CSE 8387 Mini Project
2
In this assignment, you are to parse a .pla file into an intermediate data structure and then you are to traverse this structure and build a BDD using the CUDD package. You should use the .pla parser that you created in homework 2 and then use the following code template for your main program.
/****************************************************************/
/* */
/* Mini-Project 2 Assignment – CSE 8387 */
/*
MAT 02/14/06 */
/* */
/****************************************************************/
#include
<stdio.h>
#include
<string.h>
#include
"util.h"
#include
"cudd.h"
#include
"cuddInt.h"
int main(int argc, char *argv[])
{
DdManager *manager;
DdNode *f;
FILE *fname;
long num_nodes;
/* Open the PLA file */
if(argv[1]==NULL)
{
fprintf(stderr,"main: no filename given in command line\n");
return(1);
}
fname = fopen(argv[1],"r");
if (!fname)
{
fprintf(stderr,"main:
cannot open file \"%s\"\n",argv[1]);
return(2);
}
/* Parse the PLA file */
/* netlist=YOUR_PLA_PARSER_HERE(); */
fclose(fname);
printf("\n PLA file %s with %d inputs
and %d outputs sucessfully parsed!\n",
netlist->sName, netlist->iNumInputs, netlist->iNumOutputs);
/* Initialize the DD manager */
manager = Cudd_Init(0, 0,
CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0);
/* Build the BDD corresponding to the
netlist */
/* f =
YOUR_PLA2BDD_FUNCTION_HERE(netlist); */
/* Output Statistics */
num_nodes=Cudd_ReadNodeCount(manager);
printf("*****************************************************************\n");
/* printf("Netlist %s converted to
BDD with %d PIs, %d POs and %ld nodes.\n",
netlist->name,netlist->npis,netlist->npos,num_nodes); */
/* Quit the BDD manager */
Cudd_Quit(manager);
return 0;}
You
should also use the following Makefile that will point to the libraries where
the CUDD package is installed.
#--------------------------------------------------------------------------- .SUFFIXES: .o .c .u
CC = gcc RANLIB = ranlib EXE = TARGET = main$(EXE) TARGETu = main-u
WHERE = /usr/local/cudd
INCLUDE = include
LIBS = $(WHERE)/lib/libdddmp.a $(WHERE)/lib/libcudd.a \ $(WHERE)/lib/libmtr.a $(WHERE)/lib/libst.a $(WHERE)/lib/libutil.a
SRC = main.c #YOUR_PLA_PARSER.c YOUR_PLA2BDD.c HDR = pla.h $(WHERE)/$(INCLUDE)/dddmp.h $(WHERE)/$(INCLUDE)/cudd.h \ $(WHERE)/$(INCLUDE)/cuddInt.h $(WHERE)/$(INCLUDE)/mtr.h \ $(WHERE)/$(INCLUDE)/util.h
OBJ = $(SRC:.c=.o) UBJ = $(SRC:.c=.u)
MFLAG = ICFLAGS = -g -O6 -Wall
XCFLAGS = -DHAVE_IEEE_754 -DBSD
CFLAGS = $(ICFLAGS) $(MFLAG) $(XCFLAGS)
DDDEBUG = LDFLAGS =
#------------------------------------------------------ $(TARGET): $(SRC) $(OBJ) $(HDR) $(LIBS) $(MNEMLIB) $(PURE) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) $(MNEMLIB) -lm
.c.o: $(HDR) $(CC) -c $< -I$(WHERE)/$(INCLUDE) $(CFLAGS) $(DDDEBUG)
# if the header files change, recompile $(OBJ): $(HDR) $(UBJ): $(HDR)
.c.u: $(SRC) $(HDR) cc -j -I$(INCLUDE) $(XCFLAGS) $<
clean: rm -f *.o *.u mon.out gmon.out *.pixie *.Addrs *.Counts mnem.* \ .pure core *.warnings
You
should prepare a report that includes a table with all of the .pla benchmark
names and the size of the BDD (in number of nodes) and the CPU time required to
build each BDD.
You
should also experiment with:
1)
Dynamic reordering with various
options
2)
Static reordering after the netlist
has been converted to a BDD