From d200265c5b765d941bc06e7b81a69a29b37806ac Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Mon, 18 Mar 2002 11:26:51 +0000 Subject: [PATCH] voici les bdd --- alliance/src/bdd/man1/Makefile.am | 1 + alliance/src/bdd/man1/bdd.1 | 479 +++++ alliance/src/bdd/man3/Makefile.am | 79 + alliance/src/bdd/man3/addbddassoc.3 | 86 + alliance/src/bdd/man3/addbddcircuitabl.3 | 82 + alliance/src/bdd/man3/addbddcircuitin.3 | 96 + alliance/src/bdd/man3/addbddcircuitout.3 | 66 + alliance/src/bdd/man3/addbddnode.3 | 83 + alliance/src/bdd/man3/addbddnodeassoc.3 | 101 + alliance/src/bdd/man3/addbddnodelist.3 | 78 + alliance/src/bdd/man3/addbddvar.3 | 73 + alliance/src/bdd/man3/addbddvarafter.3 | 75 + alliance/src/bdd/man3/addbddvarbefore.3 | 75 + alliance/src/bdd/man3/addbddvarfirst.3 | 59 + alliance/src/bdd/man3/addbddvarlast.3 | 59 + alliance/src/bdd/man3/applybddnode.3 | 85 + alliance/src/bdd/man3/applybddnodeite.3 | 78 + alliance/src/bdd/man3/applybddnodelist.3 | 96 + alliance/src/bdd/man3/applybddnodenot.3 | 68 + alliance/src/bdd/man3/applybddnodeterm.3 | 85 + alliance/src/bdd/man3/clearbddsystemref.3 | 52 + alliance/src/bdd/man3/clearbddsystemrefext.3 | 52 + alliance/src/bdd/man3/clearbddsystemrefint.3 | 52 + alliance/src/bdd/man3/cofactorbddnode.3 | 88 + alliance/src/bdd/man3/composebddnode.3 | 97 + alliance/src/bdd/man3/convertbddcircuitabl.3 | 69 + .../src/bdd/man3/convertbddcircuitsumabl.3 | 69 + alliance/src/bdd/man3/convertbddindexabl.3 | 76 + alliance/src/bdd/man3/convertbddmuxabl.3 | 90 + alliance/src/bdd/man3/convertbddnodeabl.3 | 77 + alliance/src/bdd/man3/convertbddnodesumabl.3 | 77 + alliance/src/bdd/man3/createbddcircuit.3 | 66 + alliance/src/bdd/man3/createbddsystem.3 | 89 + alliance/src/bdd/man3/decbddrefext.3 | 70 + alliance/src/bdd/man3/decbddrefint.3 | 71 + alliance/src/bdd/man3/delbddassoc.3 | 82 + alliance/src/bdd/man3/delbddcircuitout.3 | 63 + alliance/src/bdd/man3/delbddnode.3 | 66 + alliance/src/bdd/man3/delbddnodeassoc.3 | 98 + alliance/src/bdd/man3/delbddnodelist.3 | 74 + alliance/src/bdd/man3/destroybddassoc.3 | 77 + alliance/src/bdd/man3/destroybddcircuit.3 | 50 + alliance/src/bdd/man3/destroybddsystem.3 | 47 + alliance/src/bdd/man3/existbddnodeassocoff.3 | 90 + alliance/src/bdd/man3/existbddnodeassocon.3 | 90 + alliance/src/bdd/man3/garbagebddsystem.3 | 62 + alliance/src/bdd/man3/getbddnodenum.3 | 63 + alliance/src/bdd/man3/getbddnodesize.3 | 63 + alliance/src/bdd/man3/getbddnodesupport.3 | 81 + alliance/src/bdd/man3/getbddvarbyindex.3 | 66 + alliance/src/bdd/man3/getbddvarindex.3 | 67 + alliance/src/bdd/man3/getbddvarnode.3 | 66 + alliance/src/bdd/man3/getbddvarnodebyindex.3 | 66 + alliance/src/bdd/man3/implybddnode.3 | 78 + alliance/src/bdd/man3/incbddrefext.3 | 60 + alliance/src/bdd/man3/incbddrefint.3 | 60 + alliance/src/bdd/man3/intersectbddnode.3 | 78 + alliance/src/bdd/man3/isbddvarinsupport.3 | 83 + alliance/src/bdd/man3/markbddnode.3 | 70 + alliance/src/bdd/man3/relprodbddnodeassoc.3 | 100 + .../src/bdd/man3/reorderbddsystemdynamic.3 | 67 + .../src/bdd/man3/reorderbddsystemsimple.3 | 51 + alliance/src/bdd/man3/reorderbddsystemtop.3 | 51 + .../src/bdd/man3/reorderbddsystemwindow.3 | 51 + alliance/src/bdd/man3/resetbddcircuit.3 | 53 + alliance/src/bdd/man3/resetbddsystem.3 | 50 + alliance/src/bdd/man3/restrictbddnode.3 | 103 + alliance/src/bdd/man3/satisfybddnode.3 | 76 + alliance/src/bdd/man3/searchbddcircuitin.3 | 60 + alliance/src/bdd/man3/searchbddcircuitout.3 | 61 + alliance/src/bdd/man3/setbddrefext.3 | 73 + alliance/src/bdd/man3/simpbddnodedcoff.3 | 80 + alliance/src/bdd/man3/simpbddnodedcon.3 | 80 + alliance/src/bdd/man3/substbddnodeassoc.3 | 106 + alliance/src/bdd/man3/swapbddvar.3 | 67 + alliance/src/bdd/man3/testbddcircuit.3 | 54 + alliance/src/bdd/man3/unmarkbddnode.3 | 70 + alliance/src/bdd/man3/unsetbddrefext.3 | 73 + alliance/src/bdd/man3/viewbddcircuit.3 | 56 + alliance/src/bdd/man3/viewbddnode.3 | 68 + alliance/src/bdd/man3/viewbddsystem.3 | 54 + alliance/src/bdd/man3/viewbddsysteminfo.3 | 51 + alliance/src/bdd/src/Makefile.am | 27 + alliance/src/bdd/src/bdd.h | 1111 ++++++++++ alliance/src/bdd/src/bddalloc.c | 398 ++++ alliance/src/bdd/src/bddalloc.h | 77 + alliance/src/bdd/src/bddapply.c | 499 +++++ alliance/src/bdd/src/bddapply.h | 82 + alliance/src/bdd/src/bddassoc.c | 442 ++++ alliance/src/bdd/src/bddassoc.h | 81 + alliance/src/bdd/src/bddblock.c | 246 +++ alliance/src/bdd/src/bddblock.h | 79 + alliance/src/bdd/src/bddcheck.c | 262 +++ alliance/src/bdd/src/bddcheck.h | 77 + alliance/src/bdd/src/bddcircuit.c | 983 +++++++++ alliance/src/bdd/src/bddcircuit.h | 77 + alliance/src/bdd/src/bddcofactor.c | 175 ++ alliance/src/bdd/src/bddcofactor.h | 79 + alliance/src/bdd/src/bddcompose.c | 262 +++ alliance/src/bdd/src/bddcompose.h | 77 + alliance/src/bdd/src/bddconvert.c | 561 +++++ alliance/src/bdd/src/bddconvert.h | 79 + alliance/src/bdd/src/bdddump.c | 413 ++++ alliance/src/bdd/src/bdddump.h | 80 + alliance/src/bdd/src/bddenv.c | 82 + alliance/src/bdd/src/bddenv.h | 77 + alliance/src/bdd/src/bdderror.c | 291 +++ alliance/src/bdd/src/bdderror.h | 125 ++ alliance/src/bdd/src/bddexist.c | 330 +++ alliance/src/bdd/src/bddexist.h | 79 + alliance/src/bdd/src/bddexplosion.c | 118 ++ alliance/src/bdd/src/bddexplosion.h | 77 + alliance/src/bdd/src/bddflag.c | 223 ++ alliance/src/bdd/src/bddflag.h | 75 + alliance/src/bdd/src/bddfraction.c | 113 + alliance/src/bdd/src/bddfraction.h | 77 + alliance/src/bdd/src/bddfree.c | 305 +++ alliance/src/bdd/src/bddfree.h | 77 + alliance/src/bdd/src/bddgarbage.c | 140 ++ alliance/src/bdd/src/bddgarbage.h | 77 + alliance/src/bdd/src/bddheath.c | 170 ++ alliance/src/bdd/src/bddheath.h | 77 + alliance/src/bdd/src/bddhnode.c | 662 ++++++ alliance/src/bdd/src/bddhnode.h | 93 + alliance/src/bdd/src/bddhoper.c | 422 ++++ alliance/src/bdd/src/bddhoper.h | 77 + alliance/src/bdd/src/bddimply.c | 229 ++ alliance/src/bdd/src/bddimply.h | 77 + alliance/src/bdd/src/bddlog.c | 184 ++ alliance/src/bdd/src/bddlog.h | 77 + alliance/src/bdd/src/bddmark.c | 116 + alliance/src/bdd/src/bddmark.h | 77 + alliance/src/bdd/src/bddnode.c | 386 ++++ alliance/src/bdd/src/bddnode.h | 77 + alliance/src/bdd/src/bddoptimize.c | 175 ++ alliance/src/bdd/src/bddoptimize.h | 66 + alliance/src/bdd/src/bddreduce.c | 181 ++ alliance/src/bdd/src/bddreduce.h | 77 + alliance/src/bdd/src/bddref.c | 417 ++++ alliance/src/bdd/src/bddref.h | 77 + alliance/src/bdd/src/bddrelprod.c | 228 ++ alliance/src/bdd/src/bddrelprod.h | 77 + alliance/src/bdd/src/bddreorder.c | 462 ++++ alliance/src/bdd/src/bddreorder.h | 85 + alliance/src/bdd/src/bddresize.c | 205 ++ alliance/src/bdd/src/bddresize.h | 77 + alliance/src/bdd/src/bddsatisfy.c | 233 +++ alliance/src/bdd/src/bddsatisfy.h | 77 + alliance/src/bdd/src/bddsimpdc.c | 325 +++ alliance/src/bdd/src/bddsimpdc.h | 77 + alliance/src/bdd/src/bddsubst.c | 178 ++ alliance/src/bdd/src/bddsubst.h | 77 + alliance/src/bdd/src/bddsupport.c | 292 +++ alliance/src/bdd/src/bddsupport.h | 80 + alliance/src/bdd/src/bddsweep.c | 96 + alliance/src/bdd/src/bddsweep.h | 77 + alliance/src/bdd/src/bddsystem.c | 406 ++++ alliance/src/bdd/src/bddsystem.h | 77 + alliance/src/bdd/src/bddtest.c | 1864 +++++++++++++++++ alliance/src/bdd/src/bddtest.h | 140 ++ alliance/src/bdd/src/bddtransfert.c | 129 ++ alliance/src/bdd/src/bddtransfert.h | 67 + alliance/src/bdd/src/bdduser.c | 208 ++ alliance/src/bdd/src/bdduser.h | 77 + alliance/src/bdd/src/bddvar.c | 613 ++++++ alliance/src/bdd/src/bddvar.h | 80 + alliance/src/bdd/src/bddvaraux.c | 260 +++ alliance/src/bdd/src/bddvaraux.h | 80 + alliance/src/bdd/src/bddvartree.c | 490 +++++ alliance/src/bdd/src/bddvartree.h | 51 + alliance/src/bdd/src/main.c | 64 + 171 files changed, 25656 insertions(+) create mode 100644 alliance/src/bdd/man1/Makefile.am create mode 100644 alliance/src/bdd/man1/bdd.1 create mode 100644 alliance/src/bdd/man3/Makefile.am create mode 100644 alliance/src/bdd/man3/addbddassoc.3 create mode 100644 alliance/src/bdd/man3/addbddcircuitabl.3 create mode 100644 alliance/src/bdd/man3/addbddcircuitin.3 create mode 100644 alliance/src/bdd/man3/addbddcircuitout.3 create mode 100644 alliance/src/bdd/man3/addbddnode.3 create mode 100644 alliance/src/bdd/man3/addbddnodeassoc.3 create mode 100644 alliance/src/bdd/man3/addbddnodelist.3 create mode 100644 alliance/src/bdd/man3/addbddvar.3 create mode 100644 alliance/src/bdd/man3/addbddvarafter.3 create mode 100644 alliance/src/bdd/man3/addbddvarbefore.3 create mode 100644 alliance/src/bdd/man3/addbddvarfirst.3 create mode 100644 alliance/src/bdd/man3/addbddvarlast.3 create mode 100644 alliance/src/bdd/man3/applybddnode.3 create mode 100644 alliance/src/bdd/man3/applybddnodeite.3 create mode 100644 alliance/src/bdd/man3/applybddnodelist.3 create mode 100644 alliance/src/bdd/man3/applybddnodenot.3 create mode 100644 alliance/src/bdd/man3/applybddnodeterm.3 create mode 100644 alliance/src/bdd/man3/clearbddsystemref.3 create mode 100644 alliance/src/bdd/man3/clearbddsystemrefext.3 create mode 100644 alliance/src/bdd/man3/clearbddsystemrefint.3 create mode 100644 alliance/src/bdd/man3/cofactorbddnode.3 create mode 100644 alliance/src/bdd/man3/composebddnode.3 create mode 100644 alliance/src/bdd/man3/convertbddcircuitabl.3 create mode 100644 alliance/src/bdd/man3/convertbddcircuitsumabl.3 create mode 100644 alliance/src/bdd/man3/convertbddindexabl.3 create mode 100644 alliance/src/bdd/man3/convertbddmuxabl.3 create mode 100644 alliance/src/bdd/man3/convertbddnodeabl.3 create mode 100644 alliance/src/bdd/man3/convertbddnodesumabl.3 create mode 100644 alliance/src/bdd/man3/createbddcircuit.3 create mode 100644 alliance/src/bdd/man3/createbddsystem.3 create mode 100644 alliance/src/bdd/man3/decbddrefext.3 create mode 100644 alliance/src/bdd/man3/decbddrefint.3 create mode 100644 alliance/src/bdd/man3/delbddassoc.3 create mode 100644 alliance/src/bdd/man3/delbddcircuitout.3 create mode 100644 alliance/src/bdd/man3/delbddnode.3 create mode 100644 alliance/src/bdd/man3/delbddnodeassoc.3 create mode 100644 alliance/src/bdd/man3/delbddnodelist.3 create mode 100644 alliance/src/bdd/man3/destroybddassoc.3 create mode 100644 alliance/src/bdd/man3/destroybddcircuit.3 create mode 100644 alliance/src/bdd/man3/destroybddsystem.3 create mode 100644 alliance/src/bdd/man3/existbddnodeassocoff.3 create mode 100644 alliance/src/bdd/man3/existbddnodeassocon.3 create mode 100644 alliance/src/bdd/man3/garbagebddsystem.3 create mode 100644 alliance/src/bdd/man3/getbddnodenum.3 create mode 100644 alliance/src/bdd/man3/getbddnodesize.3 create mode 100644 alliance/src/bdd/man3/getbddnodesupport.3 create mode 100644 alliance/src/bdd/man3/getbddvarbyindex.3 create mode 100644 alliance/src/bdd/man3/getbddvarindex.3 create mode 100644 alliance/src/bdd/man3/getbddvarnode.3 create mode 100644 alliance/src/bdd/man3/getbddvarnodebyindex.3 create mode 100644 alliance/src/bdd/man3/implybddnode.3 create mode 100644 alliance/src/bdd/man3/incbddrefext.3 create mode 100644 alliance/src/bdd/man3/incbddrefint.3 create mode 100644 alliance/src/bdd/man3/intersectbddnode.3 create mode 100644 alliance/src/bdd/man3/isbddvarinsupport.3 create mode 100644 alliance/src/bdd/man3/markbddnode.3 create mode 100644 alliance/src/bdd/man3/relprodbddnodeassoc.3 create mode 100644 alliance/src/bdd/man3/reorderbddsystemdynamic.3 create mode 100644 alliance/src/bdd/man3/reorderbddsystemsimple.3 create mode 100644 alliance/src/bdd/man3/reorderbddsystemtop.3 create mode 100644 alliance/src/bdd/man3/reorderbddsystemwindow.3 create mode 100644 alliance/src/bdd/man3/resetbddcircuit.3 create mode 100644 alliance/src/bdd/man3/resetbddsystem.3 create mode 100644 alliance/src/bdd/man3/restrictbddnode.3 create mode 100644 alliance/src/bdd/man3/satisfybddnode.3 create mode 100644 alliance/src/bdd/man3/searchbddcircuitin.3 create mode 100644 alliance/src/bdd/man3/searchbddcircuitout.3 create mode 100644 alliance/src/bdd/man3/setbddrefext.3 create mode 100644 alliance/src/bdd/man3/simpbddnodedcoff.3 create mode 100644 alliance/src/bdd/man3/simpbddnodedcon.3 create mode 100644 alliance/src/bdd/man3/substbddnodeassoc.3 create mode 100644 alliance/src/bdd/man3/swapbddvar.3 create mode 100644 alliance/src/bdd/man3/testbddcircuit.3 create mode 100644 alliance/src/bdd/man3/unmarkbddnode.3 create mode 100644 alliance/src/bdd/man3/unsetbddrefext.3 create mode 100644 alliance/src/bdd/man3/viewbddcircuit.3 create mode 100644 alliance/src/bdd/man3/viewbddnode.3 create mode 100644 alliance/src/bdd/man3/viewbddsystem.3 create mode 100644 alliance/src/bdd/man3/viewbddsysteminfo.3 create mode 100644 alliance/src/bdd/src/Makefile.am create mode 100644 alliance/src/bdd/src/bdd.h create mode 100644 alliance/src/bdd/src/bddalloc.c create mode 100644 alliance/src/bdd/src/bddalloc.h create mode 100644 alliance/src/bdd/src/bddapply.c create mode 100644 alliance/src/bdd/src/bddapply.h create mode 100644 alliance/src/bdd/src/bddassoc.c create mode 100644 alliance/src/bdd/src/bddassoc.h create mode 100644 alliance/src/bdd/src/bddblock.c create mode 100644 alliance/src/bdd/src/bddblock.h create mode 100644 alliance/src/bdd/src/bddcheck.c create mode 100644 alliance/src/bdd/src/bddcheck.h create mode 100644 alliance/src/bdd/src/bddcircuit.c create mode 100644 alliance/src/bdd/src/bddcircuit.h create mode 100644 alliance/src/bdd/src/bddcofactor.c create mode 100644 alliance/src/bdd/src/bddcofactor.h create mode 100644 alliance/src/bdd/src/bddcompose.c create mode 100644 alliance/src/bdd/src/bddcompose.h create mode 100644 alliance/src/bdd/src/bddconvert.c create mode 100644 alliance/src/bdd/src/bddconvert.h create mode 100644 alliance/src/bdd/src/bdddump.c create mode 100644 alliance/src/bdd/src/bdddump.h create mode 100644 alliance/src/bdd/src/bddenv.c create mode 100644 alliance/src/bdd/src/bddenv.h create mode 100644 alliance/src/bdd/src/bdderror.c create mode 100644 alliance/src/bdd/src/bdderror.h create mode 100644 alliance/src/bdd/src/bddexist.c create mode 100644 alliance/src/bdd/src/bddexist.h create mode 100644 alliance/src/bdd/src/bddexplosion.c create mode 100644 alliance/src/bdd/src/bddexplosion.h create mode 100644 alliance/src/bdd/src/bddflag.c create mode 100644 alliance/src/bdd/src/bddflag.h create mode 100644 alliance/src/bdd/src/bddfraction.c create mode 100644 alliance/src/bdd/src/bddfraction.h create mode 100644 alliance/src/bdd/src/bddfree.c create mode 100644 alliance/src/bdd/src/bddfree.h create mode 100644 alliance/src/bdd/src/bddgarbage.c create mode 100644 alliance/src/bdd/src/bddgarbage.h create mode 100644 alliance/src/bdd/src/bddheath.c create mode 100644 alliance/src/bdd/src/bddheath.h create mode 100644 alliance/src/bdd/src/bddhnode.c create mode 100644 alliance/src/bdd/src/bddhnode.h create mode 100644 alliance/src/bdd/src/bddhoper.c create mode 100644 alliance/src/bdd/src/bddhoper.h create mode 100644 alliance/src/bdd/src/bddimply.c create mode 100644 alliance/src/bdd/src/bddimply.h create mode 100644 alliance/src/bdd/src/bddlog.c create mode 100644 alliance/src/bdd/src/bddlog.h create mode 100644 alliance/src/bdd/src/bddmark.c create mode 100644 alliance/src/bdd/src/bddmark.h create mode 100644 alliance/src/bdd/src/bddnode.c create mode 100644 alliance/src/bdd/src/bddnode.h create mode 100644 alliance/src/bdd/src/bddoptimize.c create mode 100644 alliance/src/bdd/src/bddoptimize.h create mode 100644 alliance/src/bdd/src/bddreduce.c create mode 100644 alliance/src/bdd/src/bddreduce.h create mode 100644 alliance/src/bdd/src/bddref.c create mode 100644 alliance/src/bdd/src/bddref.h create mode 100644 alliance/src/bdd/src/bddrelprod.c create mode 100644 alliance/src/bdd/src/bddrelprod.h create mode 100644 alliance/src/bdd/src/bddreorder.c create mode 100644 alliance/src/bdd/src/bddreorder.h create mode 100644 alliance/src/bdd/src/bddresize.c create mode 100644 alliance/src/bdd/src/bddresize.h create mode 100644 alliance/src/bdd/src/bddsatisfy.c create mode 100644 alliance/src/bdd/src/bddsatisfy.h create mode 100644 alliance/src/bdd/src/bddsimpdc.c create mode 100644 alliance/src/bdd/src/bddsimpdc.h create mode 100644 alliance/src/bdd/src/bddsubst.c create mode 100644 alliance/src/bdd/src/bddsubst.h create mode 100644 alliance/src/bdd/src/bddsupport.c create mode 100644 alliance/src/bdd/src/bddsupport.h create mode 100644 alliance/src/bdd/src/bddsweep.c create mode 100644 alliance/src/bdd/src/bddsweep.h create mode 100644 alliance/src/bdd/src/bddsystem.c create mode 100644 alliance/src/bdd/src/bddsystem.h create mode 100644 alliance/src/bdd/src/bddtest.c create mode 100644 alliance/src/bdd/src/bddtest.h create mode 100644 alliance/src/bdd/src/bddtransfert.c create mode 100644 alliance/src/bdd/src/bddtransfert.h create mode 100644 alliance/src/bdd/src/bdduser.c create mode 100644 alliance/src/bdd/src/bdduser.h create mode 100644 alliance/src/bdd/src/bddvar.c create mode 100644 alliance/src/bdd/src/bddvar.h create mode 100644 alliance/src/bdd/src/bddvaraux.c create mode 100644 alliance/src/bdd/src/bddvaraux.h create mode 100644 alliance/src/bdd/src/bddvartree.c create mode 100644 alliance/src/bdd/src/bddvartree.h create mode 100644 alliance/src/bdd/src/main.c diff --git a/alliance/src/bdd/man1/Makefile.am b/alliance/src/bdd/man1/Makefile.am new file mode 100644 index 00000000..14b25bb4 --- /dev/null +++ b/alliance/src/bdd/man1/Makefile.am @@ -0,0 +1 @@ +man_MANS = bdd.1 diff --git a/alliance/src/bdd/man1/bdd.1 b/alliance/src/bdd/man1/bdd.1 new file mode 100644 index 00000000..3906a8d5 --- /dev/null +++ b/alliance/src/bdd/man1/bdd.1 @@ -0,0 +1,479 @@ +.\" $Id: bdd.1,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)bdd.1 1.01 96/02/07 UPMC; Author : Jacomme Ludovic +.TH BDD101 1 "October 1, 1997" "ASIM/LIP6" "ALLIANCE BDD LIBRARY" +.SH NAME +bdd \- Mutli Reduced Ordered Binary Decision Diagrams +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBbdd\fP is a library that enables to represent a boolean expression +as a Multi Reduced Ordered Binary Decision Diagrams. +.TP 20 +.br +\fBviewbddallocinfo\fP +\- displays memory informations. +.TP +\fBapplybddnodenot\fP +\- complements a \fBbdd\fP. +.TP +\fBapplybddnodeterm\fP +\- applies an operator on two \fBbdd\fP nodes. +.TP +\fBapplybddnode\fP +\- applies an operator on two \fBbdd\fP nodes. +.TP +\fBapplybddnodeite\fP +\- computes the IF-THEN-ELSE logical operation. +.TP +\fBapplybddnodelist\fP +\- applies an opertor to a \fBbdd\fP nodes list. +.TP +\fBaddbddassoc\fP +\- creates a new association variables. +.TP +\fBaddbddnodeassoc\fP +\- adds a \fBbdd\fP node in a variable association. +.TP +\fBdelbddassoc\fP +\- deletes a variable association. +.TP +\fBdelbddnodeassoc\fP +\- deletes a \fBbdd\fP node in a variable association. +.TP +\fBdestroybddassoc\fP +\- frees all the variable associations. +.TP +\fBviewbddassoc\fP +\- displays variable associations. +.TP +\fBcheckbddvar\fP +\- checks the coherence of a variable. +.TP +\fBcheckbddindex\fP +\- checks the coherence of a \fBbdd\fP index. +.TP +\fBcheckbddoper\fP +\- ckecks the coherence of an operator. +.TP +\fBcheckbddassoc\fP +\- checks a variable association. +.TP +\fBcheckbddmaxnode\fP +\- checks if the max node reached. +.TP +\fBcreatebddcircuit\fP +\- creates a \fBbdd\fP circuit. +.TP +\fBresetbddcircuit\fP +\- resets a \fBbdd\fP circuit. +.TP +\fBdestroybddcircuit\fP +\- frees a \fBbdd\fP circuit. +.TP +\fBsearchbddcircuitin\fP +\- searches a specified input in a circuit. +.TP +\fBaddbddcircuitin\fP +\- adds a new input in a circuit. +.TP +\fBaddbddcircuitaux\fP +\- adds an auxialiary variable in a circuit. +.TP +\fBsearchbddcircuitout\fP +\- searches a specified output in a circuit. +.TP +\fBaddbddcircuitout\fP +\- adds a new output in a circuit. +.TP +\fBdelbddcircuitout\fP +\- deletes a specified output in a circuit. +.TP +\fBaddbddcircuitabl\fP +\- converts an \fBabl\fP to a \fBbdd\fP node. +.TP +\fBconvertbddcircuitabl\fP +\- converts a \fBbdd\fP node to an \fBabl\fP. +.TP +\fBconvertbddcircuitsumabl\fP +\- converts a \fBbdd\fP node to an \fBabl\fP. +.TP +\fBviewbddcircuit\fP +\- displays a \fBbdd\fP circuit. +.TP +\fBcofactorbddnode\fP +\- computes the generalized cofactor. +.TP +\fBrestrictbddnode\fP +\- substitutes a variable by zero or one. +.TP +\fBcomposebddnode\fP +\- substitutes a variable by a \fBbdd\fP node. +.TP +\fBconvertbddindexabl\fP +\- converts a \fBbdd\fP index to an atomic \fBabl\fP. +.TP +\fBconvertbddmuxabl\fP +\- converts a \fBbdd\fP node to a multiplexor. +.TP +\fBconvertbddnodeabl\fP +\- converts a \fBbdd\fP node to an \fBabl\fP. +.TP +\fBconvertbddnodesumabl\fP +\- converts a \fBbdd\fP node to an \fBabl\fP. +.TP +\fBexistbddnodeassocon\fP +\- computes an existantial quantification. +.TP +\fBexistbddnodeassocoff\fP +\- computes an existantial quantification. +.TP +\fBgarbagebddsystem\fP +\- forces a \fBbdd\fP garbage collection. +.TP +\fBimplybddnode\fP +\- computes a \fBbdd\fP that implies a conjonction. +.TP +\fBintersectbddnode\fP +\- tests for an intersection. +.TP +\fBmarkbddnode\fP +\- marks a \fBbdd\fP node. +.TP +\fBunmarkbddnode\fP +\- clears a marked \fBbdd\fP node. +.TP +\fBgetbddnodenum\fP +\- gets the number of nodes in a \fBbdd\fP. +.TP +\fBgetbddnodesize\fP +\- gets the number of nodes in a \fBbdd\fP. +.TP +\fBaddbddnode\fP +\- adds a new \fBbdd\fP node. +.TP +\fBaddbddnodelist\fP +\- adds a node in a \fIchain_list\fP. +.TP +\fBdelbddnode\fP +\- deletes a \fBbdd\fP node. +.TP +\fBdelbddnodelist\fP +\- deletes a list of \fBbdd\fP nodes. +.TP +\fBviewbddnode\fP +\- displays a \fBbdd\fP node. +.TP +\fBincbddrefext\fP +\- increments the number of external reference. +.TP +\fBincbddrefint\fP +\- increments the number of internal reference. +.TP +\fBdecbddrefext\fP +\- decrements the number of external reference. +.TP +\fBdecbddrefint\fP +\- decrements the number of internal reference. +.TP +\fBsetbddrefext\fP +\- sets a node visible from outside. +.TP +\fBunsetbddrefext\fP +\- sets a node invisible from outside. +.TP +\fBclearbddsystemrefint\fP +\- clears all the internal references. +.TP +\fBclearbddsystemrefext\fP +\- clears all the external references. +.TP +\fBclearbddsystemref\fP +\- clears all the references. +.TP +\fBrelprodbddnodeassoc\fP +\- computes a relation product. +.TP +\fBreorderbddsystemsimple\fP +\- reorders the \fBbdd\fP nodes. +.TP +\fBreorderbddsystemwindow\fP +\- reorders the \fBbdd\fP nodes. +.TP +\fBreorderbddsystemtop\fP +\- reorders the \fBbdd\fP nodes. +.TP +\fBreorderbddsystemdynamic\fP +\- sets the dynamic reorder parameters. +.TP +\fBsatisfybddnode\fP +\- finds a satisfying path for a \fBbdd\fP. +.TP +\fBsimpbddnodedcon\fP +\- simplifies a \fBbdd\fP with don't cares on its on-set. +.TP +\fBsimpbddnodedcoff\fP +\- simplifies a \fBbdd\fP with don't cares on its off-set +.TP +\fBsubstbddnodeassoc\fP +\- substitutes variables with \fBbdd\fP nodes. +.TP +\fBgetbddnodesupport\fP +\- gives the support of a \fBbdd\fP node. +.TP +\fBisbddvarinsupport\fP +\- checks if a variable appears in a \fBbdd\fP node. +.TP +\fBcreatebddsystem\fP +\- creates a \fBbdd\fP system. +.TP +\fBresetbddsystem\fP +\- resets a \fBbdd\fP system. +.TP +\fBdestroybddsystem\fP +\- frees a \fBbdd\fP system. +.TP +\fBviewbddsystem\fP +\- displays a \fBbdd\fP system. +.TP +\fBviewbddsysteminfo\fP +\- displays statisticals informations. +.TP +\fBtestbddcircuit\fP +\- debbugs a \fBbdd\fP circuit. +.TP +\fBaddbddvar\fP +\- creates a new variable. +.TP +\fBaddbddvarlast\fP +\- creates a new variable. +.TP +\fBaddbddvarfirst\fP +\- creates a new variable. +.TP +\fBaddbddvarbefore\fP +\- creates a new variable. +.TP +\fBaddbddvarafter\fP +\- creates a new variable. +.TP +\fBsweepbddvar\fP +\- sweeps all the unused nodes for a variable. +.TP +\fBswapbddvar\fP +\- swaps two contigous variables. +.TP +\fBgetbddvarbyindex\fP +\- converts \fBbdd\fP index to a variable number. +.TP +\fBgetbddvarindex\fP +\- converts a variable number in a \fBbdd\fP index. +.TP +\fBgetbddvarnode\fP +\- gives the \fBbdd\fP node of a variable. +.TP +\fBgetbddvarnodebyindex\fP +\- gives the \fBbdd\fP node of a variable. +.TP +\fBaddbddvarauxsingle\fP +\- creates an auxiliary variable. +.TP +\fBaddbddvarauxglobal\fP +\- creates an auxiliary variable. + +.TP 0 +libBdd101.a : + +\fBallocbdduserfunc\fP, +\fBallocbddheath\fP, +\fBallocbddhnode\fP, +\fBallocbddhoper\fP, +\fBallocbddhnodetable\fP, +\fBallocbddhopertable\fP, +\fBallocbddblock\fP, +\fBallocbddnodeblock\fP, +\fBallocbddvartree\fP, +\fBallocbddvarchild\fP, +\fBallocbddvarnode\fP, +\fBallocbddindexnode\fP, +\fBallocbddvar\fP, +\fBallocbddindex\fP, +\fBallocbddassoc\fP, +\fBallocbddassocnode\fP, +\fBallocbddnamein\fP, +\fBallocbddindexin\fP, +\fBallocbddsystem\fP, +\fBallocbddcircuit\fP, +\fBviewbddallocinfo\fP, +\fBapplybddnodenot\fP, +\fBapplybddnodeterm\fP, +\fBapplybddnode\fP, +\fBapplybddnodeite\fP, +\fBapplybddnodelist\fP, +\fBaddbddassoc\fP, +\fBaddbddnodeassoc\fP, +\fBdelbddassoc\fP, +\fBdelbddnodeassoc\fP, +\fBdestroybddassoc\fP, +\fBviewbddassoc\fP, +\fBaddbddblock\fP, +\fBcreatebddblock\fP, +\fBresetbddblock\fP, +\fBdestroybddblock\fP, +\fBviewbddblock\fP, +\fBcheckbddvar\fP, +\fBcheckbddindex\fP, +\fBcheckbddoper\fP, +\fBcheckbddassoc\fP, +\fBcheckbddmaxnode\fP, +\fBcreatebddcircuit\fP, +\fBresetbddcircuit\fP, +\fBdestroybddcircuit\fP, +\fBsearchbddcircuitin\fP, +\fBaddbddcircuitin\fP, +\fBaddbddcircuitaux\fP, +\fBsearchbddcircuitout\fP, +\fBaddbddcircuitout\fP, +\fBdelbddcircuitout\fP, +\fBaddbddcircuitabl\fP, +\fBconvertbddcircuitabl\fP, +\fBconvertbddcircuitsumabl\fP, +\fBviewbddcircuit\fP, +\fBcofactorbddnode\fP, +\fBrestrictbddnode\fP, +\fBcomposebddnode\fP, +\fBconvertbddindexabl\fP, +\fBconvertbddmuxabl\fP, +\fBconvertbddnodeabl\fP, +\fBconvertbddnodesumabl\fP, +\fBexistbddnodeassocon\fP, +\fBexistbddnodeassocoff\fP, +\fBfreebdduserfunc\fP, +\fBfreebddheath\fP, +\fBfreebddhnode\fP, +\fBfreebddhoper\fP, +\fBfreebddhnodetable\fP, +\fBfreebddhopertable\fP, +\fBfreebddblock\fP, +\fBfreebddnodeblock\fP, +\fBfreebddvartree\fP, +\fBfreebddvarchild\fP, +\fBfreebddvarnode\fP, +\fBfreebddindexnode\fP, +\fBfreebddvar\fP, +\fBfreebddindex\fP, +\fBfreebddassoc\fP, +\fBfreebddassocnode\fP, +\fBfreebddnamein\fP, +\fBfreebddindexin\fP, +\fBfreebddsystem\fP, +\fBfreebddcircuit\fP, +\fBgarbagebddsystem\fP, +\fBgetbddheathvar\fP, +\fBgetbddheath\fP, +\fBdelbddheath\fP, +\fBsetbddhnodefunc\fP, +\fBgetbddhnodesize\fP, +\fBgetbddhnodekey\fP, +\fBgetbddhnodeindex\fP, +\fBcheckbddhnode\fP, +\fBcreatebddhnodetable\fP, +\fBdestroybddhnodetable\fP, +\fBresetbddhnodetable\fP, +\fBresizebddhnodetable\fP, +\fBstretchbddhnodetable\fP, +\fBaddbddhnode\fP, +\fBdelbddhnode\fP, +\fBviewbddhnode\fP, +\fBviewbddhnodetable\fP, +\fBviewbddindexnode\fP, +\fBviewbddvarnode\fP, +\fBsetbddhoperfunc\fP, +\fBgetbddhopersize\fP, +\fBgetbddhoperkey\fP, +\fBcreatebddhopertable\fP, +\fBdestroybddhopertable\fP, +\fBresetbddhopertable\fP, +\fBaddbddhoper\fP, +\fBsearchbddhoper\fP, +\fBviewbddhoper\fP, +\fBviewbddhopertable\fP, +\fBimplybddnode\fP, +\fBintersectbddnode\fP, +\fBmarkbddnode\fP, +\fBunmarkbddnode\fP, +\fBgetbddnodenum\fP, +\fBgetbddnodesize\fP, +\fBaddbddnode\fP, +\fBaddbddnodelist\fP, +\fBdelbddnode\fP, +\fBdelbddnodelist\fP, +\fBviewbddnode\fP, +\fBincbddrefext\fP, +\fBincbddrefint\fP, +\fBdecbddrefext\fP, +\fBdecbddrefint\fP, +\fBsetbddrefext\fP, +\fBunsetbddrefext\fP, +\fBclearbddsystemrefint\fP, +\fBclearbddsystemrefext\fP, +\fBclearbddsystemref\fP, +\fBrelprodbddnodeassoc\fP, +\fBreorderbddvartreewindow2\fP, +\fBreorderbddvartreewindow3\fP, +\fBreorderbddsystemsimple\fP, +\fBreorderbddsystemwindow\fP, +\fBreorderbddsystemtop\fP, +\fBreorderbddsystemdynamic\fP, +\fBresizebddvarchild\fP, +\fBresizebddvarnode\fP, +\fBresizebddvar\fP, +\fBresizebddindexnode\fP, +\fBresizebddindex\fP, +\fBresizebddassocnode\fP, +\fBresizebddnamein\fP, +\fBresizebddindexin\fP, +\fBsatisfybddnode\fP, +\fBsimpbddnodedcon\fP, +\fBsimpbddnodedcoff\fP, +\fBsubstbddnodeassoc\fP, +\fBgetbddnodesupport\fP, +\fBisbddvarinsupport\fP, +\fBcreatebddsystem\fP, +\fBresetbddsystem\fP, +\fBdestroybddsystem\fP, +\fBviewbddsystem\fP, +\fBviewbddsysteminfo\fP, +\fBtestbddcircuit\fP, +\fBaddbdduserfunc\fP, +\fBdelbdduserfunc\fP, +\fBexecbdduserfunc\fP, +\fBdestroybdduserfunc\fP, +\fBnewbddvar\fP, +\fBaddbddvar\fP, +\fBaddbddvarlast\fP, +\fBaddbddvarfirst\fP, +\fBaddbddvarbefore\fP, +\fBaddbddvarafter\fP, +\fBsweepbddvar\fP, +\fBswapbddvar\fP, +\fBgetbddvarbyindex\fP, +\fBgetbddvarindex\fP, +\fBgetbddvarnode\fP, +\fBgetbddvarnodebyindex\fP, +\fBaddbddvarauxsingle\fP, +\fBaddbddvarauxglobal\fP, +\fBsearchbddvartree\fP, +\fBdeltabddvartree\fP, +\fBshiftbddvartree\fP, +\fBaddbddvartree\fP, +\fBswapbddvartree\fP, +\fBcreatebddvartree\fP, +\fBresetbddvartree\fP, +\fBdestroybddvartree\fP, +\fBviewbddvartree\fP. + +.SH SEE ALSO +.BR \fBaut\fP(1), \fBabl\fP(1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/Makefile.am b/alliance/src/bdd/man3/Makefile.am new file mode 100644 index 00000000..8ca28858 --- /dev/null +++ b/alliance/src/bdd/man3/Makefile.am @@ -0,0 +1,79 @@ +man_MANS = addbddassoc.3 \ +addbddcircuitabl.3 \ +addbddcircuitin.3 \ +addbddcircuitout.3 \ +addbddnode.3 \ +addbddnodeassoc.3 \ +addbddnodelist.3 \ +addbddvar.3 \ +addbddvarafter.3 \ +addbddvarbefore.3 \ +addbddvarfirst.3 \ +addbddvarlast.3 \ +applybddnode.3 \ +applybddnodeite.3 \ +applybddnodelist.3 \ +applybddnodenot.3 \ +applybddnodeterm.3 \ +clearbddsystemref.3 \ +clearbddsystemrefext.3 \ +clearbddsystemrefint.3 \ +cofactorbddnode.3 \ +composebddnode.3 \ +convertbddcircuitabl.3 \ +convertbddcircuitsumabl.3 \ +convertbddindexabl.3 \ +convertbddmuxabl.3 \ +convertbddnodeabl.3 \ +convertbddnodesumabl.3 \ +createbddcircuit.3 \ +createbddsystem.3 \ +decbddrefext.3 \ +decbddrefint.3 \ +delbddassoc.3 \ +delbddcircuitout.3 \ +delbddnode.3 \ +delbddnodeassoc.3 \ +delbddnodelist.3 \ +destroybddassoc.3 \ +destroybddcircuit.3 \ +destroybddsystem.3 \ +existbddnodeassocoff.3 \ +existbddnodeassocon.3 \ +garbagebddsystem.3 \ +getbddnodenum.3 \ +getbddnodesize.3 \ +getbddnodesupport.3 \ +getbddvarbyindex.3 \ +getbddvarindex.3 \ +getbddvarnode.3 \ +getbddvarnodebyindex.3 \ +implybddnode.3 \ +incbddrefext.3 \ +incbddrefint.3 \ +intersectbddnode.3 \ +isbddvarinsupport.3 \ +markbddnode.3 \ +relprodbddnodeassoc.3 \ +reorderbddsystemdynamic.3 \ +reorderbddsystemsimple.3 \ +reorderbddsystemtop.3 \ +reorderbddsystemwindow.3 \ +resetbddcircuit.3 \ +resetbddsystem.3 \ +restrictbddnode.3 \ +satisfybddnode.3 \ +searchbddcircuitin.3 \ +searchbddcircuitout.3 \ +setbddrefext.3 \ +simpbddnodedcoff.3 \ +simpbddnodedcon.3 \ +substbddnodeassoc.3 \ +swapbddvar.3 \ +testbddcircuit.3 \ +unmarkbddnode.3 \ +unsetbddrefext.3 \ +viewbddcircuit.3 \ +viewbddnode.3 \ +viewbddsystem.3 \ +viewbddsysteminfo.3 diff --git a/alliance/src/bdd/man3/addbddassoc.3 b/alliance/src/bdd/man3/addbddassoc.3 new file mode 100644 index 00000000..6c761fb8 --- /dev/null +++ b/alliance/src/bdd/man3/addbddassoc.3 @@ -0,0 +1,86 @@ +.\" $Id: addbddassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddassoc \- creates a new association variables. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddassoc \(**addbddassoc( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBaddbddassoc\fP creates a new association variables in the \fBbdd\fP system +\fIBddSystem\fP. If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddassoc\fP returns a pointer to the new variable association. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variable association, error !" +.ft R +.RS +There is no variable association number left. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + delbddassoc( (bddsystem \(**)0, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddcircuitabl.3 b/alliance/src/bdd/man3/addbddcircuitabl.3 new file mode 100644 index 00000000..fab0f9d1 --- /dev/null +++ b/alliance/src/bdd/man3/addbddcircuitabl.3 @@ -0,0 +1,82 @@ +.\" $Id: addbddcircuitabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddcircuitabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDCIRCUITABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddcircuitabl \- converts an \fBabl\fP expression to a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddcircuitabl( BddCircuit, Expr ) + bddcircuit \(**BddCircuit; + chain_list \(**Expr; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIExpr\fP +The expression to convert. +.SH DESCRIPTION +\fBaddbddcircuitabl\fP converts the \fBabl\fP expression \fIExpr\fP +to a \fBbdd\fP node. The \fIBddCircuit\fP is used to translate +the atomic expressions into variable nodes. +If a null pointer is given, the default \fBbdd\fP circuit is used. +If an atomic expression doesn't appear in the \fIBddCircuit\fP +input names hash table or output names hash table, +then \fIaddbddcircuitabl\fP adds a new input by calling the function +\fIaddbddcircuitin\fP with the BDD_IN_MODE_LAST mode. +.br +.SH RETURN VALUE +\fBaddbddcircuitabl\fP returns a pointer to the \fBbdd\fP node translated. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad operator xxx error !" +.ft R +.RS +The \fIExpr\fP parameter must be a well defined \fBabl\fP expression. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (i0 and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1), +.BR convertbddcircuitabl(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddcircuitin.3 b/alliance/src/bdd/man3/addbddcircuitin.3 new file mode 100644 index 00000000..1fe8ce51 --- /dev/null +++ b/alliance/src/bdd/man3/addbddcircuitin.3 @@ -0,0 +1,96 @@ +.\" $Id: addbddcircuitin.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddcircuitin.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDCIRCUITIN 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddcircuitin \- adds an input in a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddcircuitin( BddCircuit, InputName, Index, Mode ) + bddcircuit \(**BddCircuit; + char \(**InputName; + bddindex Index; + long Mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIInputName\fP +The name of the input. +.TP +\fIIndex\fP +The \fBbdd\fP index of the input. +.TP +\fIMode\fP +The mode. +.SH DESCRIPTION +\fBaddbddcircuitin\fP adds an input \fIInputName\fP in the \fBbdd\fP circuit +\fIBddCircuit\fP. If a null pointer is given, the default \fBbdd\fP circuit is used. +If the input \fIInputName\fP exists already, its node pointer is returned. +The \fIMode\fP parameter specifies how to create the new variable associated +to the name \fIInputName\fP. The \fIIndex\fP parameter is used with the +BDD_IN_MODE_BEFORE and BDD_IN_MODE_AFTER mode. +The \fIMode\fP parameter can takes the following values : +.TP 20 +BDD_IN_MODE_FIRST +adds a variable before all others. +.TP +BDD_IN_MODE_LAST +adds a variable after all others. +.TP +BDD_IN_MODE_BEFORE +adds a variable before the one specified by \fIIndex\fP. +.TP +BDD_IN_MODE_AFTER +adds a variable after the one specified by \fIIndex\fP. +.TP +BDD_IN_MODE_IMPOSE +if this flag is set, only the variables found in the \fIBddCircuit\fP +are taken into account. It permits to merge variables from different +circuit working on the same \fBbdd\fP system. +.br +.SH RETURN VALUE +\fBaddbddcircuitin\fP returns a pointer to the new created node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"unknwon in mode xxx error !" +.ft R +.RS +The \fIMode\fP parameter must be defined. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin ( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + ... + BddNode = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddcircuitout.3 b/alliance/src/bdd/man3/addbddcircuitout.3 new file mode 100644 index 00000000..50861b6a --- /dev/null +++ b/alliance/src/bdd/man3/addbddcircuitout.3 @@ -0,0 +1,66 @@ +.\" $Id: addbddcircuitout.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddcircuitout.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDCIRCUITOUT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddcircuitout \- adds an output in a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddcircuitout( BddCircuit, OutputName, BddNode ) + bddcircuit \(**BddCircuit; + char \(**OutputName; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIOutputName\fP +The name of the output. +.TP +\fIBddNode\fP +The \fBbdd\fP node of the output. +.SH DESCRIPTION +\fBaddbddcircuitout\fP adds \fIBddNode\fP as an output \fIOutputName\fP in the \fBbdd\fP circuit +\fIBddCircuit\fP. If a null pointer is given, the default \fBbdd\fP circuit is used. +If the output \fIOutputName\fP exists already, the number of external reference of the old node +is decremented, and the output node is replaced by the new one. +.br +.SH RETURN VALUE +\fBaddbddcircuitout\fP returns the node \fIBddNode\fP with its number of external +reference incremented. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + addbddcircuitout( (bddcircuit \(**)0, "Out0", BddNode ); + ... + BddNode = searchbddcircuitout( (bddcircuit \(**)0, "Out0" ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) +.BR searchbddcircuitout(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddnode.3 b/alliance/src/bdd/man3/addbddnode.3 new file mode 100644 index 00000000..abc88a75 --- /dev/null +++ b/alliance/src/bdd/man3/addbddnode.3 @@ -0,0 +1,83 @@ +.\" $Id: addbddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddnode \- adds a new \fBbdd\fP node in the \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddnode( BddSystem, Index, High, Low ) + bddsystem \(**BddSystem; + bddindex Index; + bddnode \(**High; + bddnode \(**Low; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIIndex\fP +The \fBbdd\fP index. +.TP +\fIHigh\fP +The \fBbdd\fP high pointer. +.TP +\fILow\fP +The \fBbdd\fP low pointer. +.SH DESCRIPTION +\fBaddbddnode\fP adds a new node with the index \fIIndex\fP, +\fIHigh\fP as HIGH pointer, and \fILow\fP as LOW pointer +in the \fBbdd\fP system \fIBddSystem\fP. If the \fBbdd\fP node exist +already \fBaddbddnode\fP return its pointer. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddnode\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range" +.ft R +.RS +The \fIIndex\fP parameter must be a valid index. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddnodeassoc.3 b/alliance/src/bdd/man3/addbddnodeassoc.3 new file mode 100644 index 00000000..61c93996 --- /dev/null +++ b/alliance/src/bdd/man3/addbddnodeassoc.3 @@ -0,0 +1,101 @@ +.\" $Id: addbddnodeassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddnodeassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDNODEASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddnodeassoc \- adds a \fBbdd\fP node in a variable association. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddassoc \(**addbddnodeassoc( BddSystem, BddAssoc, Variable, BddNode ) + bddsystem \(**BddSystem; + bddassoc \(**BddAssoc; + bddvar Variable; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddAssoc\fP +The variable association. +.TP +\fIVariable\fP +The variable number. +.TP +\fIBddNode\fP +The \fBbdd\fP node to add. +.SH DESCRIPTION +\fBaddbddnodeassoc\fP adds the \fBbdd\fP node \fIBddNode\fP, associated to the +variable number \fIVariable\fP, in the variable association \fIBddAssoc\fP, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The number of external reference of \fIBddNode\fP is incremented. +.br +.SH RETURN VALUE +\fBaddbddnodeassoc\fP returns a pointer to the variable association. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddnodelist.3 b/alliance/src/bdd/man3/addbddnodelist.3 new file mode 100644 index 00000000..c510795d --- /dev/null +++ b/alliance/src/bdd/man3/addbddnodelist.3 @@ -0,0 +1,78 @@ +.\" $Id: addbddnodelist.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddnodelist.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDNODELIST 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddnodelist \- adds a node in a \fIchain_list\fP. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list \(**addbddnodelist( BddSystem, HeadList, BddNode ) + bddsystem \(**BddSystem; + chain_list \(**HeadList; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIHeadList\fP +The head of the \fIchain_list\fP. +.TP +\fIBddNode\fP +The \fBbdd\fP node to add. +.SH DESCRIPTION +\fBaddbddnodelist\fP adds the node \fIBddNode\fP in the ordered list +\fIHeadList\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The number of external reference of \fIBddNode\fP is incremented. +.br +.SH RETURN VALUE +\fBaddbddnodelist\fP returns the new head of the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**BddList; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddList = (chain_list \(**)0; + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i0", 0, BDD_IN_MODE_FIRST ) ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i1", 0, BDD_IN_MODE_FIRST ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i2", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnodelist( (bddsystem \(**)0, ABL_AND, BddList ); + delbddnodelist( (bddsystem \(**)0, BddList ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 and i1 and i2) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddvar.3 b/alliance/src/bdd/man3/addbddvar.3 new file mode 100644 index 00000000..325b52c5 --- /dev/null +++ b/alliance/src/bdd/man3/addbddvar.3 @@ -0,0 +1,73 @@ +.\" $Id: addbddvar.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddvar.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDVAR 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddvar \- adds a new variable in the \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddvar( BddSystem, Variable ) + bddsystem \(**BddSystem; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIVariable\fP +The variable number. +.SH DESCRIPTION +\fBaddbddvar\fP creates a new variable, with the number \fIVariable\fP, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddvar\fP returns a pointer to the \fBbdd\fP node of the new variable. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variables, error !" +.ft R +.RS +There is no variable number left. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvar( (bddsystem \(**)0, 0 ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddvarafter.3 b/alliance/src/bdd/man3/addbddvarafter.3 new file mode 100644 index 00000000..c3dfaba1 --- /dev/null +++ b/alliance/src/bdd/man3/addbddvarafter.3 @@ -0,0 +1,75 @@ +.\" $Id: addbddvarafter.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddvarafter.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDVARAFTER 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddvarafter \- adds a new variable, after an existing one. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddvarafter( BddSystem ) + bddsystem \(**BddSystem; + bddindex Index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIIndex\fP +The \fBbdd\fP index of an existing variable. +.SH DESCRIPTION +\fBaddbddvarafter\fP creates a new variable, with the number +\fIBddSystem\fP->INDEX_TO_VAR[ \fIIndex\fP ] + 1 +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddvarafter\fP returns a pointer to the \fBbdd\fP node of the new variable. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variables, error !" +.ft R +.RS +There is no variable number left. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIIndex\fP parameter must be a valid index. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode1 = addbddvarfirst( (bddsystem \(**)0 ); + BddNode2 = addbddvarafter( (bddsystem \(**)0, BddNode1->INDEX ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddvarbefore.3 b/alliance/src/bdd/man3/addbddvarbefore.3 new file mode 100644 index 00000000..2a85f351 --- /dev/null +++ b/alliance/src/bdd/man3/addbddvarbefore.3 @@ -0,0 +1,75 @@ +.\" $Id: addbddvarbefore.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddvarbefore.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDVARBEFORE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddvarbefore \- adds a new variable, before an existing one. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddvarbefore( BddSystem ) + bddsystem \(**BddSystem; + bddindex Index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIIndex\fP +The \fBbdd\fP index of an existing variable. +.SH DESCRIPTION +\fBaddbddvarbefore\fP creates a new variable, with the number +\fIBddSystem\fP->INDEX_TO_VAR[ \fIIndex\fP ] +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddvarbefore\fP returns a pointer to the \fBbdd\fP node of the new variable. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variables, error !" +.ft R +.RS +There is no variable number left. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIIndex\fP parameter must be a valid index. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode1 = addbddvarfirst( (bddsystem \(**)0 ); + BddNode2 = addbddvarbefore( (bddsystem \(**)0, BddNode1->INDEX ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddvarfirst.3 b/alliance/src/bdd/man3/addbddvarfirst.3 new file mode 100644 index 00000000..80c09c38 --- /dev/null +++ b/alliance/src/bdd/man3/addbddvarfirst.3 @@ -0,0 +1,59 @@ +.\" $Id: addbddvarfirst.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddvarfirst.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDVARFIRST 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddvarfirst \- adds a new variable, before all others. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddvarfirst( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBaddbddvarfirst\fP creates a new variable, with the number 0, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddvarfirst\fP returns a pointer to the \fBbdd\fP node of the new variable. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variables, error !" +.ft R +.RS +There is no variable number left. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvarfirst( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/addbddvarlast.3 b/alliance/src/bdd/man3/addbddvarlast.3 new file mode 100644 index 00000000..e8b4c98c --- /dev/null +++ b/alliance/src/bdd/man3/addbddvarlast.3 @@ -0,0 +1,59 @@ +.\" $Id: addbddvarlast.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)addbddvarlast.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ADDBDDVARLAST 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +addbddvarlast \- adds a new variable, after all others. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**addbddvarlast( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBaddbddvarlast\fP creates a new variable, with the number +\fIBddLocalSystem->NUMBER_VAR\fP in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBaddbddvarlast\fP returns a pointer to the \fBbdd\fP node of the new variable. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"no more variables, error !" +.ft R +.RS +There is no variable number left. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvarlast( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/applybddnode.3 b/alliance/src/bdd/man3/applybddnode.3 new file mode 100644 index 00000000..25250f2a --- /dev/null +++ b/alliance/src/bdd/man3/applybddnode.3 @@ -0,0 +1,85 @@ +.\" $Id: applybddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)applybddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH APPLYBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +applybddnode \- applies an operator on two \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**applybddnode( BddSystem, Oper, BddNode1, BddNode2 ) + bddsystem \(**BddSystem; + long Oper; + bddnode \(**BddNode1; + bddnode \(**BddNode2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIOper\fP +The binary operator. +.TP +\fIBddNode1\fP +The first \fBbdd\fP node. +.TP +\fIBddNode2\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBapplybddnode\fP computes the boolean function \fIBddNode1\fP +\fIOper\fP \fIBddNode2\fP in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBapplybddnode\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad operator xxx error !" +.ft R +.RS +The \fIOper\fP parameter must be a valid binary operator. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i1", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnode( (bddsystem \(**)0, + ABL_AND, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ), + searchbddcircuitin( (bddcircuit \(**)0, "i1" ) ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/applybddnodeite.3 b/alliance/src/bdd/man3/applybddnodeite.3 new file mode 100644 index 00000000..51de266c --- /dev/null +++ b/alliance/src/bdd/man3/applybddnodeite.3 @@ -0,0 +1,78 @@ +.\" $Id: applybddnodeite.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)applybddnodeite.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH APPLYBDDNODEITE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +applybddnodeite \- computes the IF-THEN-ELSE logical operation. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**applybddnodeite( BddSystem, BddIf, BddThen, BddElse ) + bddnode \(**BddSystem; + bddnode \(**BddIf; + bddnode \(**BddThen; + bddnode \(**BddElse; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddIf\fP +The IF \fBbdd\fP node. +.TP +\fIBddThen\fP +The THEN \fBbdd\fP node. +.TP +\fIBddElse\fP +The ELSE \fBbdd\fP node. +.SH DESCRIPTION +\fBapplybddnodeite\fP computes the following logical function +(\fIBddIf\fP AND \fIBddThen\fP) OR ((NOT \fIBddIf\fP) AND \fIBddElse\fP) +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBapplybddnodeite\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i1", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i2", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnodeite( (bddsystem \(**)0, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ), + searchbddcircuitin( (bddcircuit \(**)0, "i1" ), + searchbddcircuitin( (bddcircuit \(**)0, "i2" ) ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays ((i0 and i1) or ((not i0) and i2) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/applybddnodelist.3 b/alliance/src/bdd/man3/applybddnodelist.3 new file mode 100644 index 00000000..7dc21262 --- /dev/null +++ b/alliance/src/bdd/man3/applybddnodelist.3 @@ -0,0 +1,96 @@ +.\" $Id: applybddnodelist.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)applybddnodelist.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH APPLYBDDNODELIST 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +applybddnodelist \- applies an opertor to a \fBbdd\fP nodes list. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**applybddnodelist( BddSystem, Oper, BddList ) + bddsystem \(**BddSystem; + long Oper; + chain_list \(**BddList; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIOper\fP +The operator. +.TP +\fIBddList\fP +The \fBbdd\fP nodes list. +.SH DESCRIPTION +\fBapplybddnodelist\fP applies the boolean operator \fIOper\fP to the +\fBbdd\fP nodes list \fIBddList\fP in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBapplybddnodelist\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad operator xxx error !" +.ft R +.RS +The \fIOper\fP parameter must be a valid binary operator. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad list !" +.ft R +.RS +The \fIBddList\fP parameter must be a valid list. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**BddList; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddList = (chain_list \(**)0; + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i0", 0, BDD_IN_MODE_FIRST ) ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i1", 0, BDD_IN_MODE_FIRST ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i2", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnodelist( (bddsystem \(**)0, ABL_AND, BddList ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 and i1 and i2) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/applybddnodenot.3 b/alliance/src/bdd/man3/applybddnodenot.3 new file mode 100644 index 00000000..f4e26a74 --- /dev/null +++ b/alliance/src/bdd/man3/applybddnodenot.3 @@ -0,0 +1,68 @@ +.\" $Id: applybddnodenot.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)applybddnodenot.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH APPLYBDDNODENOT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +applybddnodenot \- complements a \fBbdd\fP. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**applybddnodenot( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to complement. +.SH DESCRIPTION +\fBapplybddnodenot\fP complements \fIBddNode\fP in the \fBbdd\fP +system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBapplybddnodenot\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i1", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnode( (bddsystem \(**)0, + ABL_AND, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ), + searchbddcircuitin( (bddcircuit \(**)0, "i1" ) ); + BddNode = applybddnodenot( (bddsystem \(**)0, decbddrefext( BddNode ) ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 nand i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/applybddnodeterm.3 b/alliance/src/bdd/man3/applybddnodeterm.3 new file mode 100644 index 00000000..c9bace57 --- /dev/null +++ b/alliance/src/bdd/man3/applybddnodeterm.3 @@ -0,0 +1,85 @@ +.\" $Id: applybddnodeterm.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)applybddnodeterm.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH APPLYBDDNODETERM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +applybddnodeterm \- applies an operator on two \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**applybddnodeterm( BddSystem, Oper, Index, BddNode ) + bddsystem \(**BddSystem; + long Oper; + bddindex Index; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIOper\fP +The binary operator. +.TP +\fIIndex\fP +The index of the terminal \fBbdd\fP node. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBapplybddnodeterm\fP computes the boolean function \fIBddNode\fP +\fIOper\fP and the terminal node corresponding to \fIIndex\fP +in the \fBbdd\fP system \fIBddSystem\fP. The \fIIndex\fP parameter +can take only the two following values BDD_INDEX_ONE and BDD_INDEX_ZERO. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBapplybddnodeterm\fP returns a pointer to the resulting \fBbdd\fP node +with its number of external reference incremented. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad operator xxx error !" +.ft R +.RS +The \fIOper\fP parameter must be a valid binary operator. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnodeterm( (bddsystem \(**)0, + ABL_XOR, BDD_INDEX_ONE, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ) ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/clearbddsystemref.3 b/alliance/src/bdd/man3/clearbddsystemref.3 new file mode 100644 index 00000000..e8cca16f --- /dev/null +++ b/alliance/src/bdd/man3/clearbddsystemref.3 @@ -0,0 +1,52 @@ +.\" $Id: clearbddsystemref.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)clearbddsystemref.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CLEARBDDSYSTEMREF 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +clearbddsystemref \- clears the references for all \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void clearbddsystemref( BddSystem ) + bddsystem \(*BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBclearbddsystemref\fP clears the internal and external references +of all the \fBbdd\fP nodes in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBclearbddsystemref\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + clearbddsystemref( (bddsystem \(**)0 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR clearbddsystemrefint(3), +.BR clearbddsystemrefext(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/clearbddsystemrefext.3 b/alliance/src/bdd/man3/clearbddsystemrefext.3 new file mode 100644 index 00000000..472812a3 --- /dev/null +++ b/alliance/src/bdd/man3/clearbddsystemrefext.3 @@ -0,0 +1,52 @@ +.\" $Id: clearbddsystemrefext.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)clearbddsystemrefext.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CLEARBDDSYSTEMREFEXT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +clearbddsystemrefext \- clears the external references for all \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void clearbddsystemrefext( BddSystem ) + bddsystem \(*BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBclearbddsystemrefext\fP clears the external references +of all the \fBbdd\fP nodes in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBclearbddsystemrefext\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + clearbddsystemrefext( (bddsystem \(**)0 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR clearbddsystemref(3), +.BR clearbddsystemrefint(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/clearbddsystemrefint.3 b/alliance/src/bdd/man3/clearbddsystemrefint.3 new file mode 100644 index 00000000..4346d562 --- /dev/null +++ b/alliance/src/bdd/man3/clearbddsystemrefint.3 @@ -0,0 +1,52 @@ +.\" $Id: clearbddsystemrefint.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)clearbddsystemrefint.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CLEARBDDSYSTEMREFINT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +clearbddsystemrefint \- clears the internal references for all \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void clearbddsystemrefint( BddSystem ) + bddsystem \(*BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBclearbddsystemrefint\fP clears the internal references +of all the \fBbdd\fP nodes in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBclearbddsystemrefint\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + clearbddsystemrefint( (bddsystem \(**)0 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR clearbddsystemref(3), +.BR clearbddsystemrefext(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/cofactorbddnode.3 b/alliance/src/bdd/man3/cofactorbddnode.3 new file mode 100644 index 00000000..7ee0c5b7 --- /dev/null +++ b/alliance/src/bdd/man3/cofactorbddnode.3 @@ -0,0 +1,88 @@ +.\" $Id: cofactorbddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)cofactorbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH COFACTORBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +cofactorbddnode \- computes the generalized cofactor. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**cofactorbddnode( BddSystem, BddNode1, BddNode2 ) + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode1\fP +The first \fBbdd\fP node. +.TP +\fIBddNode2\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBcofactorbddnode\fP computes the generalized cofactor of +\fIBddNode1\fP by \fIBddNode2\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBcofactorbddnode\fP returns the resulting \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range" +.ft R +.RS +The \fIBddNode2\fP parameter must be different to the zero \fBbdd\fP node. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode2 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddNode = cofactorbddnode( (bddsystem \(**)0, BddNode1, BddNode2 ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays '1' */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/composebddnode.3 b/alliance/src/bdd/man3/composebddnode.3 new file mode 100644 index 00000000..f42eea05 --- /dev/null +++ b/alliance/src/bdd/man3/composebddnode.3 @@ -0,0 +1,97 @@ +.\" $Id: composebddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)composebddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH COMPOSEBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +composebddnode \- substitutes a variable by a \fBbdd\fP in another \fBbdd\fP. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**composebddnode( BddSystem, BddNode, Variable, BddSubst ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddvar Variable; + bddnode \(**BddSubst; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.TP +\fIVariable\fP +The variable to find. +.TP +\fIBddSubst\fP +The \fBbdd\fP to substitute with. +.SH DESCRIPTION +\fBcomposebddnode\fP substitutes all the occurency of the variable \fIVariable\fP +in the \fBbdd\fP node \fIBddNode\fP by the \fBbdd\fP node \fIBddSubst\fP, in the +\fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBcomposebddnode\fP returns the resulting \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddVariable; + bddnode \(**BddNode; + bddnode \(**BddSubst; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + BddNode = composebddnode( (bddsystem \(**)0, BddNode, Variable, BddSubst ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (i1 and (i2 or i3)) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddcircuitabl.3 b/alliance/src/bdd/man3/convertbddcircuitabl.3 new file mode 100644 index 00000000..e2f1e828 --- /dev/null +++ b/alliance/src/bdd/man3/convertbddcircuitabl.3 @@ -0,0 +1,69 @@ +.\" $Id: convertbddcircuitabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddcircuitabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDCIRCUITABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddcircuitabl \- converts a \fBbdd\fP node to an \fBabl\fP expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list \(**convertbddcircuitabl( BddCircuit, BddNode ) + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIBddNode\fP +The \fBbdd\fP node to convert. +.SH DESCRIPTION +\fBconvertbddcircuitabl\fP converts the \fBbdd\fP node +to an \fBabl\fP expression. The \fIBddCircuit\fP is used to translate +the variable nodes into atomic expressions. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBconvertbddcircuitabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (i0 and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1), +.BR addbddcircuitabl(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddcircuitsumabl.3 b/alliance/src/bdd/man3/convertbddcircuitsumabl.3 new file mode 100644 index 00000000..f3e9901d --- /dev/null +++ b/alliance/src/bdd/man3/convertbddcircuitsumabl.3 @@ -0,0 +1,69 @@ +.\" $Id: convertbddcircuitsumabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddcircuitsumabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDCIRCUITSUMABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddcircuitsumabl \- converts a \fBbdd\fP node to an \fBabl\fP expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list \(**convertbddcircuitsumabl( BddCircuit, BddNode ) + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIBddNode\fP +The \fBbdd\fP node to convert. +.SH DESCRIPTION +\fBconvertbddcircuitsumabl\fP converts the \fBbdd\fP node +to a non optimal \fBabl\fP expression. The \fIBddCircuit\fP is used to translate +the variable nodes into atomic expressions. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBconvertbddcircuitsumabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitsumabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = convertbddcircuitsumabl( BddCircuit, BddNode ); + /* displays (i0 and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1), +.BR addbddcircuitabl(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddindexabl.3 b/alliance/src/bdd/man3/convertbddindexabl.3 new file mode 100644 index 00000000..c964a840 --- /dev/null +++ b/alliance/src/bdd/man3/convertbddindexabl.3 @@ -0,0 +1,76 @@ +.\" $Id: convertbddindexabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddindexabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDINDEXABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddindexabl \- converts a \fBbdd\fP index to an \fBabl\fP expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list *convertbddnodeabl( BddSystem, NameArray, IndexArray, BddNode ) + bddsystem \(**BddSystem; + char \(**\(**NameArray; + bddindex \(**IndexArray; + bddindex Index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fINameArray\fP +The array of names. +.TP +\fIIndexArray\fP +The array of indexes. +.TP +\fIIndex\fP +The \fBbdd\fP index to convert. +.SH DESCRIPTION +\fBconvertbddindexabl\fP converts the \fBbdd\fP index \fIIndex\fP +to an \fBabl\fP expression in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fINameArray\fP, and \fIIndexArray\fP parameters are used +to translate the variable nodes into atomic expressions. +The array \fINameArray\fP is list of names. +The array \fIIndexArray\fP does the correspondence between a \fBbdd\fP index +and a slot in the \fINameArray\fP. If the \fIIndexArray\fP parameter +is a null pointer, then the name of the \fBbdd\fP index BDD_INDEX_MIN is assumed +to be the first slot of the \fINameArray\fP, and so on. +.br +.SH RETURN VALUE +\fBconvertbddindexabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + chain_list \(**Expr; + char \(**NameArray[ 1 ]; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvarlast( BddSystem ); + NameArray[ 0 ] = namealloc( "i0" ); + Expr = convertbddindexabl( BddSystem, NameArray, (bddindex \(**)0, BddNode->INDEX ); + /* displays i0 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddmuxabl.3 b/alliance/src/bdd/man3/convertbddmuxabl.3 new file mode 100644 index 00000000..5a5426d7 --- /dev/null +++ b/alliance/src/bdd/man3/convertbddmuxabl.3 @@ -0,0 +1,90 @@ +.\" $Id: convertbddmuxabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddmuxabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDMUXABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddmuxabl \- converts two \fBbdd\fP nodes to an \fBabl\fP multiplexor expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list *convertbddmuxabl( BddSystem, NameArray, IndexArray, Equation, BddHigh, BddLow ) + bddsystem \(*BddSystem; + char \(*\(*NameArray; + bddindex \(*IndexArray; + chain_list \(*Equation; + bddnode \(*BddHigh; + bddnode \(*BddLow; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fINameArray\fP +The array of names. +.TP +\fIIndexArray\fP +The array of indexes. +.TP +\fIEquation\fP +The multiplexor command. +.TP +\fIBddHigh\fP +The first \fBbdd\fP node. +.TP +\fIBddLow\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBconvertbddmuxabl\fP creates the following \fBabl\fP expression +( \fIBddHigh\fP AND \fIEquation\fP ) OR ( \fIBddLow\fP AND (NOT \fIEquation\fP ) ) +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fINameArray\fP, and \fIIndexArray\fP parameters are used +to translate the variable nodes into atomic expressions. +The array \fINameArray\fP is list of names. +The array \fIIndexArray\fP does the correspondence between a \fBbdd\fP node +index and a slot in the \fINameArray\fP. If the \fIIndexArray\fP parameter +is a null pointer, then the name of the \fBbdd\fP index BDD_INDEX_MIN is assumed +to be the first slot of the \fINameArray\fP, and so on. +.br +.SH RETURN VALUE +\fBconvertbddmuxabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + chain_list \(**Expr; + char \(**NameArray[ 2 ]; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode1 = addbddvarlast( BddSystem ); + BddNode2 = addbddvarlast( BddSystem ); + NameArray[ 0 ] = namealloc( "i0" ); + NameArray[ 1 ] = namealloc( "i1" ); + Expr = convertbddmuxabl( BddSystem, NameArray, (bddindex \(**)0, + createablatom( "C" ), BddNode1, BddNode2 ); + /* displays (i0 and C) or (i1 and (not C)) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddnodeabl.3 b/alliance/src/bdd/man3/convertbddnodeabl.3 new file mode 100644 index 00000000..c375cb96 --- /dev/null +++ b/alliance/src/bdd/man3/convertbddnodeabl.3 @@ -0,0 +1,77 @@ +.\" $Id: convertbddnodeabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddnodeabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDNODEABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddnodeabl \- converts a \fBbdd\fP node to an \fBabl\fP expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list *convertbddnodeabl( BddSystem, NameArray, IndexArray, BddNode ) + bddsystem \(**BddSystem; + char \(**\(**NameArray; + bddindex \(**IndexArray; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fINameArray\fP +The array of names. +.TP +\fIIndexArray\fP +The array of indexes. +.TP +\fIBddNode\fP +The \fBbdd\fP node to convert. +.SH DESCRIPTION +\fBconvertbddnodeabl\fP converts the \fBbdd\fP node \fIBddNode\fP +to an \fBabl\fP expression in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fINameArray\fP, and \fIIndexArray\fP parameters are used +to translate the variable nodes into atomic expressions. +The array \fINameArray\fP is list of names. +The array \fIIndexArray\fP does the correspondence between a \fBbdd\fP node +index and a slot in the \fINameArray\fP. If the \fIIndexArray\fP parameter +is a null pointer, then the name of the \fBbdd\fP index BDD_INDEX_MIN is assumed +to be the first slot of the \fINameArray\fP, and so on. +.br +.SH RETURN VALUE +\fBconvertbddnodeabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + chain_list \(**Expr; + char \(**NameArray[ 1 ]; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvarlast( BddSystem ); + NameArray[ 0 ] = namealloc( "i0" ); + Expr = convertbddnodeabl( BddSystem, NameArray, (bddindex \(**)0, BddNode ); + /* displays i0 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/convertbddnodesumabl.3 b/alliance/src/bdd/man3/convertbddnodesumabl.3 new file mode 100644 index 00000000..de9403f1 --- /dev/null +++ b/alliance/src/bdd/man3/convertbddnodesumabl.3 @@ -0,0 +1,77 @@ +.\" $Id: convertbddnodesumabl.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)convertbddnodesumabl.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CONVERTBDDNODESUMABL 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +convertbddnodesumabl \- converts a \fBbdd\fP node to an \fBabl\fP expression. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +chain_list *convertbddnodesumabl( BddSystem, NameArray, IndexArray, BddNode ) + bddsystem \(**BddSystem; + char \(**\(**NameArray; + bddindex \(**IndexArray; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fINameArray\fP +The array of names. +.TP +\fIIndexArray\fP +The array of indexes. +.TP +\fIBddNode\fP +The \fBbdd\fP node to convert. +.SH DESCRIPTION +\fBconvertbddnodesumabl\fP converts the \fBbdd\fP node +to a non optimal \fBabl\fP expression in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fINameArray\fP, and \fIIndexArray\fP parameters are used +to translate the variable nodes into atomic expressions. +The array \fINameArray\fP is list of names. +The array \fIIndexArray\fP does the correspondence between a \fBbdd\fP node +index and a slot in the \fINameArray\fP. If the \fIIndexArray\fP parameter +is a null pointer, then the name of the \fBbdd\fP index BDD_INDEX_MIN is assumed +to be the first slot of the \fINameArray\fP, and so on. +.br +.SH RETURN VALUE +\fBconvertbddnodesumabl\fP returns a pointer to the \fBabl\fP expression translated. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + chain_list \(**Expr; + char \(**NameArray[ 1 ]; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvarlast( BddSystem ); + NameArray[ 0 ] = namealloc( "i0" ); + Expr = convertbddnodesumabl( BddSystem, NameArray, (bddindex \(**)0, BddNode ); + /* displays i0 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR abl (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/createbddcircuit.3 b/alliance/src/bdd/man3/createbddcircuit.3 new file mode 100644 index 00000000..6c7599d1 --- /dev/null +++ b/alliance/src/bdd/man3/createbddcircuit.3 @@ -0,0 +1,66 @@ +.\" $Id: createbddcircuit.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)createbddcircuit.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CREATEBDDCIRCUIT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +createbddcircuit \- creates a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddcircuit \(**createbddcircuit( Name, NumberIn, NumberOut, BddSystem ) + char \(**Name; + long NumberIn; + long NumberOut; + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIName\fP +Name of the \fBbdd\fP circuit. +.TP +\fINumberIn\fP +Number of inputs. +.TP +\fINumberOut\fP +Number of outputs. +.TP +\fIBddSystem\fP +The \fBbdd\fP system to work on. +.SH DESCRIPTION +\fBcreatebddcircuit\fP creates a \fBbdd\fP circuit with the name \fIName\fP, +with \fINumberIn\fP inputs, and \fINumberOut\fP outputs. +This \fBbdd\fP circuit will use the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBcreatebddcircuit\fP returns a pointer to the \fBbdd\fP circuit created. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR resetbddcircuit(3), +.BR destroybddcircuit(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/createbddsystem.3 b/alliance/src/bdd/man3/createbddsystem.3 new file mode 100644 index 00000000..d13b71b2 --- /dev/null +++ b/alliance/src/bdd/man3/createbddsystem.3 @@ -0,0 +1,89 @@ +.\" $Id: createbddsystem.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)createbddsystem.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH CREATEBDDSYSTEM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +createbddsystem \- creates a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddsystem \(**createbddsystem( ModelVar, ModelOper, MaxVar, MaxNode ) + long ModelVar; + long ModelOper; + long MaxVar; + long MaxNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIModelVar\fP +Initial size of the hash table uses for a variable. +.TP +\fIModelOper\fP +Size of the hash table uses as a cache. +.TP +\fIMaxVar\fP +Initial maximum number of variables. +.TP +\fIMaxNode\fP +Maximum nodes allowed. +.SH DESCRIPTION +\fBcreatebddsystem\fP creates and initializes a \fBbdd\fP system. +.br +.SH RETURN VALUE +\fBcreatebddsystem\fP returns a pointer to the \fBbdd\fP system created. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"system model variable xxx error !" +.ft R +.RS +The \fIModelVar\fP parameter must be a positive value. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"system model oper xxx error !" +.ft R +.RS +The \fIModelOper\fP parameter must be a positive value. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range error !" +.ft R +.RS +The \fIMaxVar\fP parameter must be less than \fIBDD_MAX_VAR\fP. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) +.BR resetbddsytem(3), +.BR destroybddsytem(3). +. + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/decbddrefext.3 b/alliance/src/bdd/man3/decbddrefext.3 new file mode 100644 index 00000000..f5dd396d --- /dev/null +++ b/alliance/src/bdd/man3/decbddrefext.3 @@ -0,0 +1,70 @@ +.\" $Id: decbddrefext.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)decbddrefext.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DECBDDREFEXT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +decbddrefext \- decrements the external reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**decbddrefext( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBdecbddrefext\fP decrements the number of external reference +of the \fBbdd\fP node \fIBddNode\fP. +.br +.SH RETURN VALUE +\fBdecbddrefext\fP returns the \fIBddNode\fP pointer. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"negative reference, index xxx error !" +.ft R +.RS +The \fIBddNode\fP must have a postive number of external reference. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + decbddrefext( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 0 REF_INT: 0 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/decbddrefint.3 b/alliance/src/bdd/man3/decbddrefint.3 new file mode 100644 index 00000000..46e3eff4 --- /dev/null +++ b/alliance/src/bdd/man3/decbddrefint.3 @@ -0,0 +1,71 @@ +.\" $Id: decbddrefint.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)decbddrefint.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DECBDDREFINT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +decbddrefint \- decrements the internal reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**decbddrefint( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBdecbddrefint\fP decrements the number of internal reference +of the \fBbdd\fP node \fIBddNode\fP. +.br +.SH RETURN VALUE +\fBdecbddrefint\fP returns the \fIBddNode\fP pointer. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"negative reference, index xxx error !" +.ft R +.RS +The \fIBddNode\fP must have a postive number of internal reference. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + incbddrefint( BddNode ); + decbddrefint( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 1 REF_INT: 0 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/delbddassoc.3 b/alliance/src/bdd/man3/delbddassoc.3 new file mode 100644 index 00000000..43abf93f --- /dev/null +++ b/alliance/src/bdd/man3/delbddassoc.3 @@ -0,0 +1,82 @@ +.\" $Id: delbddassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)delbddassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DELBDDASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +delbddassoc \- deletes a variable association. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +int delbddassoc( BddSystem, BddAssoc ) + bddsystem \(**BddSystem; + bddassoc \(**BddAssoc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddAssoc\fP +The variable association to delete. +.SH DESCRIPTION +\fBdelbddassoc\fP deletes the variable association \fIBddAssoc\fP in the \fBbdd\fP system +\fIBddSystem\fP. If a null pointer is given, the default \fBbdd\fP system is used. +For all the \fBbdd\fP nodes of the variable association +\fIBddAssoc\fP, the number of external reference is decremented. +.br +.SH RETURN VALUE +\fBdelbddassoc\fP returns 1 if the variable association is found, 0 otherwise. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = delbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + delbddassoc( (bddsystem \(**)0, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/delbddcircuitout.3 b/alliance/src/bdd/man3/delbddcircuitout.3 new file mode 100644 index 00000000..a49a3791 --- /dev/null +++ b/alliance/src/bdd/man3/delbddcircuitout.3 @@ -0,0 +1,63 @@ +.\" $Id: delbddcircuitout.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)delbddcircuitout.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DELBDDCIRCUITOUT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +delbddcircuitout \- deletes an output in a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +int delbddcircuitout( BddCircuit, OutputName ) + bddcircuit \(**BddCircuit; + char \(**OutputName; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIOutputName\fP +The name of the output to delete. +.SH DESCRIPTION +\fBdelbddcircuitout\fP deletes the output \fIOutputName\fP +in the \fBbdd\fP circuit \fIBddCircuit\fP. If a null pointer is given, +the default \fBbdd\fP circuit is used. If the output \fIOutputName\fP exists, +the number of external reference of the output node +is decremented. +.br +.SH RETURN VALUE +\fBdelbddcircuitout\fP returns 1 if the output \fIOutputName\fP exist, 0 otherwise. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + addbddcircuitout( (bddcircuit \(**)0, "Out0", BddNode ); + ... + delbddcircuitout( (bddcircuit \(**)0, "Out0" ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) +.BR searchbddcircuitout(3), +.BR addbddcircuitout(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/delbddnode.3 b/alliance/src/bdd/man3/delbddnode.3 new file mode 100644 index 00000000..4a64770d --- /dev/null +++ b/alliance/src/bdd/man3/delbddnode.3 @@ -0,0 +1,66 @@ +.\" $Id: delbddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)delbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DELBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +delbddnode \- deletes an unused \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void delbddnode( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBdelbddnode\fP tries to delete the \fBbdd\fP node \fIBddNode\fP and its +children, if they have not external reference, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. The use of this +function is not recommended because, it takes time. +It is better to call the \fIdecbddrefext\fP function, and do a garbage collection +with the \fIgarbagebddsystem\fP function. +.br +.SH RETURN VALUE +\fBdelbddnode\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + delbddnode( (bddsystem \(**)0, decbddrefext( BddNode ) ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/delbddnodeassoc.3 b/alliance/src/bdd/man3/delbddnodeassoc.3 new file mode 100644 index 00000000..668ac88b --- /dev/null +++ b/alliance/src/bdd/man3/delbddnodeassoc.3 @@ -0,0 +1,98 @@ +.\" $Id: delbddnodeassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)delbddnodeassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DELBDDNODEASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +delbddnodeassoc \- deletes a \fBbdd\fP node in a variable association. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +int delbddnodeassoc( BddSystem, BddAssoc, Variable ) + bddsystem \(**BddSystem; + bddassoc \(**BddAssoc; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddAssoc\fP +The variable association. +.TP +\fIVariable\fP +The variable number. +.SH DESCRIPTION +\fBdelbddnodeassoc\fP deletes the \fBbdd\fP node associated to the +variable number \fIVariable\fP, in the variable association \fIBddAssoc\fP, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The number of external reference of the associated \fBbdd\fP node is incremented. +.br +.SH RETURN VALUE +\fBdelbddnodeassoc\fP returns 1 if the variable is found, 0 otherwise. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + delbddnodeassoc( (bddsystem \(**)0, Assoc, Variable ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/delbddnodelist.3 b/alliance/src/bdd/man3/delbddnodelist.3 new file mode 100644 index 00000000..045fa237 --- /dev/null +++ b/alliance/src/bdd/man3/delbddnodelist.3 @@ -0,0 +1,74 @@ +.\" $Id: delbddnodelist.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)delbddnodelist.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DELBDDNODELIST 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +delbddnodelist \- deletes a list of \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void delbddnodelist( BddSystem, HeadList ) + bddsystem \(**BddSystem; + chain_list \(**HeadList; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIHeadList\fP +The head of the \fIchain_list\fP. +.SH DESCRIPTION +\fBdelbddnodelist\fP deletes all the \fBbdd\fP nodes of the +list \fIHeadList\fP in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +All the nodes have their external references decremented. +.br +.SH RETURN VALUE +\fBdelbddnodelist\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**BddList; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddList = (chain_list \(**)0; + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i0", 0, BDD_IN_MODE_FIRST ) ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i1", 0, BDD_IN_MODE_FIRST ); + BddList = addbddnodelist( (bddsystem \(**)0, BddList, + addbddcircuitin( (bddcircuit \(**)0, + "i2", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnodelist( (bddsystem \(**)0, ABL_AND, BddList ); + delbddnodelist( (bddsystem \(**)0, BddList ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 and i1 and i2) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/destroybddassoc.3 b/alliance/src/bdd/man3/destroybddassoc.3 new file mode 100644 index 00000000..395b0137 --- /dev/null +++ b/alliance/src/bdd/man3/destroybddassoc.3 @@ -0,0 +1,77 @@ +.\" $Id: destroybddassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)destroybddassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DESTROYBDDASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +destroybddassoc \- frees all the variable associations. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddassoc \(**destroybddassoc( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBdestroybddassoc\fP frees all the variable associations in the \fBbdd\fP system +\fIBddSystem\fP. If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBdestroybddassoc\fP returns nothing. +.SH ERRORS +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + delbddassoc( (bddsystem \(**)0, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/destroybddcircuit.3 b/alliance/src/bdd/man3/destroybddcircuit.3 new file mode 100644 index 00000000..1757ffd4 --- /dev/null +++ b/alliance/src/bdd/man3/destroybddcircuit.3 @@ -0,0 +1,50 @@ +.\" $Id: destroybddcircuit.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)destroybddcircuit.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DESTROYBDDCIRCUIT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +destroybddcircuit \- destroys a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + void destroybddcircuit( BddCircuit ) + bddcircuit \(**BddCircuit; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit to destroy. +.SH DESCRIPTION +\fBdestroybddcircuit\fP destroys the \fBbdd\fP circuit \fIBddCircuit\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBdestroybddcircuit\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/destroybddsystem.3 b/alliance/src/bdd/man3/destroybddsystem.3 new file mode 100644 index 00000000..0c908988 --- /dev/null +++ b/alliance/src/bdd/man3/destroybddsystem.3 @@ -0,0 +1,47 @@ +.\" $Id: destroybddsystem.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)destroybddsystem.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH DESTROYBDDSYSTEM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +destroybddsystem \- destroys a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + void destroybddsystem( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system to destroy. +.SH DESCRIPTION +\fBdestroybddsystem\fP destroys the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBdestroybddsystem\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/existbddnodeassocoff.3 b/alliance/src/bdd/man3/existbddnodeassocoff.3 new file mode 100644 index 00000000..8b3ce679 --- /dev/null +++ b/alliance/src/bdd/man3/existbddnodeassocoff.3 @@ -0,0 +1,90 @@ +.\" $Id: existbddnodeassocoff.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)existbddnodeassocoff.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH EXISTBDDNODEASSOCOFF 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +existbddnodeassocoff \- computes an existantial quantification. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**existbddnodeassocoff( BddSystem, BddNode, BddAssoc ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddassoc \(**BddAssoc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to treat. +.TP +\fIBddAssoc\fP +The variable association. +.SH DESCRIPTION +\fBexistbddnodeassocoff\fP suppress in the \fBbdd\fP node \fIBddNode\fP complemented, +all the variables associated with something in the variable association +\fIBddAssoc\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBexistbddnodeassocoff\fP returns the computed \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad variable association xxx, error !" +.ft R +.RS +The \fIBddAssoc\fP parameter must a valid variable association. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_NAND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSystem->ONE ); + BddNode = existbddnodeassocoff( (bddsystem \(**)0, BddNode, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (not i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/existbddnodeassocon.3 b/alliance/src/bdd/man3/existbddnodeassocon.3 new file mode 100644 index 00000000..86c40f66 --- /dev/null +++ b/alliance/src/bdd/man3/existbddnodeassocon.3 @@ -0,0 +1,90 @@ +.\" $Id: existbddnodeassocon.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)existbddnodeassocon.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH EXISTBDDNODEASSOCON 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +existbddnodeassocon \- computes an existantial quantification. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**existbddnodeassocon( BddSystem, BddNode, BddAssoc ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddassoc \(**BddAssoc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to treat. +.TP +\fIBddAssoc\fP +The variable association. +.SH DESCRIPTION +\fBexistbddnodeassocon\fP suppress in \fIBddNode\fP, +all the variables associated with something in the variable association +\fIBddAssoc\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBexistbddnodeassocon\fP returns the computed \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad variable association xxx, error !" +.ft R +.RS +The \fIBddAssoc\fP parameter must a valid variable association. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSystem->ONE ); + BddNode = existbddnodeassocon( (bddsystem \(**)0, BddNode, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays i1 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/garbagebddsystem.3 b/alliance/src/bdd/man3/garbagebddsystem.3 new file mode 100644 index 00000000..8dc239ea --- /dev/null +++ b/alliance/src/bdd/man3/garbagebddsystem.3 @@ -0,0 +1,62 @@ +.\" $Id: garbagebddsystem.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)garbagebddsystem.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GARBAGEBDDSYSTEM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +garbagebddsystem \- Forces a \fBbdd\fP garbage collection. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void garbagebddsystem( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBgarbagebddsystem\fP frees all the unused \fBbdd\fP nodes in the +system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +A \fBbdd\fP node is unused if its number of reference is null. +.br +.SH RETURN VALUE +\fBgarbagebddsystem\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i1", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnode( (bddsystem \(**)0, + ABL_AND, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ), + searchbddcircuitin( (bddcircuit \(**)0, "i1" ) ); + decbddrefext( BddNode ); + garbagebddsystem( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddnodenum.3 b/alliance/src/bdd/man3/getbddnodenum.3 new file mode 100644 index 00000000..40d10749 --- /dev/null +++ b/alliance/src/bdd/man3/getbddnodenum.3 @@ -0,0 +1,63 @@ +.\" $Id: getbddnodenum.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddnodenum.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDNODENUM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddnodenum \- gets the number of nodes in a \fBbdd\fP. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +long getbddnodenum( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBgetbddnodenum\fP computes the number of different nodes in \fIBddNode\fP, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBgetbddnodenum\fP returns the number of the different nodes reached. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + printf( "Number nodes: %ld\n", + getbddnodenum( (bddsystem \(**)0, BddNode ) ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddnodesize.3 b/alliance/src/bdd/man3/getbddnodesize.3 new file mode 100644 index 00000000..c7257e08 --- /dev/null +++ b/alliance/src/bdd/man3/getbddnodesize.3 @@ -0,0 +1,63 @@ +.\" $Id: getbddnodesize.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddnodesize.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDNODESIZE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddnodesize \- gets the number of nodes in a \fBbdd\fP. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +long getbddnodesize( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBgetbddnodesize\fP computes the total number of nodes in \fIBddNode\fP, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBgetbddnodesize\fP returns the number of nodes reached. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + printf( "Number nodes: %ld\n", + getbddnodesize( (bddsystem \(**)0, BddNode ) ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddnodesupport.3 b/alliance/src/bdd/man3/getbddnodesupport.3 new file mode 100644 index 00000000..485fa26e --- /dev/null +++ b/alliance/src/bdd/man3/getbddnodesupport.3 @@ -0,0 +1,81 @@ +.\" $Id: getbddnodesupport.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddnodesupport.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDNODESUPPORT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddnodesupport \- gives the variable support of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void \(**getbddnodesupport( BddSystem, BddNode, Mode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + int Mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.TP +\fIMode\fP +The type of support. +.SH DESCRIPTION +\fBgetbddnodesupport\fP gives the support of the \fBbdd\fP node \fIBddNode\fP +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +If \fIMode\fP is BDD_SUPPORT_CHAIN the support is returned using +\fIchain_list\fP else it is returned using \fIptype_list\fP. +The support must be freed using the \fIfreechain\fP or \fIfreeptype\fP functions. +.br +.SH RETURN VALUE +\fBgetablexprsupport\fP returns a pointer to a \fIchain_list\fP or +a \fIptype_list\fP. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + chain_list \(**Support; + chain_list \(**ScanSupport; + bddindex Index; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Support = getablbddnodesupport( (bddsystem \(**0), BddNode, BDD_SUPPORT_CHAIN ); + for ( ScanSupport = Support; + ScanSupport != (chain_list \(**)0; + ScanSupport = ScanSupport->NEXT ) + { + Index = (bddnode \(**)ScanSupport->INDEX; + printf( "%s ", BddCircuit->NAME_IN[ Index - BDD_INDEX_MIN ] ); + } + freechain( Support ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddvarbyindex.3 b/alliance/src/bdd/man3/getbddvarbyindex.3 new file mode 100644 index 00000000..c3d813e0 --- /dev/null +++ b/alliance/src/bdd/man3/getbddvarbyindex.3 @@ -0,0 +1,66 @@ +.\" $Id: getbddvarbyindex.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddvarbyindex.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDVARBYINDEX 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddvarbyindex \- converts \fBbdd\fP index to a variable number. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddindex getbddvarbyindex( BddSystem, Index ) + bddsystem \(**BddSystem; + bddindex Index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIIndex\fP +The \fBbdd\fP index to convert. +.SH DESCRIPTION +\fBgetbddvarbyindex\fP converts the \fBbdd\fP index \fIIndex +to a variable number, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The function uses simply the translation table \fIBddSystem\fP->INDEX_TO_VAR. +.br +.SH RETURN VALUE +\fBgetbddvarbyindex\fP returns the variable number of the \fBbdd\fP index \fIIndex\fP. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIIndex parameter must be a valid index. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvar( (bddsystem \(**)0, 0 ); + /* displays 0 */ + printf( "%d", getbddvarbyindex( (bddsystem \(**)0, BddNode->INDEX ) ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddvarindex.3 b/alliance/src/bdd/man3/getbddvarindex.3 new file mode 100644 index 00000000..f04089ac --- /dev/null +++ b/alliance/src/bdd/man3/getbddvarindex.3 @@ -0,0 +1,67 @@ +.\" $Id: getbddvarindex.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddvarindex.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDVARINDEX 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddvarindex \- converts a variable number in a \fBbdd\fP index. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddindex getbddvarindex( BddSystem, Variable ) + bddsystem \(**BddSystem; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIVariable\fP +The variable number to convert. +.SH DESCRIPTION +\fBgetbddvarindex\fP converts the variable number \fIVariable\fP +to a \fBbdd\fP index, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The function uses simply the translation table \fIBddSystem\fP->VAR_TO_INDEX. +.br +.SH RETURN VALUE +\fBgetbddvarindex\fP returns the \fBbdd\fP index of \fIVariable\fP. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode = addbddvar( (bddsystem \(**)0, 0 ); + /* displays 2 */ + printf( "%d", getbddvarindex( (bddsystem \(**)0, 0 ) ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddvarnode.3 b/alliance/src/bdd/man3/getbddvarnode.3 new file mode 100644 index 00000000..ada31773 --- /dev/null +++ b/alliance/src/bdd/man3/getbddvarnode.3 @@ -0,0 +1,66 @@ +.\" $Id: getbddvarnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddvarnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDVARNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddvarnode \- gives the \fBbdd\fP node of a variable. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**getbddvarnode( BddSystem, Variable ) + bddsystem \(**BddSystem; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIVariable\fP +The variable number. +.SH DESCRIPTION +\fBgetbddvarnode\fP gives the \fBbdd\fP node of the variable number +\fIVariable\fP, in the \fBbdd\fP system BddSystem. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBgetbddvarnode\fP returns a pointer to the variable \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + addbddvar( (bddsystem \(**)0, 0 ); + BddNode = getbddvarnode( (bddsystem \(**)0, 0 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/getbddvarnodebyindex.3 b/alliance/src/bdd/man3/getbddvarnodebyindex.3 new file mode 100644 index 00000000..1d5c941d --- /dev/null +++ b/alliance/src/bdd/man3/getbddvarnodebyindex.3 @@ -0,0 +1,66 @@ +.\" $Id: getbddvarnodebyindex.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)getbddvarnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH GETBDDVARNODEBYINDEX 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +getbddvarnode \- gives the \fBbdd\fP node of a variable. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**getbddvarnodebyindex( BddSystem, Index ) + bddsystem \(**BddSystem; + bddindex Index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIIndex\fP +The \fBbdd\fP index. +.SH DESCRIPTION +\fBgetbddvarnode\fP gives the \fBbdd\fP node of the \fBbdd\fP index +\fIIndex\fP, in the \fBbdd\fP system BddSystem. +If a null pointer is given, the default \fBbdd\fP system is used. +The function uses simply the table \fIBddSystem\fP->VAR_NODE. +.br +.SH RETURN VALUE +\fBgetbddvarnode\fP returns a pointer to the variable \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIIndex\fP parameter must be a valid index. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + addbddvar( (bddsystem \(**)0, 0 ); + BddNode = getbddvarnodebyindex( (bddsystem \(**)0, 2 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/implybddnode.3 b/alliance/src/bdd/man3/implybddnode.3 new file mode 100644 index 00000000..1686cb13 --- /dev/null +++ b/alliance/src/bdd/man3/implybddnode.3 @@ -0,0 +1,78 @@ +.\" $Id: implybddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)implybddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH IMPLYBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +implybddnode \- computes a \fBbdd\fP that implies a conjonction of two \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**implybddnode( BddSystem, BddNode1, BddNode2 ) + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode1\fP +The first \fBbdd\fP node. +.TP +\fIBddNode2\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBimplybddnode\fP tests if the intersection of \fIBddNode1\fP and not \fIBddNode2\fP, +exists, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBimplybddnode\fP returns the \fBbdd\fP node zero if there is no +intersection, and a computed \fBbdd\fP node otherwise. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + bddnode \(**BddImply; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddImply = implybddnode( (bddsystem \(**)0, BddNode1, BddNode2 ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (i0 and (not i1)) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/incbddrefext.3 b/alliance/src/bdd/man3/incbddrefext.3 new file mode 100644 index 00000000..e70d22ba --- /dev/null +++ b/alliance/src/bdd/man3/incbddrefext.3 @@ -0,0 +1,60 @@ +.\" $Id: incbddrefext.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)incbddrefext.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH INCBDDREFEXT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +incbddrefext \- increments the external reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**incbddrefext( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBincbddrefext\fP increments the number of external reference +of the \fBbdd\fP node \fIBddNode\fP. +.br +.SH RETURN VALUE +\fBincbddrefext\fP returns the \fIBddNode\fP pointer. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + incbddrefext( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 2 REF_INT: 0 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/incbddrefint.3 b/alliance/src/bdd/man3/incbddrefint.3 new file mode 100644 index 00000000..a9c596d8 --- /dev/null +++ b/alliance/src/bdd/man3/incbddrefint.3 @@ -0,0 +1,60 @@ +.\" $Id: incbddrefint.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)incbddrefint.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH INCBDDREFINT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +incbddrefint \- increments the internal reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**incbddrefint( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBincbddrefint\fP increments the number of internal reference +of the \fBbdd\fP node \fIBddNode\fP. +.br +.SH RETURN VALUE +\fBincbddrefint\fP returns the \fIBddNode\fP pointer. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + incbddrefint( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 1 REF_INT: 1 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/intersectbddnode.3 b/alliance/src/bdd/man3/intersectbddnode.3 new file mode 100644 index 00000000..a637348b --- /dev/null +++ b/alliance/src/bdd/man3/intersectbddnode.3 @@ -0,0 +1,78 @@ +.\" $Id: intersectbddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)intersectbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH INTERSECTBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +intersectbddnode \- tests for an intersection between two \fBbdd\fP nodes. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**intersectbddnode( BddSystem, BddNode1, BddNode2 ) + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode1\fP +The first \fBbdd\fP node. +.TP +\fIBddNode2\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBintersectbddnode\fP tests if the intersection of \fIBddNode1\fP and \fIBddNode2\fP +exists, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBintersectbddnode\fP returns the \fBbdd\fP node zero if there is no +intersection, and a computed \fBbdd\fP node otherwise. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + bddnode \(**BddImply; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddImply = intersectbddnode( (bddsystem \(**)0, BddNode1, BddNode2 ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays (i0 and i1)) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/isbddvarinsupport.3 b/alliance/src/bdd/man3/isbddvarinsupport.3 new file mode 100644 index 00000000..f0aac9e8 --- /dev/null +++ b/alliance/src/bdd/man3/isbddvarinsupport.3 @@ -0,0 +1,83 @@ +.\" $Id: isbddvarinsupport.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)isbddvarinsupport.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH ISBDDVARINSUPPORT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +isbddvarinsupport \- tests if a variable appears in a \fBbdd\fP. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +int isbddvarinsupport( BddSystem, BddNode, Variable ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.TP +\fIVariable\fP +The variable number. +.SH DESCRIPTION +\fBisbddvarinsupport\fP tests if the variable number \fIVariable\fP +appears in the support of the \fBbdd\fP node \fIBddNode\fP, in the +\fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBisbddvarinsupport\fP returns 1 if \fIVariable\fP appears, 0 otherwise. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddVariable; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(** 0), BddVariable->INDEX ) ); + /* displays 1 */ + printf( "%d", isbddvarinsupport( (bddsystem \(**)0, BddNode, Variable ) ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/markbddnode.3 b/alliance/src/bdd/man3/markbddnode.3 new file mode 100644 index 00000000..babc4697 --- /dev/null +++ b/alliance/src/bdd/man3/markbddnode.3 @@ -0,0 +1,70 @@ +.\" $Id: markbddnode.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)markbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH MARKBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +markbddnode \- marks \fBbdd\fP node with a specified mask. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +long markbddnode( BddSystem, BddNode, Mark ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddmark Mark; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to mark. +.TP +\fIMark\fP +The bit mask. +.SH DESCRIPTION +\fBmarkbddnode\fP marks the \fBbdd\fP node \fIBddNode\fP +with the bit mask \fIMark\fP, in the \fBbdd\fP system BddSystem. +If a null pointer is given, the default \fBbdd\fP system is used. +This function does a OR with the field MARK of the \fBbdd\fP node \fIBddNode\fP, +and the bit mask \fIMark\fP. +.br +.SH RETURN VALUE +\fBmarkbddnode\fP returns the number of the differents marked nodes. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + printf( "Number nodes: %ld\n", + markbddnode( (bddsystem \(**)0, BddNode, 0x0001 ) ); + unmarkbddnode( (bddsystem \(**)0, BddNode, 0x0001 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/relprodbddnodeassoc.3 b/alliance/src/bdd/man3/relprodbddnodeassoc.3 new file mode 100644 index 00000000..c923c574 --- /dev/null +++ b/alliance/src/bdd/man3/relprodbddnodeassoc.3 @@ -0,0 +1,100 @@ +.\" $Id: relprodbddnodeassoc.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)relprodbddnodeassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH RELPRODBDDNODEASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +relprodbddnodeassoc \- computes a relational product. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**relprodbddnodeassoc( BddSystem, BddNode1, BddNode2, BddAssoc ) + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + bddassoc \(**BddAssoc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode1\fP +The first \fBbdd\fP node. +.TP +\fIBddNode2\fP +The second \fBbdd\fP node. +.TP +\fIBddAssoc\fP +The variable association. +.SH DESCRIPTION +\fBrelprodbddnodeassoc\fP computes \fIBddNode1\fP AND \fIBddNode2\fP, +and suppress the variables associated with something in the variable association +\fIBddAssoc\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBrelprodbddnodeassoc\fP returns the computed \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad variable association xxx, error !" +.ft R +.RS +The \fIBddAssoc\fP parameter must a valid variable association. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode1 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode2 = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSystem->ONE ); + BddNode = relprodbddnodeassoc( (bddsystem \(**)0, BddNode1, BddNode2, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays i1 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/reorderbddsystemdynamic.3 b/alliance/src/bdd/man3/reorderbddsystemdynamic.3 new file mode 100644 index 00000000..f2631cae --- /dev/null +++ b/alliance/src/bdd/man3/reorderbddsystemdynamic.3 @@ -0,0 +1,67 @@ +.\" $Id: reorderbddsystemdynamic.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)reorderbddsystemdynamic.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH REORDERBDDSYSTEMDYNAMIC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +reorderbddsystemdynamic \- specifies the dynamic \fBbdd\fP reorder parameters. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void reorderbddsystemdynamic( BddSystem, ReorderFunc, ReorderLow, ReorderRatio ) + bddsystem \(**BddSystem; + void (\(**ReorderFunc)(); + long ReorderLow; + long ReorderRatio; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIReorderFunc\fP +The dynamic reorder method. +.TP +\fIReorderLow\fP +The minimum number of \fBbdd\fP nodes. +.TP +\fIReorderRatio\fP +The reorder ratio in percent. +.SH DESCRIPTION +\fBreorderbddsystemdynamic\fP specifies to parameters for the dynamic reorder +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +If the number of \fBbdd\fP nodes is greater than \fIReorderLow\fP, then +the dynamic reorder function \fIReorderFunc\fP is called. The new +reorder limit is computed as the product of the number of \fBbdd\fP nodes +and the \fIReorderRatio\fP value plus 100. If this limit is less than \fIReorderLow\fP +then the new limit is fixed to \fIReorderLow\fP. If the function \fIReorderFunc\fP is a null +pointer, then the dynamic reorder process is skipped. +.br +.SH RETURN VALUE +\fBreorderbddsystemdynamic\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + reorderbddsystemdynamic( BddSystem, reorderbddsystemwindow, 1000, 50 ); + ... + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/reorderbddsystemsimple.3 b/alliance/src/bdd/man3/reorderbddsystemsimple.3 new file mode 100644 index 00000000..8501e43d --- /dev/null +++ b/alliance/src/bdd/man3/reorderbddsystemsimple.3 @@ -0,0 +1,51 @@ +.\" $Id: reorderbddsystemsimple.3,v 1.1 2002/03/18 11:26:50 ludo Exp $ +.\" @(#)reorderbddsystemsimple.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH REORDERBDDSYSTEMSIMPLE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +reorderbddsystemsimple \- reorders the \fBbdd\fP nodes of a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void reorderbddsystemsimple( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBreorderbddsystemsimple\fP reorders all the \fBbdd\fP nodes of the +\fBbdd\fP system \fIBddSystem\fP, in order to minimize the total +number of \fBbdd\fP nodes. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBreorderbddsystemsimple\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + reorderbddsystemsimple( BddSystem ); + ... + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/reorderbddsystemtop.3 b/alliance/src/bdd/man3/reorderbddsystemtop.3 new file mode 100644 index 00000000..389b1ee5 --- /dev/null +++ b/alliance/src/bdd/man3/reorderbddsystemtop.3 @@ -0,0 +1,51 @@ +.\" $Id: reorderbddsystemtop.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)reorderbddsystemtop.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH REORDERBDDSYSTEMTOP 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +reorderbddsystemtop \- reorders the \fBbdd\fP nodes of a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void reorderbddsystemtop( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBreorderbddsystemtop\fP reorders all the \fBbdd\fP nodes of the +\fBbdd\fP system \fIBddSystem\fP, in order to minimize the total +number of \fBbdd\fP nodes. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBreorderbddsystemtop\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + reorderbddsystemtop( BddSystem ); + ... + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/reorderbddsystemwindow.3 b/alliance/src/bdd/man3/reorderbddsystemwindow.3 new file mode 100644 index 00000000..0accbe88 --- /dev/null +++ b/alliance/src/bdd/man3/reorderbddsystemwindow.3 @@ -0,0 +1,51 @@ +.\" $Id: reorderbddsystemwindow.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)reorderbddsystemwindow.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH REORDERBDDSYSTEMWINDOW 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +reorderbddsystemwindow \- reorders the \fBbdd\fP nodes of a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void reorderbddsystemwindow( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.SH DESCRIPTION +\fBreorderbddsystemwindow\fP reorders all the \fBbdd\fP nodes of the +\fBbdd\fP system \fIBddSystem\fP, in order to minimize the total +number of \fBbdd\fP nodes. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBreorderbddsystemwindow\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + reorderbddsystemwindow( BddSystem ); + ... + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/resetbddcircuit.3 b/alliance/src/bdd/man3/resetbddcircuit.3 new file mode 100644 index 00000000..f7a2340f --- /dev/null +++ b/alliance/src/bdd/man3/resetbddcircuit.3 @@ -0,0 +1,53 @@ +.\" $Id: resetbddcircuit.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)resetbddcircuit.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH RESETBDDCIRCUIT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +resetbddcircuit \- resets a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void resetbddcircuit( BddCircuit ) + bddcircuit \(**BddCircuit; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit to reset. +.SH DESCRIPTION +\fBresetbddcircuit\fP resets the \fBbdd\fP circuit \fIBddCircuit\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBresetbddcircuit\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + resetbddcircuit( (bddcircuit \(**)0 ); + ... + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR createbddcircuit(3), +.BR destroybddcircuit(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/resetbddsystem.3 b/alliance/src/bdd/man3/resetbddsystem.3 new file mode 100644 index 00000000..9f0a1daf --- /dev/null +++ b/alliance/src/bdd/man3/resetbddsystem.3 @@ -0,0 +1,50 @@ +.\" $Id: resetbddsystem.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)resetbddsystem.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH RESETBDDSYSTEM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +resetbddsystem \- resets a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void resetbddsystem( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system to reset. +.SH DESCRIPTION +\fBresetbddsystem\fP resets the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBresetbddsystem\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + resetbddsystem( (bddsystem \(**)0 ); + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) +.BR createbddsytem(3), +.BR destroybddsytem(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/restrictbddnode.3 b/alliance/src/bdd/man3/restrictbddnode.3 new file mode 100644 index 00000000..77fc0abb --- /dev/null +++ b/alliance/src/bdd/man3/restrictbddnode.3 @@ -0,0 +1,103 @@ +.\" $Id: restrictbddnode.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)restrictbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH RESTRICTBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +restrictbddnode \- substitutes a variable by a zero or one, in a \fBbdd\fP. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**restrictbddnode( BddSystem, BddNode, Variable, BddSubst ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddvar Variable; + bddnode \(**BddSubst; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.TP +\fIVariable\fP +The variable to find. +.TP +\fIBddSubst\fP +The \fBbdd\fP to substitute with. +.SH DESCRIPTION +\fBrestrictbddnode\fP substitutes all the occurency of the variable \fIVariable\fP +in the \fBbdd\fP node \fIBddNode\fP by the \fBbdd\fP node \fIBddSubst\fP, in the +\fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fIBddSubst\fP must be a the node \fIBddSystem\fP->ONE or \fIBddSystem\fP->ZERO. +.br +.SH RETURN VALUE +\fBrestrictbddnode\fP returns the resulting \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIBddSubst\fP parameter must have its index less than BDD_INDEX_MIN. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddVariable; + bddnode \(**BddNode; + bddnode \(**BddSubst; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddSubst = BddSystem->ONE; + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + BddNode = restrictbddnode( (bddsystem \(**)0, BddNode, Variable, BddSubst ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays '1' */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/satisfybddnode.3 b/alliance/src/bdd/man3/satisfybddnode.3 new file mode 100644 index 00000000..2c8e0aa5 --- /dev/null +++ b/alliance/src/bdd/man3/satisfybddnode.3 @@ -0,0 +1,76 @@ +.\" $Id: satisfybddnode.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)satisfybddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SATISFYBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +satisfybddnode \- finds a satisfying path for a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**satisfybddnode( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBsatisfybddnode\fP finds a simple path throw the \fBbdd\fP \fIBddNode\fP +that reaches the constant \fBbdd\fP node one, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBsatisfybddnode\fP returns a \fBbdd\fP node that satisfies \fIBddNode\fP. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"index xxx out of range, error !" +.ft R +.RS +The \fIBddNode\fP parameter must be different from the \fBbdd\fP node zero. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddNode = satisfybddnode( (bddsystem \(**)0, BddNode ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays i0 */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/searchbddcircuitin.3 b/alliance/src/bdd/man3/searchbddcircuitin.3 new file mode 100644 index 00000000..185350e8 --- /dev/null +++ b/alliance/src/bdd/man3/searchbddcircuitin.3 @@ -0,0 +1,60 @@ +.\" $Id: searchbddcircuitin.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)searchbddcircuitin.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SEARCHBDDCIRCUITIN 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +searchbddcircuitin \- searchs an input in a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddnode \(**searchbddcircuitin( BddCircuit, InputName ) + bddcircuit \(**BddCircuit; + char \(**InputName; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIInputName\fP +The name of the input to look for. +.SH DESCRIPTION +\fBsearchbddcircuitin\fP searchs the input \fIInputName\fP in the \fBbdd\fP +circuit \fIBddCircuit\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBsearchbddcircuitin\fP returns the node corresponding to the input \fIInputName\fP +or a null pointer if no such input is found. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin ( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + ... + BddNode = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR addbddcircuitin(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/searchbddcircuitout.3 b/alliance/src/bdd/man3/searchbddcircuitout.3 new file mode 100644 index 00000000..de4379fb --- /dev/null +++ b/alliance/src/bdd/man3/searchbddcircuitout.3 @@ -0,0 +1,61 @@ +.\" $Id: searchbddcircuitout.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)searchbddcircuitout.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SEARCHBDDCIRCUITOUT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +searchbddcircuitout \- searchs an output in a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddnode \(**searchbddcircuitout( BddCircuit, OutputName ) + bddcircuit \(**BddCircuit; + char \(**OutputName; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit. +.TP +\fIOutputName\fP +The name of the output to look for. +.SH DESCRIPTION +\fBsearchbddcircuitout\fP searchs the output \fIOutputName\fP in the \fBbdd\fP +circuit \fIBddCircuit\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBsearchbddcircuitout\fP returns the node corresponding to +the output \fIOutputName\fP or a null pointer if no such output is found. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + addbddcircuitout( (bddcircuit \(**)0, "Out0", BddNode ); + ... + BddNode = searchbddcircuitout( (bddcircuit \(**)0, "Out0" ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1), +.BR addbddcircuitout(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/setbddrefext.3 b/alliance/src/bdd/man3/setbddrefext.3 new file mode 100644 index 00000000..d264ea8b --- /dev/null +++ b/alliance/src/bdd/man3/setbddrefext.3 @@ -0,0 +1,73 @@ +.\" $Id: setbddrefext.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)setbddrefext.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SETBDDREFEXT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +setbddrefext \- increments the external reference, +and decrements the internal reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**setbddrefext( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBsetbddrefext\fP increments the number of external reference +of the \fBbdd\fP node \fIBddNode\fP and decrements its number of +internal reference. +.br +.SH RETURN VALUE +\fBsetbddrefext\fP returns the \fIBddNode\fP pointer. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"negative reference, index xxx error !" +.ft R +.RS +The \fIBddNode\fP must have a postive number of internal reference. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + incbddrefint( BddNode ); + setbddrefext( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 1 REF_INT: 0 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/simpbddnodedcoff.3 b/alliance/src/bdd/man3/simpbddnodedcoff.3 new file mode 100644 index 00000000..9489c803 --- /dev/null +++ b/alliance/src/bdd/man3/simpbddnodedcoff.3 @@ -0,0 +1,80 @@ +.\" $Id: simpbddnodedcoff.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)simpbddnodedcoff.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SIMPBDDNODEDCOFF 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +simpbddnodedcoff \- simplifies a \fBbdd\fP with don't cares on its off-set part. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**simpbddnodedcoff( BddSystem, BddOff, BddDc ) + bddsystem \(**BddSystem; + bddnode \(**BddOff; + bddnode \(**BddDc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddOff\fP +The first \fBbdd\fP node. +.TP +\fIBddDc\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBsimpbddnodedcoff\fP simplifies the \fBbdd\fP node \fIBddOff\fP with +\fIBddDc\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fBbdd\fP node \fIBddDc\fP must be included imperatively +in the off-set part of the \fBbdd\fP node \fIBddOff\fP. +.br +.SH RETURN VALUE +\fBsimpbddnodedcoff\fP returns the simplified \fBbdd\fP node. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddOff; + bddnode \(**BddDc; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddOff = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_NOR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddDc = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddNode = simpbddnodedcoff( (bddsystem \(**)0, BddOff, BddDc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays '1' */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/simpbddnodedcon.3 b/alliance/src/bdd/man3/simpbddnodedcon.3 new file mode 100644 index 00000000..a743f874 --- /dev/null +++ b/alliance/src/bdd/man3/simpbddnodedcon.3 @@ -0,0 +1,80 @@ +.\" $Id: simpbddnodedcon.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)simpbddnodedcon.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SIMPBDDNODEDCON 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +simpbddnodedcon \- simplifies a \fBbdd\fP with don't cares on its on-set part. + +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**simpbddnodedcon( BddSystem, BddOn, BddDc ) + bddsystem \(**BddSystem; + bddnode \(**BddOn; + bddnode \(**BddDc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddOn\fP +The first \fBbdd\fP node. +.TP +\fIBddDc\fP +The second \fBbdd\fP node. +.SH DESCRIPTION +\fBsimpbddnodedcon\fP simplifies the \fBbdd\fP node \fIBddOn\fP with +\fIBddDc\fP, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +The \fBbdd\fP node \fIBddDc\fP must be included imperatively +in the on-set part of the \fBbdd\fP node \fIBddOn\fP. +.br +.SH RETURN VALUE +\fBsimpbddnodedcon\fP returns the simplified \fBbdd\fP node. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddOn; + bddnode \(**BddDc; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddOn = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_NOR, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddDc = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddNode = simpbddnodedcon( (bddsystem \(**)0, BddOn, BddDc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays '1' */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/substbddnodeassoc.3 b/alliance/src/bdd/man3/substbddnodeassoc.3 new file mode 100644 index 00000000..788316b8 --- /dev/null +++ b/alliance/src/bdd/man3/substbddnodeassoc.3 @@ -0,0 +1,106 @@ +.\" $Id: substbddnodeassoc.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)substbddnodeassoc.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SUBSTBDDNODEASSOC 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +substbddnodeassoc \- substitutes a set of variables with a set of \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**substbddnodeassoc( BddSystem, BddNode, BddAssoc ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddassoc \(**BddAssoc; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to treat. +.TP +\fIBddAssoc\fP +The variable association. +.SH DESCRIPTION +\fBsubstbddnodeassoc\fP substitutes in the \fBbdd\fP node \fIBddNode\fP +all the variables associated to something in the variable association +\fIBddAssoc\fP, with the corresponding \fBbdd\fP node, +in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBsubstbddnodeassoc\fP returns the computed \fBbdd\fP node. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP parameter must be less or equal to +the \fIBddSystem->NUMBER_VAR\fP field. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"bad variable association xxx, error !" +.ft R +.RS +The \fIBddAssoc\fP parameter must a valid variable association. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + bddnode \(**BddSubst; + bddnode \(**BddVariable; + bddassoc \(**Assoc; + chain_list \(**Expr; + bddvar Variable; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + Expr = createablbinexpr( ABL_OR, + createablatom( "i2" ), + createablatom( "i3" ) ); + BddSubst = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + BddVariable = searchbddcircuitin( (bddcircuit \(**)0, "i0" ); + Variable = getbddvarbyindex( (bddsystem \(**)0, BddVariable->INDEX ); + Assoc = addbddassoc( (bddsystem \(**)0 ); + addbddnodeassoc( (bddsystem \(**)0, Assoc, Variable, BddSubst ); + BddNode = substbddnodeassoc( (bddsystem \(**)0, BddSubst, Assoc ); + Expr = convertbddcircuitabl( BddCircuit, BddNode ); + /* displays ((i3 or i2) and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddassoc( (bddsystem \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/swapbddvar.3 b/alliance/src/bdd/man3/swapbddvar.3 new file mode 100644 index 00000000..b50d1be5 --- /dev/null +++ b/alliance/src/bdd/man3/swapbddvar.3 @@ -0,0 +1,67 @@ +.\" $Id: swapbddvar.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)swapbddvar.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH SWAPBDDVAR 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +swapbddvar \- swaps two contiguous variables. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void swapbddvar( BddSystem, Variable ) + bddsystem \(**BddSystem; + bddvar Variable; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIVariable\fP +The variable to swap. +.SH DESCRIPTION +\fBswapbddvar\fP swaps the variable number \fIVariable\fP with +the variable number \fIVariable\fP + 1, in the \fBbdd\fP system \fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +This function is usefull for the \fBbdd\fP nodes reordering. +.br +.SH RETURN VALUE +\fBswapbddvar\fP returns nothing. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"variable xxx out of range, error !" +.ft R +.RS +The \fIVariable\fP and \fIVariable\fP + 1, must be valid variables number. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddnode \(**BddNode1; + bddnode \(**BddNode2; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddNode1 = addbddvar( (bddsystem \(**)0, 0 ); + BddNode2 = addbddvar( (bddsystem \(**)0, 0 ); + swapbddvar( (bddsystem \(**)0, 0 ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/testbddcircuit.3 b/alliance/src/bdd/man3/testbddcircuit.3 new file mode 100644 index 00000000..c845f2c1 --- /dev/null +++ b/alliance/src/bdd/man3/testbddcircuit.3 @@ -0,0 +1,54 @@ +.\" $Id: testbddcircuit.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)testbddcircuit.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH TESTBDDCIRCUIT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +testbddcircuit \- debugs a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +int testbddcircuit( BddCircuit ) + bddcircuit \(**BddCircuit; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit to debug. +.SH DESCRIPTION +\fBtestbddcircuit\fP calls a debugger of \fIBddCircuit\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +This function provides a multiple commands to debug all the +functions include in this \fBbdd\fP package. +.br +.SH RETURN VALUE +\fBtestbddcircuit\fP returns 0 if the debugger is interrupt by user, and 1 otherwise. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + testbddcircuit( (bddcircuit \(**)0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/unmarkbddnode.3 b/alliance/src/bdd/man3/unmarkbddnode.3 new file mode 100644 index 00000000..5ae405e4 --- /dev/null +++ b/alliance/src/bdd/man3/unmarkbddnode.3 @@ -0,0 +1,70 @@ +.\" $Id: unmarkbddnode.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)unmarkbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH UNMARKBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +unmarkbddnode \- unmarks \fBbdd\fP node with a specified mask. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +long unmarkbddnode( BddSystem, BddNode, Mark ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; + bddunmark Mark; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to unmark. +.TP +\fIMark\fP +The bit mask. +.SH DESCRIPTION +\fBunmarkbddnode\fP unmarks the \fBbdd\fP node \fIBddNode\fP +with the bit mask \fIMark\fP, in the \fBbdd\fP system BddSystem. +If a null pointer is given, the default \fBbdd\fP system is used. +This function does a AND with the field MARK of the \fBbdd\fP node \fIBddNode\fP, +and the complemented bit mask \fIMark\fP. +.br +.SH RETURN VALUE +\fBunmarkbddnode\fP returns the number of the differents unmarked nodes. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + Expr = createablbinexpr( ABL_AND, + createablatom( "i0" ), + createablatom( "i1" ) ); + BddNode = addbddcircuitabl( BddCircuit, Expr ); + freeablexpr( Expr ); + printf( "Number nodes: %ld\n", + markbddnode( (bddsystem \(**)0, BddNode, 0x0001 ) ); + unmarkbddnode( (bddsystem \(**)0, BddNode, 0x0001 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/unsetbddrefext.3 b/alliance/src/bdd/man3/unsetbddrefext.3 new file mode 100644 index 00000000..ca455554 --- /dev/null +++ b/alliance/src/bdd/man3/unsetbddrefext.3 @@ -0,0 +1,73 @@ +.\" $Id: unsetbddrefext.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)unsetbddrefext.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH UNSETBDDREFEXT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +unsetbddrefext \- increments the internal reference, +and decrements the external reference of a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +bddnode \(**unsetbddrefext( BddNode ) + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddNode\fP +The \fBbdd\fP node. +.SH DESCRIPTION +\fBunsetbddrefext\fP increments the number of internal reference +of the \fBbdd\fP node \fIBddNode\fP and decrements its number of +external reference. +.br +.SH RETURN VALUE +\fBunsetbddrefext\fP returns the \fIBddNode\fP pointer. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"negative reference, index xxx error !" +.ft R +.RS +The \fIBddNode\fP must have a postive number of external reference. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + BddNode = addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + BddNode = addbddnode( (bddsystem \(**)0, BddNode->INDEX, BddNode->LOW, BddNode->HIGH ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + incbddrefext( BddNode ); + unsetbddrefext( BddNode ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 0 REF_INT: 1 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + /* displays (not i0) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/viewbddcircuit.3 b/alliance/src/bdd/man3/viewbddcircuit.3 new file mode 100644 index 00000000..8d7d7d2a --- /dev/null +++ b/alliance/src/bdd/man3/viewbddcircuit.3 @@ -0,0 +1,56 @@ +.\" $Id: viewbddcircuit.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)viewbddcircuit.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH VIEWBDDCIRCUIT 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +viewbddcircuit \- displays a \fBbdd\fP circuit. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void viewbddcircuit( BddCircuit, ViewIndex ) + bddcircuit \(**BddCircuit; + char ViewName; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddCircuit\fP +The \fBbdd\fP circuit to display. +.TP +\fIViewName\fP +Flag to display more informations. +.SH DESCRIPTION +\fBviewbddcircuit\fP displays the \fBbdd\fP circuit \fIBddCircuit\fP. +If \fIViewName\fP is true, \fBviewbddcircuit\fP displays also the field \fINAME_IN\fP. +If a null pointer is given, the default \fBbdd\fP circuit is used. +.br +.SH RETURN VALUE +\fBviewbddcircuit\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + ... + viewbddcircuit( (bddcircuit \(**)0, 0 ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/viewbddnode.3 b/alliance/src/bdd/man3/viewbddnode.3 new file mode 100644 index 00000000..fdb51bb1 --- /dev/null +++ b/alliance/src/bdd/man3/viewbddnode.3 @@ -0,0 +1,68 @@ +.\" $Id: viewbddnode.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)viewbddnode.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH VIEWBDDNODE 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +viewbddnode \- displays a \fBbdd\fP node. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void viewbddnode( BddSystem, BddNode ) + bddsystem \(**BddSystem; + bddnode \(**BddNode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system. +.TP +\fIBddNode\fP +The \fBbdd\fP node to display. +.SH DESCRIPTION +\fBviewbddnode\fP displays the node \fIBddNode\fP, in the \fBbdd\fP system +\fIBddSystem\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBviewbddnode\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + bddcircuit \(**BddCircuit; + bddnode \(**BddNode; + chain_list \(**Expr; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + BddCircuit = createbddcircuit( "hello_world", 10, 10, BddSystem ); + addbddcircuitin( (bddcircuit \(**)0, "i0", 0, BDD_IN_MODE_FIRST ); + addbddcircuitin( (bddcircuit \(**)0, "i1", 0, BDD_IN_MODE_FIRST ); + BddNode = applybddnode( (bddsystem \(**)0, + ABL_AND, + searchbddcircuitin( (bddcircuit \(**)0, "i0" ), + searchbddcircuitin( (bddcircuit \(**)0, "i1" ) ); + Expr = convertbddcircuitabl( (bddcircuit \(**)0, BddNode ); + /* displays (i0 and i1) */ + viewablexpr( Expr, ABL_VIEW_VHDL ); + freeablexpr( Expr ); + /* displays Node VAR: 0 INDEX: 2 MARK: 0 REF_EXT: 1 REF_INT: 0 */ + viewbddnode( (bddsystem \(**)0, BddNode ); + destroybddsystem( (bddsystem \(**)0 ); + destroybddcircuit( (bddcircuit \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/viewbddsystem.3 b/alliance/src/bdd/man3/viewbddsystem.3 new file mode 100644 index 00000000..71e4e1e0 --- /dev/null +++ b/alliance/src/bdd/man3/viewbddsystem.3 @@ -0,0 +1,54 @@ +.\" $Id: viewbddsystem.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)viewbddsystem.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH VIEWBDDSYSTEM 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +viewbddsystem \- displays a \fBbdd\fP system. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void viewbddsystem( BddSystem, ViewIndex ) + bddsystem \(**BddSystem; + char ViewIndex; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system to display. +.TP +\fIViewIndex\fP +Flag to display more informations. +.SH DESCRIPTION +\fBviewbddsystem\fP displays the \fBbdd\fP system \fIBddSystem\fP. +If \fIViewIndex\fP is true, \fBviewbddsystem\fP displays also +the two fields \fIINDEX_TO_VAR\fP and \fIVAR_TO_INDEX\fP. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBviewbddsystem\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + viewbddsystem( BddSystem, 0 ); + destroybddsystem( (bddsystem \(**)0 ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/man3/viewbddsysteminfo.3 b/alliance/src/bdd/man3/viewbddsysteminfo.3 new file mode 100644 index 00000000..609f74d5 --- /dev/null +++ b/alliance/src/bdd/man3/viewbddsysteminfo.3 @@ -0,0 +1,51 @@ +.\" $Id: viewbddsysteminfo.3,v 1.1 2002/03/18 11:26:51 ludo Exp $ +.\" @(#)viewbddsysteminfo.2 2.7 96/07/02 ; Labo masi cao-vlsi; Author : Jacomme Ludovic +.TH VIEWBDDSYSTEMINFO 3 "October 1, 1997" "ASIM/LIP6" "BDD FUNCTIONS" +.SH NAME +viewbddsysteminfo \- displays statistical informations. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" +void viewbddsysteminfo( BddSystem ) + bddsystem \(**BddSystem; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIBddSystem\fP +The \fBbdd\fP system to examines. +.SH DESCRIPTION +\fBviewbddsysteminfo\fP provides statistical informations +on the \fBbdd\fP system \fIBddSystem\fP, for example the +perfomance of the different caches. +If a null pointer is given, the default \fBbdd\fP system is used. +.br +.SH RETURN VALUE +\fBviewbddsysteminfo\fP returns nothing. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "bdd101.h" + bddsystem \(**BddSystem; + BddSystem = createbddsystem( 100, 1000, 100, 50000 ); + ... + viewbddsysteminfo( BddSystem ); + destroybddsystem( BddSystem ); +.ft R +.fi +.SH SEE ALSO +.BR bdd (1) +.BR viewbddsystem(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/bdd/src/Makefile.am b/alliance/src/bdd/src/Makefile.am new file mode 100644 index 00000000..3af861f2 --- /dev/null +++ b/alliance/src/bdd/src/Makefile.am @@ -0,0 +1,27 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libBdd.a +include_HEADERS = bdd.h +libAbl_a_SOURCES = \ +bdd.h bddenv.h bddimply.h bddsimpdc.h \ +bddalloc.c bdderror.c bddlog.c bddsubst.c \ +bddalloc.h bdderror.h bddlog.h bddsubst.h \ +bddapply.c bddexist.c bddmark.c bddsupport.c \ +bddapply.h bddexist.h bddmark.h bddsupport.h \ +bddassoc.c bddexplosion.c bddnode.c bddsweep.c \ +bddassoc.h bddexplosion.h bddnode.h bddsweep.h \ +bddblock.c bddflag.c bddoptimize.c bddsystem.c \ +bddblock.h bddflag.h bddoptimize.h bddsystem.h \ +bddcheck.c bddfraction.c bddreduce.c bddtest.c \ +bddcheck.h bddfraction.h bddreduce.h bddtest.h \ +bddcircuit.c bddfree.c bddref.c bddtransfert.c \ +bddcircuit.h bddfree.h bddref.h bddtransfert.h \ +bddcofactor.c bddgarbage.c bddrelprod.c bdduser.c \ +bddcofactor.h bddgarbage.h bddrelprod.h bdduser.h \ +bddcompose.c bddheath.c bddreorder.c bddvar.c \ +bddcompose.h bddheath.h bddreorder.h bddvar.h \ +bddconvert.c bddhnode.c bddresize.c bddvaraux.c \ +bddconvert.h bddhnode.h bddresize.h bddvaraux.h \ +bdddump.c bddhoper.c bddsatisfy.c bddvartree.c \ +bdddump.h bddhoper.h bddsatisfy.h bddvartree.h \ +bddenv.c bddimply.c bddsimpdc.c diff --git a/alliance/src/bdd/src/bdd.h b/alliance/src/bdd/src/bdd.h new file mode 100644 index 00000000..c53dd493 --- /dev/null +++ b/alliance/src/bdd/src/bdd.h @@ -0,0 +1,1111 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for BDD | +| | +| Date : 19.06.2000 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef BDD_105_H +# define BDD_105_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Hash Oper Constants | +| | +\------------------------------------------------------*/ + +# define BDD_OPER_RESTRICT ((long)0x00010000) +# define BDD_OPER_COMPOSE ((long)0x00020000) +# define BDD_OPER_SIMP_DC_ON ((long)0x00040000) +# define BDD_OPER_SIMP_DC_OFF ((long)0x00080000) +# define BDD_OPER_INTERSECT ((long)0x00100000) +# define BDD_OPER_COFACTOR ((long)0x00200000) +# define BDD_OPER_SUBSTITUTE ((long)0x00400000) +# define BDD_OPER_EXIST ((long)0x00800000) +# define BDD_OPER_EXIST_MISS ((long)0x01000000) +# define BDD_OPER_REDUCE ((long)0x02000000) +# define BDD_OPER_REL_PROD ((long)0x04000000) + +# define BDD_OPER_MASK ((long)0x03FF0000) + +/*------------------------------------------------------\ +| | +| Bdd Hash Node | +| | +\------------------------------------------------------*/ + +# define BDD_HASH_NODE_EMPTY ((bddhnode)0) +# define BDD_HASH_NODE_DELETED ((bddhnode)1) + +/*------------------------------------------------------\ +| | +| Bdd Index | +| | +\------------------------------------------------------*/ + +# define BDD_INDEX_ZERO ((bddindex) 0) +# define BDD_INDEX_ONE ((bddindex) 1) +# define BDD_INDEX_MIN ((bddindex) 2) + +# define BDD_MAX_INDEX ((bddindex)-1) + +/*------------------------------------------------------\ +| | +| Bdd Short | +| | +\------------------------------------------------------*/ + +# define BDD_MAX_SHORT ((bddshort)-1) + +/*------------------------------------------------------\ +| | +| Bdd Variable | +| | +\------------------------------------------------------*/ + +# define BDD_MAX_VAR ( ((bddvar)-1) - BDD_INDEX_MIN ) +# define BDD_MIN_VAR ((bddvar)-1) + +/*------------------------------------------------------\ +| | +| Bdd Reference | +| | +\------------------------------------------------------*/ + +# define BDD_MAX_REF ((bddref)-1) + +/*------------------------------------------------------\ +| | +| Bdd Flag | +| | +\------------------------------------------------------*/ + +# define BDD_FLAG_NUM_MASK (bddflag)( 0x0001 ) +# define BDD_MAX_FLAG (bddflag)( -1 ) + +/*------------------------------------------------------\ +| | +| Support Type | +| | +\------------------------------------------------------*/ + +# define BDD_SUPPORT_CHAIN 0 +# define BDD_SUPPORT_PTYPE 1 + +/*------------------------------------------------------\ +| | +| Add Input Mode | +| | +\------------------------------------------------------*/ + +# define BDD_IN_MODE_FIRST 0x00 +# define BDD_IN_MODE_LAST 0x01 +# define BDD_IN_MODE_BEFORE 0x02 +# define BDD_IN_MODE_AFTER 0x03 +# define BDD_IN_MODE_IMPOSE 0x04 + +/*------------------------------------------------------\ +| | +| Add Auxiliar Mode | +| | +\------------------------------------------------------*/ + +# define BDD_AUX_MODE_SINGLE 0x00 +# define BDD_AUX_MODE_GLOBAL 0x01 + +/*------------------------------------------------------\ +| | +| User Function Type | +| | +\------------------------------------------------------*/ + +# define BDD_FUNC_RESET_HASH_OPER 0 + +/*------------------------------------------------------\ +| | +| Bdd System Flags | +| | +\------------------------------------------------------*/ + +# define BDD_SYSTEM_REORDER_ON_MASK 0x0001 +# define BDD_SYSTEM_REORDER_MASK 0x0002 +# define BDD_SYSTEM_EXPLOSION_ON_MASK 0x0004 +# define BDD_SYSTEM_EXPLOSION_MASK 0x0008 +# define BDD_SYSTEM_SWAP_VAR_MASK 0x0010 +# define BDD_SYSTEM_NO_WARNING_MASK 0x0020 + +/*------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------\ +| | +| Bdd System Mask | +| | +\------------------------------------------------------*/ + +# define SetBddSystemReorderOn( S ) ( (S)->FLAGS |= BDD_SYSTEM_REORDER_ON_MASK ) +# define IsBddSystemReorderOn( S ) ( (S)->FLAGS & BDD_SYSTEM_REORDER_ON_MASK ) +# define ClearBddSystemReorderOn( S ) ( (S)->FLAGS &= ~BDD_SYSTEM_REORDER_ON_MASK) + +# define SetBddSystemReorder( S ) ( (S)->FLAGS |= BDD_SYSTEM_REORDER_MASK ) +# define IsBddSystemReorder( S ) ( (S)->FLAGS & BDD_SYSTEM_REORDER_MASK ) +# define ClearBddSystemReorder( S ) ( (S)->FLAGS &= ~BDD_SYSTEM_REORDER_MASK) + +# define SetBddSystemExplosionOn( S ) ( (S)->FLAGS |= BDD_SYSTEM_EXPLOSION_ON_MASK ) +# define IsBddSystemExplosionOn( S ) ( (S)->FLAGS & BDD_SYSTEM_EXPLOSION_ON_MASK ) +# define ClearBddSystemExplosionOn( S ) ( (S)->FLAGS &= ~BDD_SYSTEM_EXPLOSION_ON_MASK) + +# define SetBddSystemExplosion( S ) ( (S)->FLAGS |= BDD_SYSTEM_EXPLOSION_MASK ) +# define IsBddSystemExplosion( S ) ( (S)->FLAGS & BDD_SYSTEM_EXPLOSION_MASK ) +# define ClearBddSystemExplosion( S ) ((S)->FLAGS &= ~BDD_SYSTEM_EXPLOSION_MASK) + +# define SetBddSystemSwapVar( S ) ( (S)->FLAGS |= BDD_SYSTEM_SWAP_VAR_MASK ) +# define IsBddSystemSwapVar( S ) ( (S)->FLAGS & BDD_SYSTEM_SWAP_VAR_MASK ) +# define ClearBddSystemSwapVar( S ) ( (S)->FLAGS &= ~BDD_SYSTEM_SWAP_VAR_MASK) + +# define SetBddSystemNoWarning( S ) ( (S)->FLAGS |= BDD_SYSTEM_NO_WARNING_MASK ) +# define IsBddSystemNoWarning( S ) ( (S)->FLAGS & BDD_SYSTEM_NO_WARNING_MASK ) +# define ClearBddSystemNoWarning( S ) ( (S)->FLAGS &= ~BDD_SYSTEM_NO_WARNING_MASK) + +/*------------------------------------------------------\ +| | +| Bdd Local System | +| | +\------------------------------------------------------*/ + +# define setbddlocalsystem( S ) \ + \ + do { if ( (S) ) BddLocalSystem = (S); } while (0) + +/*------------------------------------------------------\ +| | +| Bdd Local Circuit | +| | +\------------------------------------------------------*/ + +# define setbddlocalcircuit( C ) \ + \ + do { if ( (C) ) { BddLocalCircuit = (C); \ + BddLocalSystem = (C)->BDD_SYSTEM; } } while (0) + +/*------------------------------------------------------\ +| | +| Bdd Support | +| | +\------------------------------------------------------*/ + +# define getbddnodesupportchain( S, N ) \ + \ + ((chain_list *)getbddnodesupport( (S), (N), BDD_SUPPORT_CHAIN )) + +# define getbddnodesupportptype( S, N ) \ + \ + ((ptype_list *)getbddnodesupport( (S), (N), BDD_SUPPORT_PTYPE )) + +/*------------------------------------------------------\ +| | +| Type | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Index Ref Mark and Var | +| | +\------------------------------------------------------*/ + + typedef unsigned short bddindex; + typedef unsigned short bddref; + typedef unsigned char bddmark; + typedef unsigned char bddflag; + typedef unsigned short bddvar; + typedef unsigned short bddshort; + +/*------------------------------------------------------\ +| | +| Bdd Alloc Info | +| | +\------------------------------------------------------*/ + + typedef struct bddallocinfo + { + long CIRCUIT; + long SYSTEM; + long BLOCK; + long NODE_BLOCK; + long HASH_NODE_TABLE; + long HASH_NODE; + long HASH_OPER_TABLE; + long HASH_OPER; + long VAR_TREE; + long VAR_CHILD; + long VAR; + long VAR_NODE; + long INDEX_NODE; + long INDEX; + long ASSOC; + long ASSOC_NODE; + long NAME_IN; + long INDEX_IN; + long HEATH; + long USER_FUNC; + + } bddallocinfo; + +/*------------------------------------------------------\ +| | +| Bdd User Function | +| | +\------------------------------------------------------*/ + + typedef struct bdduserfunc + { + struct bdduserfunc *NEXT; + void (*FUNC)(); + void *DATA; + long TYPE; + + } bdduserfunc; + +/*------------------------------------------------------\ +| | +| Bdd Node | +| | +\------------------------------------------------------*/ + + typedef struct bddnode + { + struct bddnode *HIGH; + struct bddnode *LOW; + bddindex INDEX; + bddmark MARK; + bddflag FLAG; + bddref REF_EXT; + bddref REF_INT; + + } bddnode; + +/*------------------------------------------------------\ +| | +| Bdd Hash Node | +| | +\------------------------------------------------------*/ + + typedef bddnode *bddhnode; + +/*------------------------------------------------------\ +| | +| Bdd Block | +| | +\------------------------------------------------------*/ + + typedef struct bddblock + { + struct bddblock *NEXT; + struct bddnode *NODE; + long NODE_FREE; + + } bddblock; + +/*------------------------------------------------------\ +| | +| Bdd Hash Node Table | +| | +\------------------------------------------------------*/ + + typedef struct bddhnodetable + { + bddhnode *TABLE; + long TABLE_SIZE; + long NUMBER_NODE; + long NUMBER_ADD; + long NUMBER_SCAN; + long NUMBER_STRETCH; + long NUMBER_RESIZE; + + } bddhnodetable; + +/*------------------------------------------------------\ +| | +| Bdd Hash Oper | +| | +\------------------------------------------------------*/ + + typedef struct bddhoper + { + bddnode *LEFT; + bddnode *RIGHT; + bddnode *FATHER; + long OPERATOR; + + } bddhoper; + +/*------------------------------------------------------\ +| | +| Bdd Hash Oper Table | +| | +\------------------------------------------------------*/ + + typedef struct bddhopertable + { + bddhoper *TABLE; + long TABLE_SIZE; + long TABLE_FREEZE; + long NUMBER_OPER; + long NUMBER_ADD; + long NUMBER_HIT; + long NUMBER_MISS; + long NUMBER_RESET; + + } bddhopertable; + +/*------------------------------------------------------\ +| | +| Bdd Variable Node | +| | +\------------------------------------------------------*/ + + typedef bddnode *bddvarnode; + +/*------------------------------------------------------\ +| | +| Bdd Index Node | +| | +\------------------------------------------------------*/ + + typedef bddhnodetable *bddindexnode; + +/*------------------------------------------------------\ +| | +| Bdd Assoc Node | +| | +\------------------------------------------------------*/ + + typedef bddnode *bddassocnode; + +/*------------------------------------------------------\ +| | +| Bdd Assoc | +| | +\------------------------------------------------------*/ + + typedef struct bddassoc + { + struct bddassoc *NEXT; + bddassocnode *ASSOC_NODE; + bddvar FIRST; + bddvar LAST; + bddshort IDENT; + bddshort CACHE; + + } bddassoc; + +/*------------------------------------------------------\ +| | +| Bdd System | +| | +\------------------------------------------------------*/ + + typedef struct bddsystem + { + bddblock *BLOCK; + bddnode *NODE_FREE; + long NUMBER_FREE; + + bddindexnode *INDEX_NODE; + bddvarnode *VAR_NODE; + bddindex *VAR_TO_INDEX; + bddvar *INDEX_TO_VAR; + + + long NUMBER_NODE; + long MAX_NODE; + long TOP_NODE; + + long NUMBER_VAR; + long MAX_VAR; + + long NUMBER_INDEX; + long MAX_INDEX; + + bddassoc *ASSOC; + unsigned char ASSOC_RESET; + + bddhopertable *HASH_OPER; + + bddnode *ONE; + bddnode *ZERO; + + bddmark MARK; + long FLAGS; + + void (*REORDER_FUNC)(); + long REORDER_LOW; + long REORDER_LIMIT; + long REORDER_RATIO; + + bdduserfunc *USER_FUNC; + + long VAR_MODEL; + long OPER_MODEL; + + void (*EXPLOSION_FUNC)(); + long EXPLOSION_LIMIT; + + } bddsystem; + +/*------------------------------------------------------\ +| | +| Bdd Name Input | +| | +\------------------------------------------------------*/ + + typedef char *bddnamein; + +/*------------------------------------------------------\ +| | +| Bdd Circuit | +| | +\------------------------------------------------------*/ + + typedef struct bddcircuit + { + char *NAME; + + authtable *HASH_IN; + authtable *HASH_OUT; + + bddnamein *NAME_IN; + long NAME_IN_SIZE; + + bddindex *INDEX_IN; + long INDEX_IN_SIZE; + + long NUMBER_NAME_IN; + long NUMBER_NAME_OUT; + + bddsystem *BDD_SYSTEM; + + } bddcircuit; + +/*------------------------------------------------------\ +| | +| Bdd Heath | +| | +\------------------------------------------------------*/ + + typedef struct bddheath + { + struct bddheath *NEXT; + struct bddnode *VAR; + struct bddnode *MINUS; + struct bddnode *PLUS; + + } bddheath; + +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ + + extern long BDD_HNODE_STRETCH_FACTOR; + extern long BDD_HNODE_RESIZE_FACTOR; + extern long BDD_HNODE_MIN_FILL_FACTOR; + extern long BDD_HNODE_MAX_SCAN; + + extern bddsystem *BddLocalSystem; + extern bddcircuit *BddLocalCircuit; + extern bddallocinfo BddAllocInfo; + +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Env Functions | +| | +\------------------------------------------------------*/ + + extern void bddenv __P(()); + +/*------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------*/ + + extern bddcircuit * allocbddcircuit __P(()); + extern bddsystem * allocbddsystem __P(()); + + extern bddblock * allocbddblock __P(()); + extern bddnode * allocbddnodeblock __P((long Number)); + extern bddhnodetable * allocbddhnodetable __P(()); + extern bddhnode * allocbddhnode __P((long Number)); + extern bddhopertable * allocbddhopertable __P(()); + extern bddhoper * allocbddhoper __P((long Number)); + + extern bddvar * allocbddvar __P((long Number)); + extern bddvarnode * allocbddvarnode __P((long Number)); + extern bddindexnode * allocbddindexnode __P((long Number)); + extern bddindex * allocbddindex __P((long Number)); + extern bddnamein * allocbddnamein __P((long Number)); + extern bddindex * allocbddindexin __P((long Number)); + + extern bddassoc * allocbddassoc __P(()); + extern bddassocnode * allocbddassocnode __P((long Number)); + + extern bddheath * allocbddheath __P(()); + extern bdduserfunc * allocbdduserfunc __P(()); + + extern void viewbddallocinfo __P(()); + +/*------------------------------------------------------\ +| | +| Resize Functions | +| | +\------------------------------------------------------*/ + + extern bddvar * resizebddvar __P((bddvar *BddVar, long OldNum, long NewNum)); + extern bddvarnode * resizebddvarnode __P((bddvarnode *BddVarNode, long OldNum, long NewNum)); + extern bddindexnode * resizebddindexnode __P((bddindexnode *BddIndexNode, long OldNum, long NewNum)); + extern bddindex * resizebddindex __P((bddindex *BddIndex, long OldNum, long NewNum)); + extern bddassocnode * resizebddassocnode __P((bddassocnode *BddAssocNode, long OldNum, long NewNum)); + extern bddnamein * resizebddnamein __P((bddnamein *NameIn, long OldNum, long NewNum)); + extern bddindex * resizebddindexin __P((bddindex *IndexIn, long OldNum, long NewNum)); + +/*------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------*/ + + extern void freebddcircuit __P((bddcircuit *BddCircuit)); + extern void freebddsystem __P((bddsystem *BddSystem)); + extern void freebddblock __P((bddblock *BddBlock)); + extern void freebddnodeblock __P((bddnode *BddNode)); + extern void freebddhnodetable __P((bddhnodetable *HashTable)); + extern void freebddhnode __P((bddhnode *HashNode)); + extern void freebddhopertable __P((bddhopertable *HashTable)); + extern void freebddhoper __P((bddhoper *HashOper)); + extern void freebddvar __P((bddvar *BddVariable)); + extern void freebddvarnode __P((bddvarnode *BddVariableNode)); + extern void freebddindex __P((bddindex *BddIndex)); + extern void freebddindexnode __P((bddindexnode *BddIndexNode)); + extern void freebddnamein __P((bddnamein *NameIn)); + extern void freebddindexin __P((bddindex *IndexIn)); + extern void freebddassoc __P((bddassoc *BddAssoc)); + extern void freebddassocnode __P((bddassocnode *BddAssocNode)); + extern void freebddheath __P((bddheath *BddHeath)); + extern void freebdduserfunc __P((bdduserfunc *BddUserFunc)); + +/*------------------------------------------------------\ +| | +| Circuit Functions | +| | +\------------------------------------------------------*/ + + extern bddcircuit * createbddcircuit __P((char *Name, long NumberIn, long NumberOut, bddsystem *BddSystem)); + extern void resetbddcircuit __P((bddcircuit *BddCircuit)); + extern void destroybddcircuit __P((bddcircuit *BddCircuit)); + extern void viewbddcircuit __P((bddcircuit *BddCircuit, char ViewName)); + + extern bddnode * searchbddcircuitin __P((bddcircuit *BddCircuit, char *InputName)); + extern bddnode * addbddcircuitin __P((bddcircuit *BddCircuit, char *InputName, bddindex Index, long Mode)); + extern char * getbddcircuitinname __P((bddcircuit *BddCircuit, bddindex Index )); + extern bddnode * addbddcircuitaux __P((bddcircuit *BddCircuit, char *InputName, bddnode *BddAux, int (*UserFunc)(), long Mode)); + extern bddnode * renamebddcircuitin __P((bddcircuit *BddCircuit, char *InputName, char *NewName)); + + extern bddnode * searchbddcircuitout __P((bddcircuit *BddCircuit, char *OutputName)); + extern bddnode * addbddcircuitout __P((bddcircuit *BddCircuit, char *OutputName, bddnode *BddNode)); + extern int delbddcircuitout __P((bddcircuit *BddCircuit, char *OutputName)); + + extern bddnode * addbddcircuitabl __P((bddcircuit *BddCircuit, ablexpr *Expr)); + extern ablexpr * convertbddcircuitabl __P((bddcircuit *BddCircuit, bddnode *BddNode)); + extern ablexpr * convertbddcircuitsumabl __P((bddcircuit *BddCircuit, bddnode *BddNode)); + + extern long getbddcircuitnumnode __P(( bddcircuit *BddCircuit )); + extern long getbddcircuitsize __P(( bddcircuit *BddCircuit )); + extern void optimizebddcircuit __P(( bddcircuit *BddCircuit, long (*CostFunc)(), float MaxSizeFactor )); + +/*------------------------------------------------------\ +| | +| System Functions | +| | +\------------------------------------------------------*/ + + extern bddsystem * createbddsystem __P((long ModelVar, long ModelOper, long MaxVar, long MaxNode)); + extern void resetbddsystem __P((bddsystem *BddSystem)); + extern void destroybddsystem __P((bddsystem *BddSystem)); + extern void viewbddsystem __P((bddsystem *BddSystem, char ViewIndex)); + extern void viewbddsysteminfo __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| Block Functions | +| | +\------------------------------------------------------*/ + + extern bddblock * createbddblock __P((bddsystem *BddSystem)); + extern void resetbddblock __P((bddsystem *BddSystem)); + extern void destroybddblock __P((bddsystem *BddSystem)); + extern void viewbddblock __P((bddsystem *BddSystem, void (*FuncView)())); + + extern bddblock * addbddblock __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| User Functions | +| | +\------------------------------------------------------*/ + + extern bdduserfunc * addbdduserfunc __P((bddsystem *BddSystem, long Type, void (*Func)(), void *Data)); + extern void execbdduserfunc __P((bddsystem *BddSystem, long Type)); + extern int delbdduserfunc __P((bddsystem *BddSystem, bdduserfunc *BddUserFunc)); + extern void destroybdduserfunc __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| Variable Functions | +| | +\------------------------------------------------------*/ + + extern bddindex newbddvar __P((bddsystem *BddSystem, bddvar Variable)); + extern bddnode * addbddvar __P((bddsystem *BddSystem, bddvar Variable)); + extern bddnode * addbddvarfirst __P((bddsystem *BddSystem)); + extern bddnode * addbddvarlast __P((bddsystem *BddSystem)); + extern bddnode * addbddvarbefore __P((bddsystem *BddSystem, bddindex Index)); + extern bddnode * addbddvarafter __P((bddsystem *BddSystem, bddindex Index)); + + extern int swapbddvar __P((bddsystem *BddSystem, bddvar Variable)); + extern void sweepbddvar __P((bddsystem *BddSystem, bddvar Variable, int SweepRef)); + + extern bddindex getbddvarindex __P((bddsystem *BddSystem, bddvar Variable)); + extern bddvar getbddvarbyindex __P((bddsystem *BddSystem, bddindex Index)); + extern bddnode * getbddvarnode __P((bddsystem *BddSystem, bddvar Variable)); + extern bddnode * getbddvarnodebyindex __P((bddsystem *BddSystem, bddindex Index)); + +/*------------------------------------------------------\ +| | +| Auxiliary Variable Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * addbddvarauxsingle __P((bddsystem *BddSystem, bddnode *BddAux)); + extern bddnode * addbddvarauxglobal __P((bddsystem *BddSystem, bddnode *BddAux, int (*UserFunc)())); + extern bddnode *addbddvarauxuser(); + +/*------------------------------------------------------\ +| | +| Node Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * addbddnode __P((bddsystem *BddSystem, bddindex Index, bddnode *High, bddnode *Low)); + extern void delbddnode __P((bddsystem *BddSystem, bddnode *BddNode)); + extern void viewbddnode __P((bddsystem *BddSystem, bddnode *BddNode)); + + extern chain_list * addbddnodelist __P((bddsystem *BddSystem, chain_list *HeadList, bddnode *BddNode)); + extern void delbddnodelist __P((bddsystem *BddSystem, chain_list *HeadList)); + +/*------------------------------------------------------\ +| | +| Reference Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * incbddrefext __P((bddnode *BddNode)); + extern bddnode * decbddrefext __P((bddnode *BddNode)); + extern bddnode * incbddrefint __P((bddnode *BddNode)); + extern bddnode * decbddrefint __P((bddnode *BddNode)); + + extern bddnode * setbddrefext __P((bddnode *BddNode)); + extern bddnode * unsetbddrefext __P((bddnode *BddNode)); + + extern void updatebddref __P((bddnode *BddNode)); + + extern void clearbddsystemrefext __P((bddsystem *BddSystem)); + extern void clearbddsystemrefint __P((bddsystem *BddSystem)); + extern void clearbddsystemref __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| Association Functions | +| | +\------------------------------------------------------*/ + + extern bddassoc * addbddassoc __P((bddsystem *BddSystem)); + extern int delbddassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc)); + extern void viewbddassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc, void (*FuncView)())); + + extern void resetbddassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc)); + extern void destroybddassoc __P((bddsystem *BddSystem)); + + extern bddassoc * addbddnodeassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc, bddvar Variable, bddnode *BddNode)); + extern int delbddnodeassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc, bddvar Variable)); + +/*------------------------------------------------------\ +| | +| Mark Functions | +| | +\------------------------------------------------------*/ + + extern void newbddsystemmark __P(( bddsystem *BddSystem )); + extern void setbddnodemark __P(( bddsystem *BddSystem, bddnode *BddNode )); + extern int testbddnodemark __P(( bddsystem *BddSystem, bddnode *BddNode )); + + extern long getbddnodenum __P((bddsystem *BddSystem, bddnode *BddNode)); + extern long getbddnodesize __P((bddsystem *BddSystem, bddnode *BddNode)); + +/*------------------------------------------------------\ +| | +| Flag Functions | +| | +\------------------------------------------------------*/ + + extern long flagbddnode __P((bddsystem *BddSystem, bddnode *BddNode, bddflag Flag)); + extern long unflagbddnode __P((bddsystem *BddSystem, bddnode *BddNode, bddflag Flag)); + +/*------------------------------------------------------\ +| | +| Check Functions | +| | +\------------------------------------------------------*/ + + extern int checkbddindex __P((bddsystem *BddSystem, bddindex Index, int Severity)); + extern int checkbddvar __P((bddsystem *BddSystem, bddvar Variable, int Severity)); + extern int checkbddoper __P((bddsystem *BddSystem, long Oper, int Severity)); + extern int checkbddassoc __P((bddsystem *BddSystem, bddassoc *BddAssoc, int Severity)); + extern int checkbddmaxnode __P((bddsystem *BddSystem, int Severity)); + +/*------------------------------------------------------\ +| | +| Get Hash Functions | +| | +\------------------------------------------------------*/ + + extern long getbddhnodesize __P((long Size)); + extern long getbddhnodekey __P((bddhnodetable *Table, bddnode *BddNode)); + extern long getbddhnodeindex __P((bddhnodetable *Table, bddnode *BddNode, long Index)); + + extern long getbddhopersize __P((long Size)); + extern long getbddhoperkey __P((bddhopertable *Table, long Oper, bddnode *BddLeft, bddnode *BddRight)); + +/*------------------------------------------------------\ +| | +| Check Hash Functions | +| | +\------------------------------------------------------*/ + + extern int checkbddhnode __P((bddnode *HashNode, int Severity)); + +/*------------------------------------------------------\ +| | +| Set Hash Functions | +| | +\------------------------------------------------------*/ + + extern void setbddhnodefunc __P((long (*FuncSize)(), long (*FuncKey)(), long (*FuncIndex)())); + extern void setbddhoperfunc __P((long (*FuncSize)(), long (*FuncKey)())); + +/*------------------------------------------------------\ +| | +| Hash Table Functions | +| | +\------------------------------------------------------*/ + + extern bddhnodetable * createbddhnodetable __P((long Length)); + extern void stretchbddhnodetable __P((bddhnodetable *HashTable)); + extern void destroybddhnodetable __P((bddhnodetable *HashTable)); + extern void resetbddhnodetable __P((bddhnodetable *HashTable)); + extern void viewbddhnodetable __P((bddhnodetable *HashTable, void (*FuncView)())); + + extern bddhopertable * createbddhopertable __P((long Length)); + extern void destroybddhopertable __P((bddhopertable *HashTable)); + extern void resetbddhopertable __P((bddhopertable *HashTable)); + extern void viewbddhopertable __P((bddhopertable *HashTable, void (*FuncView)())); + +/*------------------------------------------------------\ +| | +| Hash Node Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * addbddhnode __P((bddhnodetable *HashTable, bddnode *BddNode)); + extern int delbddhnode __P((bddhnodetable *HashTable, bddnode *BddNode)); + extern void viewbddhnode __P((bddnode *HashNode)); + +/*------------------------------------------------------\ +| | +| Hash Oper Functions | +| | +\------------------------------------------------------*/ + + extern bddhoper * addbddhoper __P((bddhopertable *HashTable, long Oper, bddnode *BddLeft, bddnode *BddRight, bddnode *BddFather)); + extern bddhoper * searchbddhoper __P((bddhopertable *HashTable, long Oper, bddnode *BddLeft, bddnode *BddRight)); + extern void viewbddhoper __P((bddhoper *HashOper)); + +/*------------------------------------------------------\ +| | +| View Index and Variable Nodes | +| | +\------------------------------------------------------*/ + + extern void viewbddindexnode __P((bddsystem *BddSystem, void (*FuncView)())); + extern void viewbddvarnode __P((bddsystem *BddSystem, void (*FuncView)())); + +/*------------------------------------------------------\ +| | +| Apply Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * applybddnode __P((bddsystem *BddSystem, long Oper, bddnode *BddNode1, bddnode *BddNode2)); + extern bddnode * applybddnodenot __P((bddsystem *BddSystem, bddnode *BddNode)); + extern bddnode * applybddnodeite __P((bddsystem *BddSystem, bddnode *BddIf, bddnode *BddThen, bddnode *BddElse)); + extern bddnode * applybddnodeterm __P((bddsystem *BddSystem, long Oper, bddindex Index, bddnode *BddNode)); + extern bddnode * applybddnodelist __P((bddsystem *BddSystem, long Oper, chain_list *BddList)); + +/*------------------------------------------------------\ +| | +| Support Functions | +| | +\------------------------------------------------------*/ + + extern void * getbddnodesupport __P((bddsystem *BddSystem, bddnode *BddNode, int Mode)); + extern int isbddvarinsupport __P((bddsystem *BddSystem, bddnode *BddNode, bddvar Variable)); + +/*------------------------------------------------------\ +| | +| Compose Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * restrictbddnode __P((bddsystem *BddSystem, bddnode *BddNode, bddvar Variable, bddnode *BddSubst)); + extern bddnode * composebddnode __P((bddsystem *BddSystem, bddnode *BddNode, bddvar Variable, bddnode *BddSubst)); + +/*------------------------------------------------------\ +| | +| Substitute Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * substbddnodeassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + +/*------------------------------------------------------\ +| | +| Existential Quantification Functions | +| | +\------------------------------------------------------*/ + + extern bddnode *forallbddnodeassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + extern bddnode *forallbddnodemissassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + extern bddnode *existbddnodeassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + extern bddnode *existbddnodemissassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + +/*------------------------------------------------------\ +| | +| Relational Product Functions | +| | +\------------------------------------------------------*/ + + extern bddnode *relprodbddnodeassoc __P((bddsystem *BddSystem, bddnode *BddNode1, bddnode *BddNode2, bddassoc *BddAssoc)); + +/*------------------------------------------------------\ +| | +| Intersect & Imply Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * implybddnode __P((bddsystem *BddSystem, bddnode *BddNode1, bddnode *BddNode2)); + extern bddnode * intersectbddnode __P((bddsystem *BddSystem, bddnode *BddNode1, bddnode *BddNode2)); + +/*------------------------------------------------------\ +| | +| Fraction Functions | +| | +\------------------------------------------------------*/ + + extern double fractionbddnode __P((bddsystem *BddSystem, bddnode *BddNode)); + +/*------------------------------------------------------\ +| | +| Satisfy Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * satisfybddnode __P((bddsystem *BddSystem, bddnode *BddNode)); + extern bddnode * satisfybddnodeassoc __P((bddsystem *BddSystem, bddnode *BddNode, bddassoc *BddAssoc)); + +/*------------------------------------------------------\ +| | +| Cofactor Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * cofactorbddnode __P((bddsystem *BddSystem, bddnode *BddNode1, bddnode *BddNode2)); + +/*------------------------------------------------------\ +| | +| Reduce Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * reducebddnode __P((bddsystem *BddSystem, bddnode *BddNode1, bddnode *BddNode2)); + +/*------------------------------------------------------\ +| | +| Heath Functions | +| | +\------------------------------------------------------*/ + + extern bddheath * getbddheath __P((bddsystem *BddSystem, bddnode *BddNode)); + extern bddheath * getbddheathvar __P((bddsystem *BddSystem, bddnode *BddNode, bddvar Variable)); + extern void delbddheath __P((bddsystem *BddSystem, bddheath *BddHeath)); + +/*------------------------------------------------------\ +| | +| Simplify Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * simpbddnodedcon __P((bddsystem *BddSystem, bddnode *BddOn, bddnode *BddDc)); + extern bddnode * simpbddnodedcoff __P((bddsystem *BddSystem, bddnode *BddOff, bddnode *BddDc)); + +/*------------------------------------------------------\ +| | +| Conversion Functions | +| | +\------------------------------------------------------*/ + + extern chain_list * convertbddnodeabl __P((bddsystem *BddSystem, char **NameArray, bddindex *IndexArray, bddnode *BddNode)); + extern ablexpr *convertbddnodemuxabl(); + extern chain_list * convertbddnodesumabl __P((bddsystem *BddSystem, char **NameArray, bddindex *IndexArray, bddnode *BddNode)); + extern chain_list * convertbddindexabl __P((bddsystem *BddSystem, char **NameArray, bddindex *IndexArray, bddindex Index)); + +/*------------------------------------------------------\ +| | +| Garbage Collect Functions | +| | +\------------------------------------------------------*/ + + extern void garbagebddsystem __P((bddsystem *BddSystem)); + extern void sweepbddsystem __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| Reorder Functions | +| | +\------------------------------------------------------*/ + + extern void reorderbddsystemsimple __P((bddsystem *BddSystem)); + extern void reorderbddsystemwindow __P((bddsystem *BddSystem)); + extern void reorderbddsystemtop __P((bddsystem *BddSystem)); + + extern void reorderbddsystemdynamic __P((bddsystem *BddSystem, void (*ReorderFunc)(), long ReorderLow, long ReorderRatio)); + +/*------------------------------------------------------\ +| | +| Explosion Functions | +| | +\------------------------------------------------------*/ + + extern void explosionbddsystemdynamic __P((bddsystem *BddSystem, void (*ExplosionFunc)(), long ExplosionLimit)); + extern void explosionbddsystemrestart __P((bddsystem *BddSystem)); + +/*------------------------------------------------------\ +| | +| Test Functions | +| | +\------------------------------------------------------*/ + + extern int testbddcircuit __P((bddcircuit *BddCircuit)); + +/*------------------------------------------------------\ +| | +| Dump Functions | +| | +\------------------------------------------------------*/ + + extern bddcircuit * undumpbddcircuit __P((bddsystem *BddSystem, char *FileName)); + extern void dumpbddcircuit __P((bddcircuit *BddCircuit, char *FileName)); + +/*------------------------------------------------------\ +| | +| Name Functions | +| | +\------------------------------------------------------*/ + + extern char * isbddstablename __P((char *StableName)); + extern char * getbddstablename __P((char *Name)); + +/*------------------------------------------------------\ +| | +| Log Compatibility Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * getlogbddnodeone __P(()); + extern bddnode * getlogbddnodezero __P(()); + extern bddnode * getlogbddnodeterm __P((bddindex Index)); + extern bddnode * getlogbddnodenot __P((bddnode *BddNode)); + extern bddnode * applylogbddnode __P((long Oper, bddnode *BddNode1, bddnode *BddNode2)); + extern ablexpr * convertlogbddnode __P((bddcircuit *BddCircuit, bddnode *BddNode)); + extern short addlogbddcircuitin __P((bddcircuit *BddCircuit, char *Name)); + +/*------------------------------------------------------\ +| | +| Bdd Transfert Functions | +| | +\------------------------------------------------------*/ + + extern bddnode * transfertbdd __P(( bddsystem *SystemSrc, bddsystem *SystemDst, bddnode *Node )); + + +# endif diff --git a/alliance/src/bdd/src/bddalloc.c b/alliance/src/bdd/src/bddalloc.c new file mode 100644 index 00000000..d0834c94 --- /dev/null +++ b/alliance/src/bdd/src/bddalloc.c @@ -0,0 +1,398 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddalloc.c | +| | +| Date : 03.12.96 | +| | +| Bddhor : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddalloc.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + bddallocinfo BddAllocInfo = + + { + 0, /* CIRCUIT */ + 0, /* SYSTEM */ + 0, /* BLOCK */ + 0, /* NODE_BLOCK */ + 0, /* HASH_NODE_TABLE */ + 0, /* HASH_NODE */ + 0, /* HASH_OPER_TABLE */ + 0, /* HASH_OPER */ + 0, /* VAR */ + 0, /* VAR_NODE */ + 0, /* INDEX_NODE */ + 0, /* INDEX */ + 0, /* ASSOC */ + 0, /* ASSOC_NODE */ + 0, /* NAME_IN */ + 0, /* INDEX_IN */ + 0, /* HEATH */ + 0 /* USER_FUNC */ + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Alloc User Func | +| | +\------------------------------------------------------------*/ + +bdduserfunc *allocbdduserfunc() +{ + BddAllocInfo.USER_FUNC++; + + return( (bdduserfunc *)autallocheap( sizeof( bdduserfunc ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Heath | +| | +\------------------------------------------------------------*/ + +bddheath *allocbddheath() +{ + BddAllocInfo.HEATH++; + + return( (bddheath *)autallocheap( sizeof( bddheath ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Hash Node | +| | +\------------------------------------------------------------*/ + +bddhnode *allocbddhnode( Number ) + + long Number; +{ + BddAllocInfo.HASH_NODE += Number; + + return( (bddhnode *)autallocblock( sizeof( bddhnode ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Hash Oper | +| | +\------------------------------------------------------------*/ + +bddhoper *allocbddhoper( Number ) + + long Number; +{ + BddAllocInfo.HASH_OPER += Number; + + return( (bddhoper *)autallocblock( sizeof( bddhoper ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Hash Node Table | +| | +\------------------------------------------------------------*/ + +bddhnodetable *allocbddhnodetable() +{ + BddAllocInfo.HASH_NODE_TABLE++; + + return( (bddhnodetable *)autallocheap( sizeof( bddhnodetable ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Hash Oper Table | +| | +\------------------------------------------------------------*/ + +bddhopertable *allocbddhopertable() +{ + BddAllocInfo.HASH_OPER_TABLE++; + + return( (bddhopertable *)autallocblock( sizeof( bddhopertable ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Block | +| | +\------------------------------------------------------------*/ + +bddblock *allocbddblock() +{ + BddAllocInfo.BLOCK++; + + return( (bddblock *)autallocheap( sizeof( bddblock ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Node Block | +| | +\------------------------------------------------------------*/ + +bddnode *allocbddnodeblock( Number ) + + long Number; +{ + BddAllocInfo.NODE_BLOCK += Number; + + return( (bddnode *)autallocblock( sizeof( bddnode ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Variable Node | +| | +\------------------------------------------------------------*/ + +bddvarnode *allocbddvarnode( Number ) + + long Number; +{ + BddAllocInfo.VAR_NODE += Number; + + return( (bddvarnode *)autallocblock( sizeof( bddvarnode ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Index Node | +| | +\------------------------------------------------------------*/ + +bddindexnode *allocbddindexnode( Number ) + + long Number; +{ + BddAllocInfo.INDEX_NODE += Number; + + return( (bddindexnode *)autallocblock( sizeof( bddindexnode ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Variable | +| | +\------------------------------------------------------------*/ + +bddvar *allocbddvar( Number ) + + long Number; +{ + BddAllocInfo.VAR += Number; + + return( (bddvar *)autallocblock( sizeof( bddvar ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Index | +| | +\------------------------------------------------------------*/ + +bddindex *allocbddindex( Number ) + + long Number; +{ + BddAllocInfo.INDEX += Number; + + return( (bddindex *)autallocblock( sizeof( bddindex ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Assoc | +| | +\------------------------------------------------------------*/ + +bddassoc *allocbddassoc() +{ + BddAllocInfo.ASSOC++; + + return( (bddassoc *)autallocheap( sizeof( bddassoc ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Assoc Node | +| | +\------------------------------------------------------------*/ + +bddassocnode *allocbddassocnode( Number ) + + long Number; +{ + BddAllocInfo.ASSOC_NODE += Number; + + return( (bddassocnode *)autallocblock( sizeof( bddassocnode ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Name Input | +| | +\------------------------------------------------------------*/ + +bddnamein *allocbddnamein( Number ) + + long Number; +{ + BddAllocInfo.NAME_IN += Number; + + return( (bddnamein *)autallocblock( sizeof( bddnamein ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Index Input | +| | +\------------------------------------------------------------*/ + +bddindex *allocbddindexin( Number ) + + long Number; +{ + BddAllocInfo.INDEX_IN += Number; + + return( (bddindex *)autallocblock( sizeof( bddindex ) * Number ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc System | +| | +\------------------------------------------------------------*/ + +bddsystem *allocbddsystem() +{ + BddAllocInfo.SYSTEM++; + + return( (bddsystem *)autallocblock( sizeof( bddsystem ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Alloc Circuit | +| | +\------------------------------------------------------------*/ + +bddcircuit *allocbddcircuit() +{ + BddAllocInfo.CIRCUIT++; + + return( (bddcircuit *)autallocblock( sizeof( bddcircuit ) ) ); +} + +/*------------------------------------------------------------\ +| | +| View Bdd Alloc Info | +| | +\------------------------------------------------------------*/ + +void viewbddallocinfo() +{ + fprintf( stdout, "--> BddAllocInfo\n" ); + fprintf( stdout, " CIRCUIT : %ld bytes\n", + BddAllocInfo.CIRCUIT * sizeof( bddcircuit ) ); + fprintf( stdout, " SYSTEM : %ld bytes\n", + BddAllocInfo.SYSTEM * sizeof( bddsystem ) ); + fprintf( stdout, " BLOCK : %ld bytes\n", + BddAllocInfo.BLOCK * sizeof( bddblock ) ); + fprintf( stdout, " NODE_BLOCK : %ld bytes\n", + BddAllocInfo.NODE_BLOCK * sizeof( bddnode ) ); + fprintf( stdout, " HASH_NODE_TABLE : %ld bytes\n", + BddAllocInfo.HASH_NODE_TABLE * sizeof( bddhnodetable ) ); + fprintf( stdout, " HASH_NODE : %ld bytes\n", + BddAllocInfo.HASH_NODE * sizeof( bddhnode ) ); + fprintf( stdout, " HASH_OPER_TABLE : %ld bytes\n", + BddAllocInfo.HASH_OPER_TABLE * sizeof( bddhopertable ) ); + fprintf( stdout, " HASH_OPER : %ld bytes\n", + BddAllocInfo.HASH_OPER * sizeof( bddhoper ) ); + fprintf( stdout, " VAR : %ld bytes\n", + BddAllocInfo.VAR * sizeof( bddvar ) ); + fprintf( stdout, " VAR_NODE : %ld bytes\n", + BddAllocInfo.VAR_NODE * sizeof( bddvarnode ) ); + fprintf( stdout, " INDEX_NODE : %ld bytes\n", + BddAllocInfo.INDEX_NODE * sizeof( bddindexnode ) ); + fprintf( stdout, " INDEX : %ld bytes\n", + BddAllocInfo.INDEX * sizeof( bddindex ) ); + fprintf( stdout, " ASSOC : %ld bytes\n", + BddAllocInfo.ASSOC * sizeof( bddassoc ) ); + fprintf( stdout, " ASSOC_NODE : %ld bytes\n", + BddAllocInfo.ASSOC_NODE * sizeof( bddassocnode ) ); + fprintf( stdout, " NAME_IN : %ld bytes\n", + BddAllocInfo.NAME_IN * sizeof( bddnamein ) ); + fprintf( stdout, " INDEX_IN : %ld bytes\n", + BddAllocInfo.INDEX_IN * sizeof( bddindex ) ); + fprintf( stdout, " HEATH : %ld bytes\n", + BddAllocInfo.HEATH * sizeof( bddheath ) ); + fprintf( stdout, " USER_FUNC : %ld bytes\n", + BddAllocInfo.USER_FUNC * sizeof( bdduserfunc ) ); + fprintf( stdout, "<-- BddAllocInfo\n" ); + +} diff --git a/alliance/src/bdd/src/bddalloc.h b/alliance/src/bdd/src/bddalloc.h new file mode 100644 index 00000000..13dff02a --- /dev/null +++ b/alliance/src/bdd/src/bddalloc.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddalloc.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_ALLOC_H +# define BDD_ALLOC_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddapply.c b/alliance/src/bdd/src/bddapply.c new file mode 100644 index 00000000..a56bca2b --- /dev/null +++ b/alliance/src/bdd/src/bddapply.c @@ -0,0 +1,499 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddapply.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddapply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Apply Bdd Node Not | +| | +\------------------------------------------------------------*/ + +bddnode *loc_applybddnot( BddNode ) + + bddnode *BddNode; +{ + bddhoper *HashOper; + bddnode *BddNot; + + if ( BddNode == BddLocalSystem->ONE ) + { + return( BddLocalSystem->ZERO ); + } + + if ( BddNode == BddLocalSystem->ZERO ) + { + return( BddLocalSystem->ONE ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + ABL_NOT, BddNode, BddNode ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + BddNot = addbddnode( (bddsystem *)0, BddNode->INDEX, + decbddrefext( loc_applybddnot( BddNode->HIGH ) ), + decbddrefext( loc_applybddnot( BddNode->LOW ) ) ); + + addbddhoper( BddLocalSystem->HASH_OPER, + ABL_NOT, BddNode, BddNode, BddNot ); + + return( BddNot ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd Not Node | +| | +\------------------------------------------------------------*/ + +bddnode *applybddnodenot( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + setbddlocalsystem( BddSystem ); + + BddNode = loc_applybddnot( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Local Apply Terminal Node | +| | +\------------------------------------------------------------*/ + +bddnode *loc_applybddterm( Oper, Index, BddNode ) + + long Oper; + bddindex Index; + bddnode *BddNode; +{ + if ( Index == BDD_INDEX_ONE ) + { + if ( Oper == ABL_OR ) + { + return( BddLocalSystem->ONE ); + } + + if ( ( Oper == ABL_NAND ) || + ( Oper == ABL_XOR ) ) + { + return( loc_applybddnot( BddNode ) ); + } + + if ( ( Oper == ABL_AND ) || + ( Oper == ABL_NXOR ) ) + { + return( incbddrefext( BddNode ) ); + } + + return( BddLocalSystem->ZERO ); + } + + if ( Oper == ABL_AND ) + { + return( BddLocalSystem->ZERO ); + } + + if ( ( Oper == ABL_NOR ) || + ( Oper == ABL_NXOR ) ) + { + return( loc_applybddnot( BddNode ) ); + } + + if ( ( Oper == ABL_OR ) || + ( Oper == ABL_XOR ) ) + { + return( incbddrefext( BddNode ) ); + } + + return( BddLocalSystem->ONE ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd Terminal Node | +| | +\------------------------------------------------------------*/ + +bddnode *applybddnodeterm( BddSystem, Oper, Index, BddNode ) + + bddsystem *BddSystem; + long Oper; + bddindex Index; + bddnode *BddNode; +{ + checkbddoper( BddSystem, Oper, 1 ); + + BddNode = loc_applybddterm( Oper, Index, BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Local Apply Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *loc_applybdd( Oper, BddNode1, BddNode2 ) + + long Oper; + bddnode *BddNode1; + bddnode *BddNode2; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddnode *BddHigh; + bddnode *BddLow; + bddindex Index1; + bddindex Index2; + + Index1 = BddNode1->INDEX; + Index2 = BddNode2->INDEX; + + if ( ( Index1 < BDD_INDEX_MIN ) || + ( Index2 < BDD_INDEX_MIN ) ) + { + if ( ( Index1 < BDD_INDEX_MIN ) && + ( Index2 < BDD_INDEX_MIN ) ) + { + if ( Index1 != Index2 ) + { + if ( ( Oper == ABL_NAND ) || + ( Oper == ABL_OR ) || + ( Oper == ABL_XOR ) ) + { + return( BddLocalSystem->ONE ); + } + + return( BddLocalSystem->ZERO ); + } + + if ( Index1 == BDD_INDEX_ZERO ) + { + if ( ( Oper == ABL_NAND ) || + ( Oper == ABL_NOR ) || + ( Oper == ABL_NXOR ) ) + { + return( BddLocalSystem->ONE ); + } + + return( BddLocalSystem->ZERO ); + } + + if ( ( Oper == ABL_OR ) || + ( Oper == ABL_AND ) || + ( Oper == ABL_NXOR ) ) + { + return( BddLocalSystem->ONE ); + } + + return( BddLocalSystem->ZERO ); + } + + if ( Index1 < BDD_INDEX_MIN ) + { + return( loc_applybddterm( Oper, Index1, BddNode2 ) ); + } + + return( loc_applybddterm( Oper, Index2, BddNode1 ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + Oper, BddNode1, BddNode2 ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( Index1 == Index2 ) + { + if ( BddNode1 == BddNode2 ) + { + if ( ( Oper == ABL_OR ) || + ( Oper == ABL_AND ) ) + { + return( incbddrefext( BddNode1 ) ); + } + + if ( ( Oper == ABL_NOR ) || + ( Oper == ABL_NAND ) ) + { + return( loc_applybddnot( BddNode1 ) ); + } + + if ( Oper == ABL_XOR ) + { + return( BddLocalSystem->ZERO ); + } + + return( BddLocalSystem->ONE ); + } + + BddHigh = loc_applybdd( Oper, BddNode1->HIGH, BddNode2->HIGH ); + BddLow = loc_applybdd( Oper, BddNode1->LOW , BddNode2->LOW ); + } + else + if ( BddLocalSystem->INDEX_TO_VAR[ Index1 ] > + BddLocalSystem->INDEX_TO_VAR[ Index2 ] ) + { + Index1 = Index2; + BddHigh = loc_applybdd( Oper, BddNode1, BddNode2->HIGH ); + BddLow = loc_applybdd( Oper, BddNode1, BddNode2->LOW ); + } + else + { + BddHigh = loc_applybdd( Oper, BddNode1->HIGH, BddNode2 ); + BddLow = loc_applybdd( Oper, BddNode1->LOW, BddNode2 ); + } + + BddNode = addbddnode( (bddsystem *)0, Index1, + decbddrefext( BddHigh ), + decbddrefext( BddLow ) ); + + addbddhoper( BddLocalSystem->HASH_OPER, + Oper, BddNode1, BddNode2, BddNode ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *applybddnode( BddSystem, Oper, BddNode1, BddNode2 ) + + bddsystem *BddSystem; + long Oper; + bddnode *BddNode1; + bddnode *BddNode2; +{ + setbddlocalsystem( BddSystem ); + + if ( isablunaryoper( Oper ) ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + BddNode1 = loc_applybdd( Oper, BddNode1, BddNode2 ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode1 ); +} + +/*------------------------------------------------------------\ +| | +| Local Apply Bdd Ite Node | +| | +\------------------------------------------------------------*/ + +bddnode *loc_applybddite( BddIf, BddThen, BddElse ) + + bddnode *BddIf; + bddnode *BddThen; + bddnode *BddElse; +{ + BddThen = loc_applybdd( ABL_AND, BddIf, BddThen ); + BddIf = loc_applybddnot( BddIf ); + BddElse = loc_applybdd( ABL_AND, + decbddrefext( BddIf ), BddElse ); + BddIf = loc_applybdd( ABL_OR , + decbddrefext( BddThen ), + decbddrefext( BddElse ) ); + return( BddIf ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd Ite Node | +| | +\------------------------------------------------------------*/ + +bddnode *applybddnodeite( BddSystem, BddIf, BddThen, BddElse ) + + bddsystem *BddSystem; + bddnode *BddIf; + bddnode *BddThen; + bddnode *BddElse; +{ + setbddlocalsystem( BddSystem ); + + BddThen = loc_applybdd( ABL_AND, BddIf, BddThen ); + checkbddmaxnode( (bddsystem *)0, 1 ); + BddIf = loc_applybddnot( BddIf ); + checkbddmaxnode( (bddsystem *)0, 1 ); + BddElse = loc_applybdd( ABL_AND, + decbddrefext( BddIf ), + decbddrefext( BddElse ) ); + checkbddmaxnode( (bddsystem *)0, 1 ); + BddIf = loc_applybdd( ABL_OR , + decbddrefext( BddThen ), + decbddrefext( BddElse ) ); + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddIf ); +} + +/*------------------------------------------------------------\ +| | +| Apply List Node | +| | +\------------------------------------------------------------*/ + +bddnode *loc_applybddlist( Oper, BddList ) + + long Oper; + chain_list *BddList; +{ + bddnode *BddNode1; + bddnode *BddNode2; + + BddNode1 = (bddnode *)( BddList->DATA ); + BddNode2 = (bddnode *)( BddList->NEXT->DATA ); + + if ( BddList->NEXT->NEXT != (chain_list *)0 ) + { + BddNode2 = decbddrefext( loc_applybddlist( Oper, BddNode2 ) ); + } + + return( loc_applybdd( Oper, BddNode1, BddNode2 ) ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd List Node | +| | +\------------------------------------------------------------*/ + +bddnode *applybddnodelist( BddSystem, Oper, BddList ) + + bddsystem *BddSystem; + long Oper; + chain_list *BddList; +{ + bddnode *BddNode; + + setbddlocalsystem( BddSystem ); + + if ( BddList == (chain_list *)0 ) + { + bdderror( BDD_BAD_LIST_ERROR, 0 ); + } + + if ( Oper == ABL_NOT ) + { + if ( BddList->NEXT != (chain_list *)0 ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + BddNode = (bddnode *)( BddList->DATA ); + BddNode = loc_applybddnot( BddNode ); + } + else + { + if ( ( isablunaryoper( Oper ) ) || + ( BddList->NEXT == (chain_list *)0 ) ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + if ( ( getabloperpolar( Oper ) == ABL_POLAR_POSITIVE ) || + ( BddList->NEXT->NEXT == (chain_list *)0 ) ) + { + BddNode = loc_applybddlist( Oper, BddList ); + } + else + { + Oper = getablopernot( Oper ); + BddNode = loc_applybddlist( Oper, BddList ); + BddNode = loc_applybddnot( decbddrefext( BddNode ) ); + } + } + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} diff --git a/alliance/src/bdd/src/bddapply.h b/alliance/src/bdd/src/bddapply.h new file mode 100644 index 00000000..f02ef14e --- /dev/null +++ b/alliance/src/bdd/src/bddapply.h @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddapply.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_APPLY_H +# define BDD_APPLY_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern bddnode * loc_applybdd __P((long Oper, bddnode *BddNode1, bddnode *BddNode2)); + extern bddnode * loc_applybddterm __P((long Oper, bddindex Index, bddnode *BddNode)); + extern bddnode * loc_applybddnot __P((bddnode *BddNode)); + extern bddnode * loc_applybddite __P((bddnode *BddIf, bddnode *BddThen, bddnode *BddElse)); + +# endif diff --git a/alliance/src/bdd/src/bddassoc.c b/alliance/src/bdd/src/bddassoc.c new file mode 100644 index 00000000..551c283b --- /dev/null +++ b/alliance/src/bdd/src/bddassoc.c @@ -0,0 +1,442 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddassoc.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddassoc.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + bddassoc *BddLocalAssoc = (bddassoc *)0; + bddassocnode *BddLocalAssocNode = (bddassocnode *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Bdd Association | +| | +\------------------------------------------------------------*/ + +bddassoc *addbddassoc( BddSystem ) + + bddsystem *BddSystem; +{ + bddassoc **PrevAssoc; + bddassoc *ScanAssoc; + bddassoc *BddAssoc; + bddshort AssocIdent; + + setbddlocalsystem( BddSystem ); + + ScanAssoc = BddLocalSystem->ASSOC; + PrevAssoc = &BddLocalSystem->ASSOC; + AssocIdent = 0; + + while ( ( ScanAssoc != (bddassoc *)0 ) && + ( ScanAssoc->IDENT > AssocIdent ) ) + { + if ( AssocIdent == BDD_MAX_SHORT ) + { + bdderror( BDD_NO_MORE_ASSOC_ERROR, 0 ); + } + + AssocIdent = AssocIdent + 1; + PrevAssoc = &ScanAssoc->NEXT; + ScanAssoc = ScanAssoc->NEXT; + } + + BddAssoc = allocbddassoc(); + + BddAssoc->ASSOC_NODE = allocbddassocnode( BddLocalSystem->MAX_VAR ); + BddAssoc->FIRST = BDD_MAX_VAR; + BddAssoc->LAST = BDD_MAX_VAR; + BddAssoc->IDENT = AssocIdent; + + BddAssoc->NEXT = ScanAssoc; + *PrevAssoc = BddAssoc; + + return( BddAssoc ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Node In Association | +| | +\------------------------------------------------------------*/ + +bddassoc *addbddnodeassoc( BddSystem, BddAssoc, Variable, BddNode ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; + bddvar Variable; + bddnode *BddNode; +{ + bddassocnode *BddAssocNode; + + checkbddvar( BddSystem, Variable, 1 ); + + BddAssocNode = BddAssoc->ASSOC_NODE; + + if ( BddAssocNode[ Variable ] != (bddnode *)0 ) + { + decbddrefext( BddAssocNode[ Variable ] ); + } + else + { + if ( ( BddAssoc->FIRST == BDD_MAX_VAR ) || + ( Variable < BddAssoc->FIRST ) ) BddAssoc->FIRST = Variable; + + if ( ( BddAssoc->LAST == BDD_MAX_VAR ) || + ( Variable > BddAssoc->LAST ) ) BddAssoc->LAST = Variable; + } + + BddAssocNode[ Variable ] = incbddrefext( BddNode ); + + if ( BddAssoc->CACHE ) + { + BddLocalSystem->ASSOC_RESET = 1; + } + + return( BddAssoc ); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Del Bdd Association | +| | +\------------------------------------------------------------*/ + +int delbddassoc( BddSystem, BddAssoc ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; +{ + bddassoc **PrevAssoc; + bddassoc *ScanAssoc; + bddassocnode *BddAssocNode; + bddvar Variable; + + setbddlocalsystem( BddSystem ); + + PrevAssoc = &BddLocalSystem->ASSOC; + ScanAssoc = BddLocalSystem->ASSOC; + + while ( ScanAssoc != (bddassoc *)0 ) + { + if ( ScanAssoc == BddAssoc ) + { + *PrevAssoc = ScanAssoc->NEXT; + + BddAssocNode = BddAssoc->ASSOC_NODE; + + if ( BddAssoc->FIRST != BDD_MAX_VAR ) + { + for ( Variable = BddAssoc->FIRST; + Variable <= BddAssoc->LAST; + Variable++ ) + { + if ( BddAssocNode[ Variable ] != (bddnode *)0 ) + { + decbddrefext( BddAssocNode[ Variable ] ); + } + } + } + + if ( BddAssoc->CACHE ) + { + BddLocalSystem->ASSOC_RESET = 1; + } + + freebddassocnode( BddAssocNode ); + freebddassoc( BddAssoc ); + + return( 1 ); + } + + PrevAssoc = &ScanAssoc->NEXT; + ScanAssoc = ScanAssoc->NEXT; + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Reset Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Reset Bdd Association | +| | +\------------------------------------------------------------*/ + +void resetbddassoc( BddSystem, BddAssoc ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; +{ + bddassocnode *BddAssocNode; + bddvar Variable; + + setbddlocalsystem( BddSystem ); + + BddAssocNode = BddAssoc->ASSOC_NODE; + + if ( BddAssoc->FIRST != BDD_MAX_VAR ) + { + for ( Variable = BddAssoc->FIRST; + Variable <= BddAssoc->LAST; + Variable++ ) + { + if ( BddAssocNode[ Variable ] != (bddnode *)0 ) + { + decbddrefext( BddAssocNode[ Variable ] ); + BddAssocNode[ Variable ] = (bddnode *)0; + } + } + + BddAssoc->FIRST = BDD_MAX_VAR; + BddAssoc->LAST = BDD_MAX_VAR; + + if ( BddAssoc->CACHE ) + { + BddLocalSystem->ASSOC_RESET = 1; + } + } +} + +/*------------------------------------------------------------\ +| | +| Del Bdd Node In Association | +| | +\------------------------------------------------------------*/ + +int delbddnodeassoc( BddSystem, BddAssoc, Variable ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; + bddvar Variable; +{ + bddassocnode *BddAssocNode; + + checkbddvar( BddSystem, Variable, 1 ); + + BddAssocNode = BddAssoc->ASSOC_NODE; + + if ( BddAssocNode[ Variable ] != (bddnode *)0 ) + { + decbddrefext( BddAssocNode[ Variable ] ); + BddAssocNode[ Variable ] = (bddnode *)0; + + if ( BddAssoc->CACHE ) + { + BddLocalSystem->ASSOC_RESET = 1; + } + + if ( ( Variable == BddAssoc->FIRST ) && + ( Variable == BddAssoc->LAST ) ) + { + BddAssoc->FIRST = BDD_MAX_VAR; + BddAssoc->LAST = BDD_MAX_VAR; + + return( 1 ); + } + + if ( Variable == BddAssoc->FIRST ) + { + do + { + Variable = Variable + 1; + } + while ( BddAssocNode[ Variable ] == (bddnode *)0 ); + + BddAssoc->FIRST = Variable; + + return( 1 ); + } + + if ( Variable == BddAssoc->LAST ) + { + do + { + Variable = Variable - 1; + } + while ( BddAssocNode[ Variable ] == (bddnode *)0 ); + + BddAssoc->LAST = Variable; + + return( 1 ); + } + + return( 1 ); + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Destroy Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Destroy Bdd Association | +| | +\------------------------------------------------------------*/ + +void destroybddassoc( BddSystem ) + + bddsystem *BddSystem; +{ + bddassoc *BddAssoc; + bddassoc *DelAssoc; + + setbddlocalsystem( BddSystem ); + + BddAssoc = BddLocalSystem->ASSOC; + BddLocalSystem->ASSOC = (bddassoc *)0; + + while ( BddAssoc != (bddassoc *)0 ) + { + DelAssoc = BddAssoc; + BddAssoc = BddAssoc->NEXT; + + freebddassocnode( DelAssoc->ASSOC_NODE ); + freebddassoc( DelAssoc ); + } + + BddLocalSystem->ASSOC_RESET = 0; +} + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| View Bdd Association | +| | +\------------------------------------------------------------*/ + +void viewbddassoc( BddSystem, BddAssoc, FuncView ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; + void (*FuncView)(); +{ + bddassocnode *BddAssocNode; + bddvar Variable; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + fprintf( stdout, "--> BddAssoc\n" ); + fprintf( stdout, " FIRST : %ld\n", (long)BddAssoc->FIRST ); + fprintf( stdout, " LAST : %ld\n", (long)BddAssoc->LAST ); + fprintf( stdout, " IDENT : %ld\n", (long)BddAssoc->IDENT ); + fprintf( stdout, " CACHE : %ld\n", (long)BddAssoc->CACHE ); + + if ( BddAssoc->FIRST != BDD_MAX_VAR ) + { + BddAssocNode = BddAssoc->ASSOC_NODE; + + for ( Variable = BddAssoc->FIRST; + Variable <= BddAssoc->LAST; + Variable = Variable + 1 ) + { + if ( BddAssocNode[ Variable ] != (bddnode *)0 ) + { + fprintf( stdout, " ASSOC_NODE[ %ld ] : ", (long)Variable ); + + if ( FuncView ) + { + (*FuncView)( Variable, BddAssocNode[ Variable ] ); + } + else + { + fprintf( stdout, "\n" ); + } + } + } + } + + fprintf( stdout, "<-- BddAssoc\n" ); +} diff --git a/alliance/src/bdd/src/bddassoc.h b/alliance/src/bdd/src/bddassoc.h new file mode 100644 index 00000000..fd00b7cc --- /dev/null +++ b/alliance/src/bdd/src/bddassoc.h @@ -0,0 +1,81 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddassoc.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_ASSOC_H +# define BDD_ASSOC_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + extern bddassoc *BddLocalAssoc; + extern bddassocnode *BddLocalAssocNode; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddblock.c b/alliance/src/bdd/src/bddblock.c new file mode 100644 index 00000000..64d2190a --- /dev/null +++ b/alliance/src/bdd/src/bddblock.c @@ -0,0 +1,246 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddblock.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include +# include + +# include "bddblock.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Add Block | +| | +\------------------------------------------------------------*/ + +bddblock *addbddblock( BddSystem ) + + bddsystem *BddSystem; +{ + bddblock *BddBlock; + + setbddlocalsystem( BddSystem ); + + BddBlock = allocbddblock(); + BddBlock->NEXT = BddLocalSystem->BLOCK; + BddLocalSystem->BLOCK = BddBlock; + + BddBlock->NODE = allocbddnodeblock( BDD_NODE_BLOCK_SIZE ); + BddBlock->NODE_FREE = BDD_NODE_BLOCK_SIZE; + + return( BddBlock ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Create Block | +| | +\------------------------------------------------------------*/ + +bddblock *createbddblock( BddSystem ) + + bddsystem *BddSystem; +{ + return( addbddblock( BddSystem ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Reset Block | +| | +\------------------------------------------------------------*/ + +void resetbddblock( BddSystem ) + + bddsystem *BddSystem; +{ + bddblock *BddBlock; + bddnode **PrevNode; + bddnode *ScanNode; + long Counter; + + setbddlocalsystem( BddSystem ); + + BddBlock = BddLocalSystem->BLOCK; + PrevNode = &BddLocalSystem->NODE_FREE; + + for ( BddBlock = BddLocalSystem->BLOCK; + BddBlock != (bddblock *)0; + BddBlock = BddBlock->NEXT ) + { + ScanNode = BddBlock->NODE; + + memset( (void *)ScanNode, 0, + (size_t)BDD_NODE_BLOCK_SIZE * sizeof( bddnode ) ); + + for ( Counter = 0; Counter < BDD_NODE_BLOCK_SIZE; Counter++ ) + { + *PrevNode = ScanNode; + PrevNode = &ScanNode->HIGH; + ScanNode = ScanNode + 1; + } + + BddBlock->NODE_FREE = 0; + BddLocalSystem->NUMBER_FREE += BDD_NODE_BLOCK_SIZE; + } + + *PrevNode = (bddnode *)0; + + BddLocalSystem->NUMBER_NODE = 0; +} + +/*------------------------------------------------------------\ +| | +| Bdd Destroy Block | +| | +\------------------------------------------------------------*/ + +void destroybddblock( BddSystem ) + + bddsystem *BddSystem; +{ + bddblock *BddBlock; + bddblock *DelBddBlock; + + setbddlocalsystem( BddSystem ); + + BddBlock = BddLocalSystem->BLOCK; + + while ( BddBlock != (bddblock *)0 ) + { + DelBddBlock = BddBlock; + BddBlock = BddBlock->NEXT; + + freebddnodeblock( DelBddBlock->NODE ); + freebddblock( DelBddBlock ); + } + + BddLocalSystem->BLOCK = (bddblock *)0; + BddLocalSystem->NODE_FREE = (bddnode *)0; + BddLocalSystem->NUMBER_FREE = 0; + BddLocalSystem->NUMBER_NODE = 0; +} + +/*------------------------------------------------------------\ +| | +| Bdd View Block | +| | +\------------------------------------------------------------*/ + +void viewbddblock( BddSystem, FuncView ) + + bddsystem *BddSystem; + void (*FuncView)(); +{ + bddblock *BddBlock; + bddnode *ScanNode; + long Counter; + long NumberBlock; + long NumberNode; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + fprintf( stdout, "--> BlockNodeTable\n" ); + + fprintf( stdout, " NUMBER_FREE : %ld\n", BddSystem->NUMBER_FREE ); + + NumberBlock = 0; + + for ( BddBlock = BddLocalSystem->BLOCK; + BddBlock != (bddblock *)0; + BddBlock = BddBlock->NEXT ) + { + fprintf( stdout, "--> BLOCK_NODE[ %ld ]\n", NumberBlock ); + + ScanNode = BddBlock->NODE; + NumberNode = 0; + + for ( Counter = 0; Counter < BDD_NODE_BLOCK_SIZE; Counter++ ) + { + if ( ScanNode[ Counter ].LOW != (bddnode *)0 ) + { + NumberNode = NumberNode + 1; + + if ( FuncView ) (*FuncView)( ScanNode[ Counter ] ); + } + } + + fprintf( stdout, " NUMBER_NODE : %ld\n", NumberNode ); + fprintf( stdout, "<-- BLOCK_NODE[ %ld ]\n", NumberBlock ); + + NumberBlock = NumberBlock + 1; + } + + fprintf( stdout, " NUMBER_BLOCK : %ld\n", NumberBlock ); + fprintf( stdout, "<-- BlockNodeTable\n" ); +} diff --git a/alliance/src/bdd/src/bddblock.h b/alliance/src/bdd/src/bddblock.h new file mode 100644 index 00000000..11fc42cd --- /dev/null +++ b/alliance/src/bdd/src/bddblock.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddblock.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_BLOCK_H +# define BDD_BLOCK_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +# define BDD_NODE_BLOCK_SIZE 1024 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddcheck.c b/alliance/src/bdd/src/bddcheck.c new file mode 100644 index 00000000..81083586 --- /dev/null +++ b/alliance/src/bdd/src/bddcheck.c @@ -0,0 +1,262 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcheck.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddcheck.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Check Bdd Variable | +| | +\------------------------------------------------------------*/ + +int checkbddvar( BddSystem, Variable, Severity ) + + bddsystem *BddSystem; + bddvar Variable; + int Severity; +{ + setbddlocalsystem( BddSystem ); + + if ( Variable >= BddLocalSystem->NUMBER_VAR ) + { + if ( Severity ) + { + bdderror( BDD_BAD_VAR_ERROR, Variable ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Check Bdd Index | +| | +\------------------------------------------------------------*/ + +int checkbddindex( BddSystem, Index, Severity ) + + bddsystem *BddSystem; + bddindex Index; + int Severity; +{ + setbddlocalsystem( BddSystem ); + + if ( ( Index < BDD_INDEX_MIN ) || + ( Index >= BddLocalSystem->NUMBER_INDEX ) ) + { + if ( Severity ) + { + bdderror( BDD_BAD_INDEX_ERROR, Index ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Check Bdd Operator | +| | +\------------------------------------------------------------*/ + +int checkbddoper( BddSystem, Oper, Severity ) + + bddsystem *BddSystem; + long Oper; + int Severity; +{ + setbddlocalsystem( BddSystem ); + + if ( ( Oper < 0 ) || + ( Oper >= ABL_NXOR ) ) + { + if ( Severity ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Check Bdd Assoc | +| | +\------------------------------------------------------------*/ + +int checkbddassoc( BddSystem, BddAssoc, Severity ) + + bddsystem *BddSystem; + bddassoc *BddAssoc; + int Severity; +{ + setbddlocalsystem( BddSystem ); + + if ( BddLocalSystem->ASSOC_RESET ) + { + resetbddhopertable( BddLocalSystem->HASH_OPER ); + } + + if ( ( BddAssoc->FIRST == BDD_MAX_VAR ) && + ( BddAssoc->LAST == BDD_MAX_VAR ) ) + { + return( 2 ); + } + + if ( BddAssoc->FIRST >= BDD_MAX_VAR ) + { + if ( Severity ) + { + bdderror( BDD_BAD_ASSOC_ERROR, BddAssoc->FIRST ); + } + + return( 0 ); + } + + if ( BddAssoc->LAST >= BDD_MAX_VAR ) + { + if ( Severity ) + { + bdderror( BDD_BAD_ASSOC_ERROR, BddAssoc->LAST ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Check Bdd Max Node | +| | +\------------------------------------------------------------*/ + +int checkbddmaxnode( BddSystem, Severity ) + + bddsystem *BddSystem; + int Severity; +{ + long ReorderLimit; + long FirstNumberNode; + + setbddlocalsystem( BddSystem ); + + if ( IsBddSystemReorderOn( BddLocalSystem ) ) + { + if ( ( BddLocalSystem->NUMBER_NODE > BddLocalSystem->MAX_NODE ) || + ( BddLocalSystem->NUMBER_NODE > BddLocalSystem->REORDER_LIMIT ) ) + { + FirstNumberNode = BddLocalSystem->NUMBER_NODE; + + SetBddSystemReorder( BddLocalSystem ); + + BddLocalSystem->REORDER_FUNC( (bddsystem *)0 ); + + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_DYNAMIC_REORDER_WARNING, + FirstNumberNode, BddLocalSystem->NUMBER_NODE ); + } + + ReorderLimit = ( BddLocalSystem->NUMBER_NODE * + BddLocalSystem->REORDER_RATIO ) / 100; + + if ( ReorderLimit < BddLocalSystem->REORDER_LOW ) + { + BddLocalSystem->REORDER_LIMIT = BddLocalSystem->REORDER_LOW; + } + else + { + BddLocalSystem->REORDER_LIMIT = ReorderLimit; + } + } + } + + if ( BddLocalSystem->NUMBER_NODE > BddLocalSystem->MAX_NODE ) + { + if ( Severity ) + { + bdderror( BDD_MAX_NODE_ERROR, BddLocalSystem->NUMBER_NODE ); + } + + return( 0 ); + } + + return( 1 ); +} diff --git a/alliance/src/bdd/src/bddcheck.h b/alliance/src/bdd/src/bddcheck.h new file mode 100644 index 00000000..6cc71901 --- /dev/null +++ b/alliance/src/bdd/src/bddcheck.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcheck.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_CHECK_H +# define BDD_CHECK_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddcircuit.c b/alliance/src/bdd/src/bddcircuit.c new file mode 100644 index 00000000..46ee96f7 --- /dev/null +++ b/alliance/src/bdd/src/bddcircuit.c @@ -0,0 +1,983 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcircuit.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include "bddcircuit.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + bddcircuit *BddLocalCircuit = (bddcircuit *)0; + +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static char BddStableName[ 512 ]; + static authtable *BddHashStable = (authtable *)0; + static authtable *BddHashInvStable = (authtable *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Get Bdd Stable Name | +| | +\------------------------------------------------------------*/ + +char *loc_getbddstablename( Name ) + + char *Name; +{ + authelem *Element; + char *StableName; + + if ( BddHashStable == (authtable *)0 ) + { + BddHashStable = createauthtable( 100 ); + BddHashInvStable = createauthtable( 100 ); + } + + Element = searchauthelem( BddHashStable, Name ); + + if ( Element == (authelem *)0 ) + { + sprintf( BddStableName, "%s'stable", Name ); + StableName = namealloc( BddStableName ); + + Element = addauthelem( BddHashInvStable, StableName, (long)Name ); + Element = addauthelem( BddHashStable , Name, (long)StableName ); + } + + return( (char *)( Element->VALUE ) ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Stable Name | +| | +\------------------------------------------------------------*/ + +char *getbddstablename( Name ) + + char *Name; +{ + return( loc_getbddstablename( namealloc( Name ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Input Name | +| | +\------------------------------------------------------------*/ + +char *getbddcircuitinname( BddCircuit, BddIndex ) + + bddcircuit *BddCircuit; + bddindex BddIndex; +{ + char *Name; + int Index; + + setbddlocalcircuit( BddCircuit ); + + checkbddindex( BddLocalSystem, BddIndex, 1 ); + + Index = BddLocalCircuit->INDEX_IN[ BddIndex - BDD_INDEX_MIN ]; + Name = BddLocalCircuit->NAME_IN[ Index ]; + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| Local Bdd Is Stable Name | +| | +\------------------------------------------------------------*/ + +char *loc_isbddstablename( StableName ) + + char *StableName; +{ + authelem *Element; + + if ( BddHashStable == (authtable *)0 ) + { + return( (char *)0 ); + } + + Element = searchauthelem( BddHashInvStable, StableName ); + + if ( Element == (authelem *)0 ) + { + return( (char *)0 ); + } + + return( (char *)( Element->VALUE ) ); +} + +/*------------------------------------------------------------\ +| | +| Is Bdd Stable Name | +| | +\------------------------------------------------------------*/ + +char *isbddstablename( StableName ) + + char *StableName; +{ + return( loc_isbddstablename( namealloc( StableName ) ) ); +} + + +/*------------------------------------------------------------\ +| | +| Bdd Create Circuit | +| | +\------------------------------------------------------------*/ + +bddcircuit *createbddcircuit( Name, NumberIn, NumberOut, BddSystem ) + + char *Name; + long NumberIn; + long NumberOut; + bddsystem *BddSystem; +{ + bddcircuit *BddCircuit; + + setbddlocalsystem( BddSystem ); + + BddCircuit = allocbddcircuit(); + + BddCircuit->NAME = namealloc( Name ); + BddCircuit->HASH_IN = createauthtable( NumberIn << 1 ); + BddCircuit->HASH_OUT = createauthtable( NumberOut << 1 ); + BddCircuit->NAME_IN = allocbddnamein( NumberIn ); + BddCircuit->NAME_IN_SIZE = NumberIn; + BddCircuit->INDEX_IN = allocbddindexin( NumberIn ); + BddCircuit->INDEX_IN_SIZE = NumberIn; + BddCircuit->BDD_SYSTEM = BddLocalSystem; + + BddLocalCircuit = BddCircuit; + + return( BddCircuit ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Reset Circuit | +| | +\------------------------------------------------------------*/ + +void resetbddcircuit( BddCircuit ) + + bddcircuit *BddCircuit; +{ + setbddlocalcircuit( BddCircuit ); + + resetauthtable( BddLocalCircuit->HASH_IN ); + resetauthtable( BddLocalCircuit->HASH_OUT ); + + memset( (void *)BddLocalCircuit->NAME_IN, 0, + (size_t)BddLocalCircuit->NAME_IN_SIZE * sizeof( bddnamein ) ); + + memset( (void *)BddLocalCircuit->INDEX_IN, 0, + (size_t)BddLocalCircuit->INDEX_IN_SIZE * sizeof( bddindex ) ); + + BddLocalCircuit->NUMBER_NAME_IN = 0; + BddLocalCircuit->NUMBER_NAME_OUT = 0; +} + +/*------------------------------------------------------------\ +| | +| Bdd Destroy Circuit | +| | +\------------------------------------------------------------*/ + +void destroybddcircuit( BddCircuit ) + + bddcircuit *BddCircuit; +{ + setbddlocalcircuit( BddCircuit ); + + destroyauthtable( BddLocalCircuit->HASH_IN ); + destroyauthtable( BddLocalCircuit->HASH_OUT ); + + freebddnamein( BddLocalCircuit->NAME_IN ); + freebddindexin( BddLocalCircuit->INDEX_IN ); + + freebddcircuit( BddLocalCircuit ); + + BddLocalCircuit = (bddcircuit *)0; +} + +/*------------------------------------------------------------\ +| | +| Bdd Input Circuit | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Search Input Circuit | +| | +\------------------------------------------------------------*/ + +bddnode *searchbddcircuitin( BddCircuit, InputName ) + + bddcircuit *BddCircuit; + char *InputName; +{ + authelem *Element; + + setbddlocalcircuit( BddCircuit ); + + if ( InputName != (char *)0 ) + { + InputName = namealloc( InputName ); + Element = searchauthelem( BddLocalCircuit->HASH_IN, InputName ); + + if ( Element != (authelem *)0 ) + { + return( (bddnode *)Element->VALUE ); + } + } + + return( (bddnode *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Add Circuit Input | +| | +\------------------------------------------------------------*/ + +bddnode *addbddcircuitin( BddCircuit, InputName, Index, Mode ) + + bddcircuit *BddCircuit; + char *InputName; + bddindex Index; + long Mode; +{ + char **NameIn; + bddindex *IndexIn; + authelem *Element; + bddnode *BddNode; + long NameInSize; + long NumberNameIn; + long IndexInSize; + + setbddlocalcircuit( BddCircuit ); + setbddlocalsystem( BddLocalCircuit->BDD_SYSTEM ); + + BddNode = (bddnode *)0; + InputName = namealloc( InputName ); + Element = searchauthelem( BddLocalCircuit->HASH_IN, InputName ); + + if ( Element != (authelem *)0 ) + { + return( (bddnode *)Element->VALUE ); + } + + if ( Mode & BDD_IN_MODE_IMPOSE ) + { + if ( checkbddindex( (bddsystem *)0, Index, 0 ) ) + { + BddNode = getbddvarnodebyindex( (bddsystem *)0, Index ); + } + else + { + Mode &= ~BDD_IN_MODE_IMPOSE; + } + } + + if ( ! ( Mode & BDD_IN_MODE_IMPOSE ) ) + { + switch ( Mode ) + { + case BDD_IN_MODE_FIRST : BddNode = addbddvarfirst( (bddsystem *)0 ); + break; + + case BDD_IN_MODE_LAST : BddNode = addbddvarlast( (bddsystem *)0 ); + break; + + case BDD_IN_MODE_BEFORE : BddNode = addbddvarbefore( (bddsystem *)0, Index ); + break; + + case BDD_IN_MODE_AFTER : BddNode = addbddvarafter( (bddsystem *)0, Index ); + break; + + default : bdderror( BDD_UNKNOWN_IN_MODE_ERROR, Mode ); + } + } + + addauthelem( BddLocalCircuit->HASH_IN, InputName, (long)BddNode ); + + NumberNameIn = BddLocalCircuit->NUMBER_NAME_IN; + NameIn = BddLocalCircuit->NAME_IN; + NameInSize = BddLocalCircuit->NAME_IN_SIZE; + + if ( NumberNameIn >= NameInSize ) + { + NameIn = resizebddnamein( NameIn, NameInSize, ( NameInSize << 1 ) ); + + BddLocalCircuit->NAME_IN = NameIn; + BddLocalCircuit->NAME_IN_SIZE = NameInSize << 1; + } + + NameIn[ NumberNameIn ] = InputName; + BddLocalCircuit->NUMBER_NAME_IN++; + + IndexIn = BddLocalCircuit->INDEX_IN; + IndexInSize = BddLocalCircuit->INDEX_IN_SIZE; + Index = BddNode->INDEX - BDD_INDEX_MIN; + + if ( Index >= IndexInSize ) + { + IndexIn = resizebddindexin( IndexIn, IndexInSize, (long)( Index ) << 1 ); + + BddLocalCircuit->INDEX_IN = IndexIn; + BddLocalCircuit->INDEX_IN_SIZE = (long)( Index ) << 1; + } + + IndexIn[ Index ] = (bddindex)NumberNameIn; + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Rename Input Circuit | +| | +\------------------------------------------------------------*/ + +bddnode *renamebddcircuitin( BddCircuit, InputName, NewName ) + + bddcircuit *BddCircuit; + char *InputName; + char *NewName; +{ + authelem *Element1; + authelem *Element2; + bddnode *BddNode; + char **NameIn; + bddindex *IndexIn; + bddindex Index; + + setbddlocalcircuit( BddCircuit ); + + InputName = namealloc( InputName ); + NewName = namealloc( NewName ); + + Element1 = searchauthelem( BddLocalCircuit->HASH_IN, InputName ); + Element2 = searchauthelem( BddLocalCircuit->HASH_IN, NewName ); + + if ( ( Element1 != (authelem *)0 ) && + ( Element2 == (authelem *)0 ) ) + { + BddNode = (bddnode *)Element1->VALUE; + + delauthelem( BddLocalCircuit->HASH_IN, InputName ); + addauthelem( BddLocalCircuit->HASH_IN, NewName, (long)BddNode ); + + NameIn = BddLocalCircuit->NAME_IN; + IndexIn = BddLocalCircuit->INDEX_IN; + Index = BddNode->INDEX - BDD_INDEX_MIN; + + NameIn[ IndexIn[ Index ] ] = NewName; + + return( BddNode ); + } + + return( (bddnode *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Add Circuit Auxiliary Signal | +| | +\------------------------------------------------------------*/ + +bddnode *addbddcircuitaux( BddCircuit, InputName, BddAux, UserFunc, Mode ) + + bddcircuit *BddCircuit; + char *InputName; + bddnode *BddAux; + int (*UserFunc)(); + long Mode; +{ + char **NameIn; + bddindex *IndexIn; + bddindex Index; + authelem *Element; + bddnode *BddNode; + long NameInSize; + long NumberNameIn; + long IndexInSize; + + setbddlocalcircuit( BddCircuit ); + + BddNode = (bddnode *)0; + InputName = namealloc( InputName ); + Element = searchauthelem( BddLocalCircuit->HASH_IN, InputName ); + + if ( Element != (authelem *)0 ) + { + bdderror( BDD_BAD_IN_ERROR, InputName ); + } + + switch ( Mode ) + { + case BDD_AUX_MODE_SINGLE : + + BddNode = addbddvarauxsingle( (bddsystem *)0, BddAux ); + + break; + + case BDD_AUX_MODE_GLOBAL : + + BddNode = addbddvarauxglobal( (bddsystem *)0, BddAux, UserFunc ); + + break; + + default : bdderror( BDD_UNKNOWN_AUX_MODE_ERROR, Mode ); + } + + addbddcircuitout( (bddcircuit *)0, InputName, BddNode ); + addauthelem( BddLocalCircuit->HASH_IN, InputName, (long)BddAux ); + + NumberNameIn = BddLocalCircuit->NUMBER_NAME_IN; + NameIn = BddLocalCircuit->NAME_IN; + NameInSize = BddLocalCircuit->NAME_IN_SIZE; + + if ( NumberNameIn >= NameInSize ) + { + NameIn = resizebddnamein( NameIn, NameInSize, ( NameInSize << 1 ) ); + + BddLocalCircuit->NAME_IN = NameIn; + BddLocalCircuit->NAME_IN_SIZE = NameInSize << 1; + } + + NameIn[ NumberNameIn ] = InputName; + BddLocalCircuit->NUMBER_NAME_IN++; + + IndexIn = BddLocalCircuit->INDEX_IN; + IndexInSize = BddLocalCircuit->INDEX_IN_SIZE; + Index = BddAux->INDEX - BDD_INDEX_MIN; + + if ( Index >= IndexInSize ) + { + IndexIn = resizebddindexin( IndexIn, IndexInSize, (long)( Index ) << 1 ); + + BddLocalCircuit->INDEX_IN = IndexIn; + BddLocalCircuit->INDEX_IN_SIZE = (long)( Index ) << 1; + } + + IndexIn[ Index ] = (bddindex)NumberNameIn; + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Output Circuit | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Search Output Circuit | +| | +\------------------------------------------------------------*/ + +bddnode *searchbddcircuitout( BddCircuit, OutputName ) + + bddcircuit *BddCircuit; + char *OutputName; +{ + authelem *Element; + + setbddlocalcircuit( BddCircuit ); + + OutputName = namealloc( OutputName ); + Element = searchauthelem( BddLocalCircuit->HASH_OUT, OutputName ); + + if ( Element != (authelem *)0 ) + { + return( (bddnode *)Element->VALUE ); + } + + return( (bddnode *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Add Output Circuit | +| | +\------------------------------------------------------------*/ + +bddnode *addbddcircuitout( BddCircuit, OutputName, BddNode ) + + bddcircuit *BddCircuit; + char *OutputName; + bddnode *BddNode; +{ + authelem *Element; + + setbddlocalcircuit( BddCircuit ); + + OutputName = namealloc( OutputName ); + Element = searchauthelem( BddLocalCircuit->HASH_OUT, OutputName ); + + if ( Element != (authelem *)0 ) + { + decbddrefext( (bddnode *)Element->VALUE ); + Element->VALUE = (long)( BddNode ); + } + else + { + BddLocalCircuit->NUMBER_NAME_OUT++; + Element = addauthelem( BddLocalCircuit->HASH_OUT, OutputName, (long)BddNode ); + } + + return( incbddrefext( BddNode ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Del Output Circuit | +| | +\------------------------------------------------------------*/ + +int delbddcircuitout( BddCircuit, OutputName ) + + bddcircuit *BddCircuit; + char *OutputName; +{ + authelem *Element; + + setbddlocalcircuit( BddCircuit ); + + OutputName = namealloc( OutputName ); + Element = searchauthelem( BddLocalCircuit->HASH_OUT, OutputName ); + + if ( Element != (authelem *)0 ) + { + decbddrefext( (bddnode *)Element->VALUE ); + + BddLocalCircuit->NUMBER_NAME_OUT--; + + return( delauthelem( BddLocalCircuit->HASH_OUT, OutputName ) ); + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Local Add Circuit Abl | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_addbddcircuitabl( Expr ) + + ablexpr *Expr; +{ + bddnode *BddNode; + bddnode *BddFirst; + char *AtomValue; + long Oper; + int Negative; + + if ( ABL_ATOM( Expr ) ) + { + AtomValue = ABL_ATOM_VALUE( Expr ); + + if ( AtomValue == ABL_ATOM_NAME_ONE ) + { + return( BddLocalSystem->ONE ); + } + + if ( AtomValue == ABL_ATOM_NAME_ZERO ) + { + return( BddLocalSystem->ZERO ); + } + + BddNode = searchbddcircuitin( (bddcircuit *)0, AtomValue ); + + if ( BddNode == (bddnode *)0 ) + { + BddNode = searchbddcircuitout( (bddcircuit *)0, AtomValue ); + + if ( BddNode == (bddnode *)0 ) + { + if ( AtomValue == ABL_ATOM_NAME_DC ) + { + return( BddLocalSystem->ZERO ); + } + else + { + BddNode = addbddcircuitin( (bddcircuit *)0, AtomValue, + (bddindex )0, BDD_IN_MODE_LAST ); + } + } + } + + return( incbddrefext( BddNode ) ); + } + + Oper = ABL_OPER( Expr ); + Expr = ABL_CDR( Expr ); + + if ( Oper == ABL_NOT ) + { + if ( ABL_CDR( Expr ) != (ablexpr *)0 ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + BddFirst = loc_addbddcircuitabl( ABL_CAR( Expr ) ); + BddNode = applybddnodenot( (bddsystem *)0, decbddrefext( BddFirst ) ); + + return( BddNode ); + } + + if ( Oper == ABL_STABLE ) + { + Expr = ABL_CAR( Expr ); + + if ( ! ABL_ATOM( Expr ) ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + AtomValue = ABL_ATOM_VALUE( Expr ); + BddFirst = searchbddcircuitin( (bddcircuit *)0, AtomValue ); + + if ( BddFirst == (bddnode *)0 ) + { + BddFirst = addbddcircuitin( (bddcircuit *)0, AtomValue, + (bddindex )0, BDD_IN_MODE_LAST ); + } + + AtomValue = loc_getbddstablename( AtomValue ); + BddNode = searchbddcircuitin( (bddcircuit *)0, AtomValue ); + + if ( BddNode == (bddnode *)0 ) + { + BddNode = addbddcircuitin( (bddcircuit *)0, AtomValue, + (bddindex )0, BDD_IN_MODE_LAST ); + } + + return( BddNode ); + } + + if ( ( isablunaryoper( Oper ) ) || + ( ABL_CDR( Expr ) == (ablexpr *)0 ) ) + { + bdderror( BDD_OPERATOR_ERROR, Oper ); + } + + if ( ( getabloperpolar( Oper ) == ABL_POLAR_POSITIVE ) || + ( ABL_CDDR( Expr ) == (ablexpr *)0 ) ) + { + Negative = 0; + } + else + { + Negative = 1; + Oper = getablopernot( Oper ); + } + + BddFirst = loc_addbddcircuitabl( ABL_CAR( Expr ) ); + + while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 ) + { + BddNode = loc_addbddcircuitabl( ABL_CAR( Expr ) ); + BddFirst = applybddnode( (bddsystem *)0, Oper, + decbddrefext( BddFirst ), + decbddrefext( BddNode ) ); + } + + if ( Negative ) + { + BddFirst = applybddnodenot( (bddsystem *)0, + decbddrefext( BddFirst ) ); + } + + return( BddFirst ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Add Abl Circuit | +| | +\------------------------------------------------------------*/ + +bddnode *addbddcircuitabl( BddCircuit, Expr ) + + bddcircuit *BddCircuit; + ablexpr *Expr; +{ + bddnode *BddNode; + + setbddlocalcircuit( BddCircuit ); + + BddNode = loc_addbddcircuitabl( Expr ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Stable Circuit Abl | +| | +\------------------------------------------------------------*/ + +void loc_stablebddcircuitabl( Expr ) + + ablexpr *Expr; +{ + char *Name; + + if ( ABL_ATOM( Expr ) ) + { + Name = loc_isbddstablename( ABL_ATOM_VALUE( Expr ) ); + + if ( Name != (char *)0 ) + { + ABL_CAR( Expr ) = addchain( (chain_list *)0, (void *)ABL_STABLE ); + addablhexpr( Expr, createablatom( Name ) ); + } + } + else + { + while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 ) + { + loc_stablebddcircuitabl( ABL_CAR( Expr ) ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Convert Circuit Abl | +| | +\------------------------------------------------------------*/ + +ablexpr *convertbddcircuitabl( BddCircuit, BddNode ) + + bddcircuit *BddCircuit; + bddnode *BddNode; +{ + ablexpr *Expr; + + setbddlocalcircuit( BddCircuit ); + + Expr = convertbddnodeabl( (bddsystem *)0, + BddLocalCircuit->NAME_IN, + BddLocalCircuit->INDEX_IN, BddNode ); + + loc_stablebddcircuitabl( Expr ); + + return( Expr ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Convert Circuit Sum Abl | +| | +\------------------------------------------------------------*/ + +ablexpr *convertbddcircuitsumabl( BddCircuit, BddNode ) + + bddcircuit *BddCircuit; + bddnode *BddNode; +{ + ablexpr *Expr; + + setbddlocalcircuit( BddCircuit ); + + Expr = convertbddnodesumabl( (bddsystem *)0, + BddLocalCircuit->NAME_IN, + BddLocalCircuit->INDEX_IN, BddNode ); + + loc_stablebddcircuitabl( Expr ); + + return( Expr ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Circuit | +| | +\------------------------------------------------------------*/ + +void viewbddcircuit( BddCircuit, ViewName ) + + bddcircuit *BddCircuit; + char ViewName; +{ + bddnamein *NameIn; + long ScanName; + long NumberName; + + if ( BddCircuit == (bddcircuit *)0 ) + { + BddCircuit = BddLocalCircuit; + } + + fprintf( stdout, "--> BddCircuit\n" ); + + fprintf( stdout, " NAME : %s \n", BddCircuit->NAME ); + fprintf( stdout, " NAME_IN_SIZE : %ld\n", BddCircuit->NAME_IN_SIZE ); + fprintf( stdout, " NUMBER_NAME_IN : %ld\n", BddCircuit->NUMBER_NAME_IN ); + fprintf( stdout, " NUMBER_NAME_OUT : %ld\n", BddCircuit->NUMBER_NAME_OUT ); + + if ( ViewName ) + { + NameIn = BddCircuit->NAME_IN; + NumberName = BddCircuit->NUMBER_NAME_IN; + + for ( ScanName = 0; ScanName < NumberName; ScanName++ ) + { + fprintf( stdout," NAME_IN[ %ld ] = %s\n", ScanName, NameIn[ ScanName ] ); + } + } + + fprintf( stdout, " HASH_IN :\n" ); + viewauthtable( BddCircuit->HASH_IN, (void *)0 ); + fprintf( stdout, " HASH_OUT :\n" ); + viewauthtable( BddCircuit->HASH_OUT, (void *)0 ); + + fprintf( stdout, "<-- BddCircuit\n" ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Circuit Node Num | +| | +\------------------------------------------------------------*/ + +long getbddcircuitnumnode( BddCircuit ) + + bddcircuit *BddCircuit; +{ + authelem *Element; + long HashIndex; + bddnode *BddNode; + long NumNode; + + setbddlocalcircuit( BddCircuit ); + + NumNode = 0; + + for ( HashIndex = 0; HashIndex < BddLocalCircuit->HASH_OUT->TABLE_SIZE; HashIndex++ ) + { + Element = &BddLocalCircuit->HASH_OUT->TABLE[ HashIndex ]; + + if ( checkauthkey( Element->KEY, 0 ) ) + { + BddNode = (bddnode *)Element->VALUE; + NumNode += getbddnodenum( (bddsystem *)0, BddNode ); + } + } + return( NumNode ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Size | +| | +\------------------------------------------------------------*/ + +long getbddcircuitsize( BddCircuit ) + + bddcircuit *BddCircuit; +{ + authelem *Element; + long HashIndex; + bddnode *BddNode; + long SizeNode; + + setbddlocalcircuit( BddCircuit ); + + SizeNode = 0; + + for ( HashIndex = 0; HashIndex < BddLocalCircuit->HASH_OUT->TABLE_SIZE; HashIndex++ ) + { + Element = &BddLocalCircuit->HASH_OUT->TABLE[ HashIndex ]; + + if ( checkauthkey( Element->KEY, 0 ) ) + { + BddNode = (bddnode *)Element->VALUE; + SizeNode += getbddnodenum( (bddsystem *)0, BddNode ); + } + } + return( SizeNode ); +} diff --git a/alliance/src/bdd/src/bddcircuit.h b/alliance/src/bdd/src/bddcircuit.h new file mode 100644 index 00000000..b3a07f32 --- /dev/null +++ b/alliance/src/bdd/src/bddcircuit.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcircuit.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_CIRCUIT_H +# define BDD_CIRCUIT_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddcofactor.c b/alliance/src/bdd/src/bddcofactor.c new file mode 100644 index 00000000..db698da5 --- /dev/null +++ b/alliance/src/bdd/src/bddcofactor.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcofactor.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddcofactor.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Cofactor Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *loc_cofactorbdd( BddNode1, BddNode2 ) + + bddnode *BddNode1; + bddnode *BddNode2; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddnode *BddHigh; + bddnode *BddLow; + bddindex Index1; + bddindex Index2; + + Index1 = BddNode1->INDEX; + Index2 = BddNode2->INDEX; + + if ( Index2 < BDD_INDEX_MIN ) + { + if ( Index2 == BDD_INDEX_ZERO ) + { + return( (bddnode *)0 ); + } + + return( incbddrefext( BddNode1 ) ); + } + + if ( Index1 < BDD_INDEX_MIN ) + { + return( BddNode1 ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_COFACTOR, BddNode1, BddNode2 ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( Index1 == Index2 ) + { + BddHigh = loc_cofactorbdd( BddNode1->HIGH, BddNode2->HIGH ); + BddLow = loc_cofactorbdd( BddNode1->LOW , BddNode2->LOW ); + } + else + if ( BddLocalSystem->INDEX_TO_VAR[ Index1 ] > + BddLocalSystem->INDEX_TO_VAR[ Index2 ] ) + { + Index1 = Index2; + BddHigh = loc_cofactorbdd( BddNode1, BddNode2->HIGH ); + BddLow = loc_cofactorbdd( BddNode1, BddNode2->LOW ); + } + else + { + BddHigh = loc_cofactorbdd( BddNode1->HIGH, BddNode2 ); + BddLow = loc_cofactorbdd( BddNode1->LOW , BddNode2 ); + } + + if ( BddHigh == (bddnode *)0 ) BddNode = BddLow; + else + if ( BddLow == (bddnode *)0 ) BddNode = BddHigh; + else + BddNode = addbddnode( (bddsystem *)0, Index1, + decbddrefext( BddHigh ), + decbddrefext( BddLow ) ); + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_COFACTOR, + BddNode1, BddNode2, BddNode ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Cofact Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *cofactorbddnode( BddSystem, BddNode1, BddNode2 ) + + bddsystem *BddSystem; + bddnode *BddNode1; + bddnode *BddNode2; +{ + setbddlocalsystem( BddSystem ); + + if ( BddNode2 == BddLocalSystem->ZERO ) + { + bdderror( BDD_BAD_INDEX_ERROR, BDD_INDEX_ZERO ); + } + + BddNode1 = loc_cofactorbdd( BddNode1, BddNode2 ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode1 ); +} diff --git a/alliance/src/bdd/src/bddcofactor.h b/alliance/src/bdd/src/bddcofactor.h new file mode 100644 index 00000000..2e22f65a --- /dev/null +++ b/alliance/src/bdd/src/bddcofactor.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcofactor.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_COFACTOR_H +# define BDD_COFACTOR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern bddnode *loc_cofactorbdd(); + +# endif diff --git a/alliance/src/bdd/src/bddcompose.c b/alliance/src/bdd/src/bddcompose.c new file mode 100644 index 00000000..c24df25e --- /dev/null +++ b/alliance/src/bdd/src/bddcompose.c @@ -0,0 +1,262 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcompose.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddcompose.h" +# include "bddapply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static bddvar BddLocalVariable = (bddvar )0; + static bddindex BddLocalIndex = (bddindex )0; + static bddnode *BddLocalNode = (bddnode *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Restrict Bdd Node | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_restrictbdd( BddNode ) + + bddnode *BddNode; +{ + bddhoper *HashOper; + bddnode *BddRestrict; + bddvar Variable; + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( BddLocalVariable < Variable ) + { + return( incbddrefext( BddNode ) ); + } + + if ( BddLocalVariable == Variable ) + { + if ( BddLocalNode->INDEX == BDD_INDEX_ZERO ) + { + return( incbddrefext( BddNode->LOW ) ); + } + else + { + return( incbddrefext( BddNode->HIGH ) ); + } + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_RESTRICT + BddLocalIndex, + BddNode, BddLocalNode ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + BddRestrict = addbddnode( (bddsystem *)0, BddNode->INDEX, + decbddrefext( loc_restrictbdd( BddNode->HIGH ) ), + decbddrefext( loc_restrictbdd( BddNode->LOW ) ) ); + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_RESTRICT + BddLocalIndex, + BddNode, BddLocalNode, BddRestrict ); + + return( BddRestrict ); +} + +/*------------------------------------------------------------\ +| | +| Restrict Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *restrictbddnode( BddSystem, BddNode, Variable, BddSubst ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddvar Variable; + bddnode *BddSubst; +{ + checkbddvar( BddSystem, Variable, 1 ); + + if ( BddSubst->INDEX >= BDD_INDEX_MIN ) + { + bdderror( BDD_BAD_INDEX_ERROR, BddSubst->INDEX ); + } + + BddLocalIndex = BddLocalSystem->VAR_TO_INDEX[ Variable ]; + BddLocalVariable = Variable; + BddLocalNode = BddSubst; + + BddNode = loc_restrictbdd( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Local Compose Bdd Node | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_composebdd( BddNode, BddSubst ) + + bddnode *BddNode; + bddnode *BddSubst; +{ + bddhoper *HashOper; + bddnode *BddCompose; + bddnode *BddHigh; + bddnode *BddLow; + bddvar Variable; + bddindex IndexNode; + bddindex IndexSubst; + + if ( BddSubst->INDEX < BDD_INDEX_MIN ) + { + BddLocalNode = BddSubst; + + return( loc_restrictbdd( BddNode ) ); + } + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( BddLocalVariable < Variable ) + { + return( incbddrefext( BddNode ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_COMPOSE + BddLocalIndex, + BddNode, BddSubst ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( BddLocalVariable == Variable ) + { + BddCompose = loc_applybddite( BddSubst, BddNode->HIGH , BddNode->LOW ); + + return( BddCompose ); + } + + IndexNode = BddNode->INDEX; + IndexSubst = BddSubst->INDEX; + + if ( BddLocalSystem->INDEX_TO_VAR[ IndexNode ] > + BddLocalSystem->INDEX_TO_VAR[ IndexSubst ] ) + { + IndexNode = IndexSubst; + BddHigh = loc_composebdd( BddNode, BddSubst->HIGH ); + BddLow = loc_composebdd( BddNode, BddSubst->LOW ); + } + else + { + BddHigh = loc_composebdd( BddNode->HIGH, BddSubst ); + BddLow = loc_composebdd( BddNode->LOW, BddSubst ); + } + + BddCompose = addbddnode( (bddsystem *)0, IndexNode, + decbddrefext( BddHigh ), + decbddrefext( BddLow ) ); + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_RESTRICT + BddLocalIndex, + BddNode, BddSubst, BddCompose ); + + return( BddCompose ); +} + +/*------------------------------------------------------------\ +| | +| Compose Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *composebddnode( BddSystem, BddNode, Variable, BddSubst ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddvar Variable; + bddnode *BddSubst; +{ + checkbddvar( BddSystem, Variable, 1 ); + + BddLocalVariable = Variable; + BddLocalIndex = BddLocalSystem->VAR_TO_INDEX[ Variable ]; + + BddNode = loc_composebdd( BddNode, BddSubst ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} diff --git a/alliance/src/bdd/src/bddcompose.h b/alliance/src/bdd/src/bddcompose.h new file mode 100644 index 00000000..d2181abd --- /dev/null +++ b/alliance/src/bdd/src/bddcompose.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddcompose.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_COMPOSE_H +# define BDD_COMPOSE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddconvert.c b/alliance/src/bdd/src/bddconvert.c new file mode 100644 index 00000000..0b397e2f --- /dev/null +++ b/alliance/src/bdd/src/bddconvert.c @@ -0,0 +1,561 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddconvert.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddconvert.h" +# include "bddapply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char **BddConvertNameArray = (char **)0; + static bddindex *BddConvertIndexArray = (bddindex *)0; + static chain_list *BddConvertSumProd = (chain_list *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Convert Bdd Index Abl | +| | +\------------------------------------------------------------*/ + +static chain_list *loc_convertbddindex( Index ) + + bddindex Index; +{ + if ( Index < BDD_INDEX_MIN ) + { + if ( Index == BDD_INDEX_ZERO ) + { + return( createablatomzero() ); + } + + return( createablatomone() ); + } + + Index = Index - BDD_INDEX_MIN; + + if ( BddConvertIndexArray != (bddindex *)0 ) + { + Index = BddConvertIndexArray[ Index ]; + } + + return( createablatom( BddConvertNameArray[ Index ] ) ); +} + +/*------------------------------------------------------------\ +| | +| Convert Bdd Index Abl | +| | +\------------------------------------------------------------*/ + +chain_list *convertbddindexabl( BddSystem, NameArray, IndexArray, Index ) + + bddsystem *BddSystem; + char **NameArray; + bddindex *IndexArray; + bddindex Index; +{ + setbddlocalsystem( BddSystem ); + + BddConvertNameArray = NameArray; + BddConvertIndexArray = IndexArray; + + return( loc_convertbddindex( Index ) ); +} + +/*------------------------------------------------------------\ +| | +| Local Convert Bdd Mux Abl | +| | +\------------------------------------------------------------*/ + +static chain_list *loc_convertbddmux( Equation, BddHigh, BddLow ) + + chain_list *Equation; + bddnode *BddHigh; + bddnode *BddLow; +{ + bddnode *NodeAnd; + bddnode *NodeOr; + chain_list *EquationHigh; + chain_list *EquationLow; + bddindex IndexHigh; + bddindex IndexLow; + + IndexHigh = BddHigh->INDEX; + IndexLow = BddLow->INDEX; + + if ( ( IndexLow < BDD_INDEX_MIN ) || + ( IndexHigh < BDD_INDEX_MIN ) ) + { + if ( ( IndexLow < BDD_INDEX_MIN ) && + ( IndexHigh < BDD_INDEX_MIN ) ) + { + if ( IndexLow == BDD_INDEX_ONE ) + { + Equation = optimablnotexpr( Equation ); + } + + return( Equation ); + } + + if ( IndexLow == BDD_INDEX_ONE ) + { + Equation = optimablbinexpr( ABL_OR, + loc_convertbddnode( BddHigh ), + optimablnotexpr( Equation ) ); + } + else + if ( IndexLow == BDD_INDEX_ZERO ) + { + Equation = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddHigh ), + Equation ); + } + else + if ( IndexHigh == BDD_INDEX_ONE ) + { + Equation = optimablbinexpr( ABL_OR, + loc_convertbddnode( BddLow ), + Equation ); + } + else + { + Equation = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddLow ), + optimablnotexpr( Equation ) ); + } + + return( Equation ); + } + + NodeAnd = decbddrefext( loc_applybdd( ABL_AND, BddHigh, BddLow ) ); + + if ( NodeAnd->INDEX == BDD_INDEX_ZERO ) + { + NodeOr = decbddrefext( loc_applybdd( ABL_OR, BddHigh, BddLow ) ); + + if ( NodeOr->INDEX == BDD_INDEX_ONE ) + { + Equation = optimablbinexpr( ABL_XOR, + loc_convertbddnode( BddLow ), + Equation ); + return( Equation ); + } + } + + if ( NodeAnd == BddHigh ) + { + EquationLow = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddLow ), + optimablnotexpr( Equation ) ); + + EquationHigh = loc_convertbddnode( BddHigh ); + } + else + if ( NodeAnd == BddLow ) + { + EquationLow = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddHigh ), + Equation ); + + EquationHigh = loc_convertbddnode( BddLow ); + } + else + { + EquationLow = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddLow ), + optimablnotexpr( dupablexpr( Equation ) ) ); + + EquationHigh = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddHigh ), + Equation ); + } + + Equation = optimablbinexpr( ABL_OR, EquationLow, EquationHigh ); + + return( Equation ); +} + +/*------------------------------------------------------------\ +| | +| Convert Bdd Mux Abl | +| | +\------------------------------------------------------------*/ + +chain_list *convertbddmuxabl( BddSystem, NameArray, IndexArray, Equation, BddHigh, BddLow ) + + bddsystem *BddSystem; + char **NameArray; + bddindex *IndexArray; + chain_list *Equation; + bddnode *BddHigh; + bddnode *BddLow; +{ + setbddlocalsystem( BddSystem ); + + BddConvertNameArray = NameArray; + BddConvertIndexArray = IndexArray; + + return( loc_convertbddmux( Equation, BddHigh, BddLow ) ); +} + +/*------------------------------------------------------------\ +| | +| Convert Node In Abl | +| | +\------------------------------------------------------------*/ + +chain_list *loc_convertbddnode( BddNode ) + + bddnode *BddNode; +{ + chain_list *Equation; + chain_list *Atom; + bddnode *ScanNode; + bddindex IndexLow; + bddindex IndexHigh; + + if ( BddNode->INDEX == BDD_INDEX_ONE ) + { + return( createablatomone() ); + } + + if ( BddNode->INDEX == BDD_INDEX_ZERO ) + { + return( createablatomzero() ); + } + + IndexLow = BddNode->LOW->INDEX; + IndexHigh = BddNode->HIGH->INDEX; + + if ( ( IndexLow < BDD_INDEX_MIN ) || + ( IndexHigh < BDD_INDEX_MIN ) ) + { + Atom = loc_convertbddindex( BddNode->INDEX ); + + if ( ( IndexLow < BDD_INDEX_MIN ) && + ( IndexHigh < BDD_INDEX_MIN ) ) + { + if ( IndexLow == BDD_INDEX_ONE ) + { + Atom = optimablnotexpr( Atom ); + } + + return( Atom ); + } + + if ( IndexLow == BDD_INDEX_ONE ) + { + Equation = optimablbinexpr( ABL_OR, + loc_convertbddnode( BddNode->HIGH ), + optimablnotexpr( Atom ) ); + } + else + if ( IndexLow == BDD_INDEX_ZERO ) + { + Equation = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddNode->HIGH ), + Atom ); + } + else + if ( IndexHigh == BDD_INDEX_ONE ) + { + Equation = optimablbinexpr( ABL_OR, + loc_convertbddnode( BddNode->LOW ), + Atom ); + } + else + { + Equation = optimablbinexpr( ABL_AND, + loc_convertbddnode( BddNode->LOW ), + optimablnotexpr( Atom ) ); + } + + return( Equation ); + } + + if ( ( BddNode->HIGH == BddNode->LOW->HIGH ) || + ( BddNode->HIGH == BddNode->LOW->LOW ) ) + { + Equation = createabloper( ABL_OR ); + + Atom = loc_convertbddindex( BddNode->INDEX ); + addablhexpr( Equation, Atom ); + + ScanNode = BddNode->LOW; + + do + { + Atom = loc_convertbddindex( ScanNode->INDEX ); + + if ( ScanNode->HIGH == BddNode->HIGH ) + { + ScanNode = ScanNode->LOW; + } + else + { + ScanNode = ScanNode->HIGH; + Atom = optimablnotexpr( Atom ); + } + + addablhexpr( Equation, Atom ); + } + while ( ( ScanNode->HIGH == BddNode->HIGH ) || + ( ScanNode->LOW == BddNode->HIGH ) ); + + Equation = loc_convertbddmux( Equation, BddNode->HIGH, ScanNode ); + + return( Equation ); + } + + if ( ( BddNode->LOW == BddNode->HIGH->HIGH ) || + ( BddNode->LOW == BddNode->HIGH->LOW ) ) + { + Equation = createabloper( ABL_AND ); + + Atom = loc_convertbddindex( BddNode->INDEX ); + addablhexpr( Equation, Atom ); + + ScanNode = BddNode->HIGH; + + do + { + Atom = loc_convertbddindex( ScanNode->INDEX ); + + if ( ScanNode->LOW == BddNode->LOW ) + { + ScanNode = ScanNode->HIGH; + } + else + { + ScanNode = ScanNode->LOW; + Atom = optimablnotexpr( Atom ); + } + + addablhexpr( Equation, Atom ); + } + while ( ( ScanNode->HIGH == BddNode->LOW ) || + ( ScanNode->LOW == BddNode->LOW ) ); + + Equation = loc_convertbddmux( Equation, ScanNode, BddNode->LOW ); + + return( Equation ); + } + + if ( ( IndexLow == IndexHigh ) && + ( BddNode->HIGH->HIGH == BddNode->LOW->LOW ) && + ( BddNode->HIGH->LOW == BddNode->LOW->HIGH ) ) + { + Equation = optimablbinexpr( ABL_XOR, + loc_convertbddindex( BddNode->INDEX ), + loc_convertbddindex( BddNode->LOW->INDEX ) ); + + Equation = loc_convertbddmux( Equation, BddNode->LOW->HIGH, BddNode->LOW->LOW ); + + return( Equation ); + } + + Atom = loc_convertbddindex( BddNode->INDEX ); + + Equation = loc_convertbddmux( Atom, BddNode->HIGH, BddNode->LOW ); + + return( Equation ); +} + +/*------------------------------------------------------------\ +| | +| Convert Bdd Node Abl | +| | +\------------------------------------------------------------*/ + +chain_list *convertbddnodeabl( BddSystem, NameArray, IndexArray, BddNode ) + + bddsystem *BddSystem; + char **NameArray; + bddindex *IndexArray; + bddnode *BddNode; +{ + setbddlocalsystem( BddSystem ); + + BddConvertNameArray = NameArray; + BddConvertIndexArray = IndexArray; + + return( loc_convertbddnode( BddNode ) ); +} + +/*------------------------------------------------------------\ +| | +| Local Convert Node In Sum of Product Abl | +| | +\------------------------------------------------------------*/ + +void loc_convertbddnodesum( BddNode, SumProd ) + + bddnode *BddNode; + chain_list *SumProd; +{ + chain_list *Equation; + bddindex IndexLow; + bddindex IndexHigh; + + IndexLow = BddNode->LOW->INDEX; + IndexHigh = BddNode->HIGH->INDEX; + + if ( ( IndexHigh == BDD_INDEX_ONE ) || + ( IndexLow == BDD_INDEX_ONE ) ) + { + Equation = loc_convertbddindex( BddNode->INDEX ); + + if ( IndexLow == BDD_INDEX_ONE ) + { + Equation = optimablnotexpr( Equation ); + } + + if ( SumProd != (chain_list *)0 ) + { + Equation = optimablbinexpr( ABL_AND, dupablexpr( SumProd ), Equation ); + } + + addablhexpr( BddConvertSumProd, Equation ); + } + + if ( IndexHigh >= BDD_INDEX_MIN ) + { + Equation = loc_convertbddindex( BddNode->INDEX ); + + if ( SumProd != (chain_list *)0 ) + { + Equation = optimablbinexpr( ABL_AND, dupablexpr( SumProd ), Equation ); + } + + loc_convertbddnodesum( BddNode->HIGH, Equation ); + + delablexpr( Equation ); + } + + if ( IndexLow >= BDD_INDEX_MIN ) + { + Equation = loc_convertbddindex( BddNode->INDEX ); + Equation = optimablnotexpr( Equation ); + + if ( SumProd != (chain_list *)0 ) + { + Equation = optimablbinexpr( ABL_AND, dupablexpr( SumProd ), Equation ); + } + + loc_convertbddnodesum( BddNode->LOW, Equation ); + + delablexpr( Equation ); + } +} + +/*------------------------------------------------------------\ +| | +| Convert Bdd Sum of Product Abl | +| | +\------------------------------------------------------------*/ + +chain_list *convertbddnodesumabl( BddSystem, NameArray, IndexArray, BddNode ) + + bddsystem *BddSystem; + char **NameArray; + bddindex *IndexArray; + bddnode *BddNode; +{ + chain_list *SumProd; + + setbddlocalsystem( BddSystem ); + + BddConvertNameArray = NameArray; + BddConvertIndexArray = IndexArray; + + if ( BddNode->INDEX == BDD_INDEX_ONE ) + { + return( createablatomone() ); + } + + if ( BddNode->INDEX == BDD_INDEX_ZERO ) + { + return( createablatomzero() ); + } + + BddConvertSumProd = createabloper( ABL_OR ); + + loc_convertbddnodesum( BddNode, (chain_list *)0 ); + + if ( ABL_CDDR( BddConvertSumProd ) == (chain_list *)0 ) + { + SumProd = ABL_CADR( BddConvertSumProd ); + ABL_CADR( BddConvertSumProd ) = (chain_list *)0; + + freeablexpr( BddConvertSumProd ); + BddConvertSumProd = SumProd; + } + + return( BddConvertSumProd ); +} diff --git a/alliance/src/bdd/src/bddconvert.h b/alliance/src/bdd/src/bddconvert.h new file mode 100644 index 00000000..6e3671e1 --- /dev/null +++ b/alliance/src/bdd/src/bddconvert.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddconvert.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_CONVERT_H +# define BDD_CONVERT_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern chain_list * loc_convertbddnode __P((bddnode *BddNode)); + +# endif diff --git a/alliance/src/bdd/src/bdddump.c b/alliance/src/bdd/src/bdddump.c new file mode 100644 index 00000000..c01eb392 --- /dev/null +++ b/alliance/src/bdd/src/bdddump.c @@ -0,0 +1,413 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bdddump.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include +# include "bdddump.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *BddDumpFile = (FILE *)0; + static char BddDumpBuffer[ BDD_UNDUMP_BUFFER_SIZE ]; + static long BddDumpLine = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +static long loc_undumpbddhkey( Table, Key ) + + authtable *Table; + char *Key; +{ + return( ( (unsigned long)Key ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Undump Get Line | +| | +\------------------------------------------------------------*/ + +static void loc_undumpbddgetline() +{ + char *Scan; + + while( fgets( BddDumpBuffer, BDD_UNDUMP_BUFFER_SIZE, BddDumpFile ) ) + { + Scan = strchr( BddDumpBuffer, '\n' ); + if ( Scan != (char *)0 ) + { + *Scan = '\0'; BddDumpLine++; + } + + if ( ( BddDumpBuffer[ 0 ] != '#' ) && + ( BddDumpBuffer[ 0 ] != '\0' ) ) + { + return; + } + } + + bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Undump Circuit | +| | +\------------------------------------------------------------*/ + +bddcircuit *undumpbddcircuit( BddSystem, FileName ) + + bddsystem *BddSystem; + char *FileName; +{ + bddcircuit *BddCircuit; + authtable *HashInput; + authtable *HashNode; + authelem *Element; + bddnode *BddNode; + bddnode *BddHigh; + bddnode *BddLow; + char *Name; + char *Scan; + int Value; + long Index; + long NumberIn; + long NumberOut; + long NumberNode; + long BddVar; + long ZeroAddr; + long OneAddr; + long NodeAddr; + long HighAddr; + long LowAddr; + + FileName = autbasename( FileName, "bdd" ); + BddDumpFile = mbkfopen( FileName, "bdd", "r" ); + BddDumpLine = 0; + + if ( BddDumpFile == (FILE *)0 ) + { + bdderror( BDD_UNDUMP_FILE_ERROR, FileName ); + } + + mbkfree( FileName ); + + loc_undumpbddgetline(); + Name = BddDumpBuffer + 9; + + loc_undumpbddgetline(); + Value = sscanf( BddDumpBuffer, ".port %ld %ld", &NumberIn, &NumberOut ); + if ( Value != 2 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + + loc_undumpbddgetline(); + + BddCircuit = createbddcircuit( Name, NumberIn, NumberOut, BddSystem ); + HashInput = createauthtable( NumberIn + 1 ); + setauthfunc( HashInput, 0, loc_undumpbddhkey, 0 ); + + for ( Index = 0; Index < NumberIn; Index++ ) + { + loc_undumpbddgetline(); + + Value = 0; + Scan = strchr( BddDumpBuffer, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + Value = sscanf( BddDumpBuffer, "%ld", &BddVar ); + Name = namealloc( Scan + 1 ); + } + + if ( Value != 1 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + + BddNode = addbddcircuitin( (bddcircuit *)0, Name, 0, BDD_IN_MODE_LAST ); + + addauthelem( HashInput, (char *)BddVar + 2, (long)BddNode->INDEX ); + } + + loc_undumpbddgetline(); + Value = sscanf( BddDumpBuffer, ".node %ld %lX %lX", + &NumberNode, &ZeroAddr, &OneAddr ); + if ( Value != 3 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + + HashNode = createauthtable( NumberNode + 1 ); + setauthfunc( HashNode, 0, loc_undumpbddhkey, 0 ); + + addauthelem( HashNode, (char *)ZeroAddr, (long)BddLocalSystem->ZERO ); + addauthelem( HashNode, (char *)OneAddr , (long)BddLocalSystem->ONE ); + + loc_undumpbddgetline(); + + while ( BddDumpBuffer[ 0 ] != '.' ) + { + Value = sscanf( BddDumpBuffer, "%lX %ld %lX %lX", + &NodeAddr, &BddVar, &HighAddr, &LowAddr ); + if ( Value != 4 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + + Element = searchauthelem( HashNode, (char *)HighAddr ); + if ( Element == (authelem *)0 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + BddHigh = (bddnode *)( Element->VALUE ); + + Element = searchauthelem( HashNode, (char *)LowAddr ); + if ( Element == (authelem *)0 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + BddLow = (bddnode *)( Element->VALUE ); + + Element = searchauthelem( HashInput, (char *)( BddVar + 2 ) ); + if ( Element == (authelem *)0 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + BddNode = addbddnode( (bddsystem *)0, Element->VALUE, BddHigh, BddLow ); + + addauthelem( HashNode, (char *)NodeAddr, (long)decbddrefext( BddNode ) ); + loc_undumpbddgetline(); + } + + for ( Index = 0; Index < NumberOut; Index++ ) + { + loc_undumpbddgetline(); + + Value = 0; + Scan = strchr( BddDumpBuffer, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + Value = sscanf( BddDumpBuffer, "%lX", &NodeAddr ); + Name = namealloc( Scan + 1 ); + } + + if ( Value != 1 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + + Element = searchauthelem( HashNode, (char *)NodeAddr ); + if ( Element == (authelem *)0 ) bdderror( BDD_UNDUMP_LINE_ERROR, BddDumpLine ); + BddNode = (bddnode *)( Element->VALUE ); + + addbddcircuitout( (bddcircuit *)0, Name, BddNode ); + } + + fclose( BddDumpFile ); + + return( BddCircuit ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Dump Circuit Output | +| | +\------------------------------------------------------------*/ + +static void loc_dumpbddcircuitout( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( ! ( BddNode->FLAG & BDD_FLAG_NUM_MASK ) ) + { + loc_dumpbddcircuitout( BddNode->HIGH ); + loc_dumpbddcircuitout( BddNode->LOW ); + + BddNode->FLAG |= BDD_FLAG_NUM_MASK; + + fprintf( BddDumpFile, "%lX %d %lX %lX\n", + (long)BddNode, + BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ], + (long)BddNode->HIGH, + (long)BddNode->LOW ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Dump Circuit | +| | +\------------------------------------------------------------*/ + +static long loc_dumpbddcompare( ValueArray, Index1, Index2 ) + + authelem *ValueArray; + long Index1; + long Index2; +{ + return( ValueArray[ Index2 ].VALUE - ValueArray[ Index1 ].VALUE ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Dump Circuit | +| | +\------------------------------------------------------------*/ + +void dumpbddcircuit( BddCircuit, FileName ) + + bddcircuit *BddCircuit; + char *FileName; +{ + authelem *HashTable; + authelem *HashElement; + authelem *ValueArray; + long *IndexArray; + long Index; + long HashSize; + long HashIndex; + long NumberIn; + long NumberOut; + bddindex BddIndex; + + setbddlocalcircuit( BddCircuit ); + + FileName = autbasename( FileName, "bdd" ); + BddDumpFile = mbkfopen( FileName, "bdd", "w" ); + + if ( BddDumpFile == (FILE *)0 ) + { + bdderror( BDD_DUMP_FILE_ERROR, FileName ); + } + + mbkfree( FileName ); + fprintf( BddDumpFile, ".circuit %s\n", BddLocalCircuit->NAME ); + + NumberIn = BddLocalCircuit->HASH_IN->NUMBER_ELEM; + NumberOut = BddLocalCircuit->HASH_OUT->NUMBER_ELEM; + + HashTable = BddLocalCircuit->HASH_IN->TABLE; + HashSize = BddLocalCircuit->HASH_IN->TABLE_SIZE; + + fprintf( BddDumpFile, ".port %ld %ld\n", NumberIn, NumberOut ); + + fprintf( BddDumpFile, ".in\n" ); + + IndexArray = (long *)autallocblock( sizeof( long ) * ( NumberIn + 1 )); + ValueArray = (authelem *)autallocblock( sizeof( authelem ) * ( NumberIn + 1 )); + Index = 0; + + for ( HashIndex = 0; HashIndex < HashSize; HashIndex++ ) + { + HashElement = &HashTable[ HashIndex ]; + + if ( checkauthkey( HashElement->KEY, 0 ) ) + { + BddIndex = ((bddnode *) HashElement->VALUE )->INDEX; + + ValueArray[ Index ].KEY = HashElement->KEY; + ValueArray[ Index ].VALUE = BddLocalSystem->INDEX_TO_VAR[ BddIndex ]; + + Index++; + } + } + + sortautarray( ValueArray, IndexArray, NumberIn, loc_dumpbddcompare ); + + for ( HashIndex = 0; HashIndex < NumberIn; HashIndex++ ) + { + Index = IndexArray[ HashIndex ]; + + fprintf( BddDumpFile, "%ld %s\n", + ValueArray[ Index ].VALUE, ValueArray[ Index ].KEY ); + } + + autfreeblock( IndexArray ); + autfreeblock( ValueArray ); + + HashTable = BddLocalCircuit->HASH_OUT->TABLE; + HashSize = BddLocalCircuit->HASH_OUT->TABLE_SIZE; + + fprintf( BddDumpFile, ".node %ld %lX %lX\n", + BddLocalSystem->NUMBER_NODE, + (long)BddLocalSystem->ZERO, + (long)BddLocalSystem->ONE ); + + for ( HashIndex = 0; HashIndex < HashSize; HashIndex++ ) + { + HashElement = &HashTable[ HashIndex ]; + + if ( checkauthkey( HashElement->KEY, 0 ) ) + { + loc_dumpbddcircuitout( (bddnode *)( HashElement->VALUE ) ); + } + } + + fprintf( BddDumpFile, ".out\n" ); + + for ( HashIndex = 0; HashIndex < HashSize; HashIndex++ ) + { + HashElement = &HashTable[ HashIndex ]; + + if ( checkauthkey( HashElement->KEY, 0 ) ) + { + fprintf( BddDumpFile, "%lX %s\n", + (long)HashElement->VALUE, HashElement->KEY ); + + unflagbddnode( (bddsystem *)0, + (bddnode *)( HashElement->VALUE ), + BDD_FLAG_NUM_MASK ); + } + } + + fclose( BddDumpFile ); +} diff --git a/alliance/src/bdd/src/bdddump.h b/alliance/src/bdd/src/bdddump.h new file mode 100644 index 00000000..6f75673e --- /dev/null +++ b/alliance/src/bdd/src/bdddump.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bdddump.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_DUMP_H +# define BDD_DUMP_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define BDD_UNDUMP_BUFFER_SIZE 128 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddenv.c b/alliance/src/bdd/src/bddenv.c new file mode 100644 index 00000000..70d3a98b --- /dev/null +++ b/alliance/src/bdd/src/bddenv.c @@ -0,0 +1,82 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddenv.c | +| | +| Date : 03.12.96 | +| | +| Bddhor : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddenv.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Env | +| | +\------------------------------------------------------------*/ + +void bddenv() +{ + return; +} diff --git a/alliance/src/bdd/src/bddenv.h b/alliance/src/bdd/src/bddenv.h new file mode 100644 index 00000000..7798209a --- /dev/null +++ b/alliance/src/bdd/src/bddenv.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddenv.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_ENV_H +# define BDD_ENV_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bdderror.c b/alliance/src/bdd/src/bdderror.c new file mode 100644 index 00000000..800a9ecb --- /dev/null +++ b/alliance/src/bdd/src/bdderror.c @@ -0,0 +1,291 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : Bdd Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void bdd_error( Error, Value, File, Line ) + + int Error; + long Value; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Error ) + { + case BDD_MODEL_VAR_ERROR : + + fprintf( stderr, "system model variable %ld", Value ); + + break; + + case BDD_MODEL_OPER_ERROR : + + fprintf( stderr, "system model oper %ld", Value ); + + break; + + case BDD_HNODE_SIZE_ERROR : + + fprintf( stderr, "hash node table size %ld", Value ); + + break; + + case BDD_HNODE_KEY_ERROR : + + fprintf( stderr, "hash node key 0" ); + + break; + + case BDD_HOPER_SIZE_ERROR : + + fprintf( stderr, "hash oper table size %ld", Value ); + + break; + + case BDD_HOPER_KEY_ERROR : + + fprintf( stderr, "hash oper key 0" ); + + break; + + case BDD_BAD_INDEX_ERROR : + + fprintf( stderr, "index %ld out of range", Value ); + + break; + + case BDD_BAD_VAR_ERROR : + + fprintf( stderr, "variable %ld out of range", Value ); + + break; + + case BDD_BAD_CHILD_ERROR : + + fprintf( stderr, "child %ld out of range", Value ); + + break; + + case BDD_BAD_IN_ERROR : + + fprintf( stderr, "input %s exist already", (char *)Value ); + + break; + + case BDD_OPERATOR_ERROR : + + fprintf( stderr, "bad operator %ld", Value ); + + break; + + case BDD_BAD_LIST_ERROR : + + fprintf( stderr, "bad list" ); + + break; + + case BDD_NO_MORE_VAR_ERROR : + + fprintf( stderr, "no more variables" ); + + break; + + case BDD_NEGATIVE_REF_INT_ERROR : + + fprintf( stderr, "negative internal reference, index %ld", Value ); + + break; + + case BDD_NEGATIVE_REF_EXT_ERROR : + + fprintf( stderr, "negative external reference, index %ld", Value ); + + break; + + case BDD_UNKNOWN_IN_MODE_ERROR : + + fprintf( stderr, "unknwon in mode %ld", Value ); + + break; + + case BDD_MAX_NODE_ERROR : + + fprintf( stderr, "node limit reached %ld", Value ); + + break; + + case BDD_BAD_ASSOC_ERROR : + + fprintf( stderr, "bad variable association %ld", Value ); + + break; + + case BDD_NO_MORE_ASSOC_ERROR : + + fprintf( stderr, "no more variable association" ); + + break; + + case BDD_UNKNOWN_AUX_MODE_ERROR : + + fprintf( stderr, "unknwon aux mode %ld", Value ); + + break; + + case BDD_DUMP_FILE_ERROR : + + fprintf( stderr, "bad dump file %s", (char *)Value ); + + break; + + case BDD_UNDUMP_FILE_ERROR : + + fprintf( stderr, "undump file name %s", (char *)Value ); + + break; + + case BDD_UNDUMP_LINE_ERROR : + + fprintf( stderr, "undump line %ld syntax", Value ); + + break; + + default : + + fprintf( stderr, "unknown internal %d", Error ); + } + + fprintf( stderr, " error !\n" ); + + autexit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void bdd_warning( Warning, Value1, Value2, File, Line ) + + int Warning; + long Value1; + long Value2; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Warning ) + { + case BDD_DYNAMIC_REORDER_WARNING : + + fprintf( stderr, "dynamic reorder %ld -> %ld", Value1, Value2 ); + + break; + + case BDD_DYNAMIC_EXPLOSION_WARNING : + + fprintf( stderr, "dynamic explosion %ld -> %ld", Value1, Value2 ); + + break; + + case BDD_OVERFLOW_REF_INT_WARNING : + + fprintf( stderr, "internal reference overflow, index %ld", Value1 ); + + break; + + case BDD_OVERFLOW_REF_EXT_WARNING : + + fprintf( stderr, "external reference overflow, index %ld", Value1 ); + + break; + + default : + + fprintf( stderr, "unknown internal %d", Warning ); + } + + fprintf( stderr, " warning !\n" ); +} diff --git a/alliance/src/bdd/src/bdderror.h b/alliance/src/bdd/src/bdderror.h new file mode 100644 index 00000000..863295f7 --- /dev/null +++ b/alliance/src/bdd/src/bdderror.h @@ -0,0 +1,125 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : Bdd Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 03.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_ERROR_H +# define BDD_ERROR_H + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Error | +| | +\------------------------------------------------------------*/ + +# define BDD_MODEL_VAR_ERROR 0 +# define BDD_MODEL_OPER_ERROR 1 +# define BDD_HNODE_SIZE_ERROR 2 +# define BDD_HNODE_KEY_ERROR 3 +# define BDD_HOPER_SIZE_ERROR 4 +# define BDD_HOPER_KEY_ERROR 5 +# define BDD_BAD_INDEX_ERROR 6 +# define BDD_BAD_VAR_ERROR 7 +# define BDD_BAD_CHILD_ERROR 8 +# define BDD_BAD_IN_ERROR 9 +# define BDD_OPERATOR_ERROR 10 +# define BDD_BAD_LIST_ERROR 11 +# define BDD_NO_MORE_VAR_ERROR 12 +# define BDD_NEGATIVE_REF_INT_ERROR 13 +# define BDD_NEGATIVE_REF_EXT_ERROR 14 +# define BDD_UNKNOWN_IN_MODE_ERROR 15 +# define BDD_MAX_NODE_ERROR 16 +# define BDD_BAD_ASSOC_ERROR 17 +# define BDD_NO_MORE_ASSOC_ERROR 18 +# define BDD_UNKNOWN_AUX_MODE_ERROR 19 +# define BDD_DUMP_FILE_ERROR 20 +# define BDD_UNDUMP_FILE_ERROR 21 +# define BDD_UNDUMP_LINE_ERROR 22 + +/*------------------------------------------------------------\ +| | +| Warning | +| | +\------------------------------------------------------------*/ + +# define BDD_DYNAMIC_REORDER_WARNING 0 +# define BDD_OVERFLOW_REF_INT_WARNING 1 +# define BDD_OVERFLOW_REF_EXT_WARNING 2 +# define BDD_DYNAMIC_EXPLOSION_WARNING 3 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define bdderror( E, V ) (bdd_error( (int)(E), (long)(V), __FILE__, __LINE__ )) +# define bddwarning( W, V1, V2 ) (bdd_warning( (int)(W), (long)(V1), \ + (long)(V2), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void bdd_error __P((int Error, long Value, char *File, long Line)); + extern void bdd_warning __P((int Warning, long Value1, long Value2, char *File, long Line)); + +# endif diff --git a/alliance/src/bdd/src/bddexist.c b/alliance/src/bdd/src/bddexist.c new file mode 100644 index 00000000..d9450fba --- /dev/null +++ b/alliance/src/bdd/src/bddexist.c @@ -0,0 +1,330 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddexist.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddassoc.h" +# include "bddapply.h" +# include "bddexist.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Exist Node With Association | +| | +\------------------------------------------------------------*/ + +bddnode *loc_existbddnode( BddNode ) + + bddnode *BddNode; +{ + bddhoper *HashOper; + bddnode *BddExist; + bddnode *BddHigh; + bddnode *BddLow; + bddvar NodeVar; + + NodeVar = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( BddLocalAssoc->LAST < NodeVar ) + { + return( incbddrefext( BddNode ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_EXIST + BddLocalAssoc->IDENT, + BddNode, BddNode ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + BddExist = BddLocalAssocNode[ NodeVar ]; + BddHigh = loc_existbddnode( BddNode->HIGH ); + + if ( ( BddExist != (bddnode *)0 ) && + ( BddHigh->INDEX == BDD_INDEX_ONE ) ) + { + BddExist = BddHigh; + } + else + { + BddLow = decbddrefext( loc_existbddnode( BddNode->LOW ) ); + BddHigh = decbddrefext( BddHigh ); + + if ( BddExist != (bddnode *)0 ) + { + BddExist = loc_applybdd( ABL_OR, BddHigh, BddLow ); + } + else + { + BddExist = addbddnode( (bddsystem *)0, BddNode->INDEX, BddHigh, BddLow ); + } + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_EXIST + BddLocalAssoc->IDENT, + BddNode, BddNode, BddExist ); + + BddLocalAssoc->CACHE = 1; + + return( BddExist ); +} + +/*------------------------------------------------------------\ +| | +| Exist Bdd Node With Association | +| | +\------------------------------------------------------------*/ + +bddnode *existbddnodeassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddExist; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddExist = loc_existbddnode( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddExist ); +} + +/*------------------------------------------------------------\ +| | +| Forall Bdd Node With Association | +| | +\------------------------------------------------------------*/ + +bddnode *forallbddnodeassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddForall; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddNode = decbddrefext( loc_applybddnot( BddNode ) ); + BddForall = decbddrefext( loc_existbddnode( BddNode ) ); + BddForall = loc_applybddnot( BddForall ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddForall ); +} + +/*------------------------------------------------------------\ +| | +| Local Exist Node With Missing Association | +| | +\------------------------------------------------------------*/ + +bddnode *loc_existbddnodemiss( BddNode ) + + bddnode *BddNode; +{ + bddhoper *HashOper; + bddnode *BddExist; + bddnode *BddHigh; + bddnode *BddLow; + bddvar NodeVar; + short Exist; + + if ( BddNode->INDEX < BDD_INDEX_MIN ) + { + return( BddNode ); + } + + NodeVar = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( BddLocalAssoc->LAST < NodeVar ) + { + Exist = 1; + } + else + { + Exist = ( BddLocalAssocNode[ NodeVar ] == (bddnode *)0 ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_EXIST_MISS + BddLocalAssoc->IDENT, + BddNode, BddNode ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + BddHigh = loc_existbddnodemiss( BddNode->HIGH ); + + if ( ( Exist ) && + ( BddHigh->INDEX == BDD_INDEX_ONE ) ) + { + BddExist = BddHigh; + } + else + { + BddLow = decbddrefext( loc_existbddnodemiss( BddNode->LOW ) ); + BddHigh = decbddrefext( BddHigh ); + + if ( Exist ) + { + BddExist = loc_applybdd( ABL_OR, BddHigh, BddLow ); + } + else + { + BddExist = addbddnode( (bddsystem *)0, BddNode->INDEX, BddHigh, BddLow ); + } + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_EXIST_MISS + BddLocalAssoc->IDENT, + BddNode, BddNode, BddExist ); + + BddLocalAssoc->CACHE = 1; + + return( BddExist ); +} + +/*------------------------------------------------------------\ +| | +| Exist Bdd Node Missing Association | +| | +\------------------------------------------------------------*/ + +bddnode *existbddnodemissassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddExist; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddExist = loc_existbddnodemiss( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddExist ); +} + +/*------------------------------------------------------------\ +| | +| Forall Bdd Node With Missing Association | +| | +\------------------------------------------------------------*/ + +bddnode *forallbddnodemissassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddMiss; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddNode = decbddrefext( loc_applybddnot( BddNode ) ); + BddMiss = decbddrefext( loc_existbddnodemiss( BddNode ) ); + BddMiss = loc_applybddnot( BddMiss ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddMiss ); +} diff --git a/alliance/src/bdd/src/bddexist.h b/alliance/src/bdd/src/bddexist.h new file mode 100644 index 00000000..9839a4f0 --- /dev/null +++ b/alliance/src/bdd/src/bddexist.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddexist.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_EXIST_H +# define BDD_EXIST_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern bddnode * loc_existbddnode __P((bddnode *BddNode)); + +# endif diff --git a/alliance/src/bdd/src/bddexplosion.c b/alliance/src/bdd/src/bddexplosion.c new file mode 100644 index 00000000..2d2aa78d --- /dev/null +++ b/alliance/src/bdd/src/bddexplosion.c @@ -0,0 +1,118 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddexplosion.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| Modif : Arnaud Caron - 16 Oct 1998 | +| Suppression des bddvartrees. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddexplosion.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| explosion Bdd System Restart | +| | +\------------------------------------------------------------*/ + +void explosionbddsystemrestart( BddSystem ) + + bddsystem *BddSystem; +{ + setbddlocalsystem( BddSystem ); + + BddLocalSystem->HASH_OPER->TABLE_FREEZE = 0; + ClearBddSystemExplosion( BddLocalSystem ); +} + +/*------------------------------------------------------------\ +| | +| explosion Bdd System Dynamic | +| | +\------------------------------------------------------------*/ + +void explosionbddsystemdynamic( BddSystem, ExplosionFunc, ExplosionLimit ) + + bddsystem *BddSystem; + void (*ExplosionFunc)(); + long ExplosionLimit; +{ + setbddlocalsystem( BddSystem ); + + if ( ExplosionLimit <= 0 ) + { + ClearBddSystemExplosionOn( BddLocalSystem ); + } + else + { + SetBddSystemExplosionOn( BddLocalSystem ); + + BddLocalSystem->EXPLOSION_FUNC = ExplosionFunc; + BddLocalSystem->EXPLOSION_LIMIT = ExplosionLimit; + } + + ClearBddSystemExplosion( BddLocalSystem ); +} diff --git a/alliance/src/bdd/src/bddexplosion.h b/alliance/src/bdd/src/bddexplosion.h new file mode 100644 index 00000000..c53a205c --- /dev/null +++ b/alliance/src/bdd/src/bddexplosion.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddexplosion.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_EXPLOSION_H +# define BDD_EXPLOSION_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddflag.c b/alliance/src/bdd/src/bddflag.c new file mode 100644 index 00000000..50098ffc --- /dev/null +++ b/alliance/src/bdd/src/bddflag.c @@ -0,0 +1,223 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddflag.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddflag.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static bddflag BddFlagMask = 0; + static long BddFlagNumberNode = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Flag Bdd Node | +| | +\------------------------------------------------------------*/ + +static void loc_flagbdd( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( ! ( BddNode->FLAG & BddFlagMask ) ) + { + BddNode->FLAG |= BddFlagMask; + BddFlagNumberNode++; + + loc_flagbdd( BddNode->LOW ); + loc_flagbdd( BddNode->HIGH ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Unflag Node | +| | +\------------------------------------------------------------*/ + +static void loc_unflagbdd( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->FLAG & BddFlagMask ) + { + BddNode->FLAG &= ~BddFlagMask; + BddFlagNumberNode++; + + loc_unflagbdd( BddNode->LOW ); + loc_unflagbdd( BddNode->HIGH ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Flag Node | +| | +\------------------------------------------------------------*/ + +long flagbddnode( BddSystem, BddNode, Flag ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddflag Flag; +{ + setbddlocalsystem( BddSystem ); + + BddFlagMask = Flag; + BddFlagNumberNode = 0; + + loc_flagbdd( BddNode ); + + return( BddFlagNumberNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Flag Node | +| | +\------------------------------------------------------------*/ + +long unflagbddnode( BddSystem, BddNode, Flag ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddflag Flag; +{ + setbddlocalsystem( BddSystem ); + + BddFlagMask = Flag; + BddFlagNumberNode = 0; + + loc_unflagbdd( BddNode ); + + return( BddFlagNumberNode ); +} + +/*------------------------------------------------------------\ +| | +| Get Node Size | +| | +\------------------------------------------------------------*/ + +static void loc_getbddsize( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + BddFlagNumberNode++; + + loc_getbddsize( BddNode->LOW ); + loc_getbddsize( BddNode->HIGH ); + } +} + + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Num | +| | +\------------------------------------------------------------*/ + +long getbddnodenum( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + long NumberNode; + + NumberNode = flagbddnode( BddSystem, BddNode, BDD_FLAG_NUM_MASK ); + unflagbddnode( BddSystem, BddNode, BDD_FLAG_NUM_MASK ); + + return( NumberNode ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Size | +| | +\------------------------------------------------------------*/ + +long getbddnodesize( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + setbddlocalsystem( BddSystem ); + + BddFlagNumberNode = 0; + loc_getbddsize( BddNode ); + + return( BddFlagNumberNode ); +} diff --git a/alliance/src/bdd/src/bddflag.h b/alliance/src/bdd/src/bddflag.h new file mode 100644 index 00000000..f84b8ddd --- /dev/null +++ b/alliance/src/bdd/src/bddflag.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddflag.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_FLAG_H +# define BDD_FLAG_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddfraction.c b/alliance/src/bdd/src/bddfraction.c new file mode 100644 index 00000000..be588c17 --- /dev/null +++ b/alliance/src/bdd/src/bddfraction.c @@ -0,0 +1,113 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddfraction.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddfraction.h" +# include "bddassoc.h" +# include "bddapply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Fraction Bdd Node | +| | +\------------------------------------------------------------*/ + +static double loc_fractionbdd( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX < BDD_INDEX_MIN ) + { + if ( BddNode->INDEX == BDD_INDEX_ZERO ) + { + return( 0.0 ); + } + + return( 1.0 ); + } + + return( (double)( 0.5 * ( loc_fractionbdd( BddNode->HIGH ) + + loc_fractionbdd( BddNode->LOW ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fraction Bdd Node | +| | +\------------------------------------------------------------*/ + +double fractionbddnode( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + setbddlocalsystem( BddSystem ); + + return( loc_fractionbdd( BddNode ) ); +} diff --git a/alliance/src/bdd/src/bddfraction.h b/alliance/src/bdd/src/bddfraction.h new file mode 100644 index 00000000..6c47c0fc --- /dev/null +++ b/alliance/src/bdd/src/bddfraction.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddfraction.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_FRACTION_H +# define BDD_FRACTION_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddfree.c b/alliance/src/bdd/src/bddfree.c new file mode 100644 index 00000000..1b0852da --- /dev/null +++ b/alliance/src/bdd/src/bddfree.c @@ -0,0 +1,305 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddfree.c | +| | +| Date : 03.12.96 | +| | +| Bddhor : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddfree.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Free User Func | +| | +\------------------------------------------------------------*/ + +void freebdduserfunc( BddUserFunc ) + + bdduserfunc *BddUserFunc; +{ + autfreeheap( (char *)BddUserFunc, sizeof( bdduserfunc ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Heath | +| | +\------------------------------------------------------------*/ + +void freebddheath( BddHeath ) + + bddheath *BddHeath; +{ + autfreeheap( (char *)BddHeath, sizeof( bddheath ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Hash Node | +| | +\------------------------------------------------------------*/ + +void freebddhnode( HashNode ) + + bddhnode *HashNode; +{ + autfreeblock( (char *)HashNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Hash Oper | +| | +\------------------------------------------------------------*/ + +void freebddhoper( HashOper ) + + bddhoper *HashOper; +{ + autfreeblock( (char *)HashOper ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Hash Node Table | +| | +\------------------------------------------------------------*/ + +void freebddhnodetable( HashTable ) + + bddhnodetable *HashTable; +{ + autfreeheap( (char *)HashTable, sizeof( bddhnodetable ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Hash Oper Table | +| | +\------------------------------------------------------------*/ + +void freebddhopertable( HashTable ) + + bddhopertable *HashTable; +{ + autfreeblock( (char *)HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free BLock | +| | +\------------------------------------------------------------*/ + +void freebddblock( BddBlock ) + + bddblock *BddBlock; +{ + autfreeheap( (char *)BddBlock, sizeof( bddblock ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Node Block | +| | +\------------------------------------------------------------*/ + +void freebddnodeblock( BddNode ) + + bddnode *BddNode; +{ + autfreeblock( (char *)BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Variable Node | +| | +\------------------------------------------------------------*/ + +void freebddvarnode( BddVariableNode ) + + bddvarnode *BddVariableNode; +{ + autfreeblock( (char *)BddVariableNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Hash Variable Node | +| | +\------------------------------------------------------------*/ + +void freebddindexnode( BddIndexNode ) + + bddindexnode *BddIndexNode; +{ + autfreeblock( (char *)BddIndexNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Variable | +| | +\------------------------------------------------------------*/ + +void freebddvar( BddVariable ) + + bddvar *BddVariable; +{ + autfreeblock( (char *)BddVariable ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Index | +| | +\------------------------------------------------------------*/ + +void freebddindex( BddIndex ) + + bddindex *BddIndex; +{ + autfreeblock( (char *)BddIndex ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Assoc | +| | +\------------------------------------------------------------*/ + +void freebddassoc( BddAssoc ) + + bddassoc *BddAssoc; +{ + autfreeheap( (char *)BddAssoc, sizeof( bddassoc ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Assoc Node | +| | +\------------------------------------------------------------*/ + +void freebddassocnode( BddAssocNode ) + + bddassocnode *BddAssocNode; +{ + autfreeblock( (char *)BddAssocNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Name Input | +| | +\------------------------------------------------------------*/ + +void freebddnamein( NameIn ) + + bddnamein *NameIn; +{ + autfreeblock( (char *)NameIn ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Index Input | +| | +\------------------------------------------------------------*/ + +void freebddindexin( IndexIn ) + + bddindex *IndexIn; +{ + autfreeblock( (char *)IndexIn ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free System | +| | +\------------------------------------------------------------*/ + +void freebddsystem( BddSystem ) + + bddsystem *BddSystem; +{ + autfreeblock( (char *)BddSystem ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Free Circuit | +| | +\------------------------------------------------------------*/ + +void freebddcircuit( BddCircuit ) + + bddcircuit *BddCircuit; +{ + autfreeblock( (char *)BddCircuit ); +} diff --git a/alliance/src/bdd/src/bddfree.h b/alliance/src/bdd/src/bddfree.h new file mode 100644 index 00000000..2f626e78 --- /dev/null +++ b/alliance/src/bdd/src/bddfree.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddfree.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_FREE_H +# define BDD_FREE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddgarbage.c b/alliance/src/bdd/src/bddgarbage.c new file mode 100644 index 00000000..bdcd8211 --- /dev/null +++ b/alliance/src/bdd/src/bddgarbage.c @@ -0,0 +1,140 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddgarbage.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddgarbage.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Garbage Collect System | +| | +\------------------------------------------------------------*/ + +void garbagebddsystem( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddindex *VarToIndex; + bddvar NumberVar; + bddvar Variable; + long HashIndex; + + setbddlocalsystem( BddSystem ); + + resetbddhopertable( BddLocalSystem->HASH_OPER ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + IndexNode = BddLocalSystem->INDEX_NODE; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + HashTable = IndexNode[ VarToIndex[ Variable ] ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + HashNode->REF_INT = 0; + } + } + } + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + HashTable = IndexNode[ VarToIndex[ Variable ] ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + if ( ( HashNode->REF_INT ) || + ( HashNode->REF_EXT ) ) + { + incbddrefint( HashNode->HIGH ); + incbddrefint( HashNode->LOW ); + } + } + } + } + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + sweepbddvar( (bddsystem *)0, Variable, 0 ); + } +} diff --git a/alliance/src/bdd/src/bddgarbage.h b/alliance/src/bdd/src/bddgarbage.h new file mode 100644 index 00000000..859f4835 --- /dev/null +++ b/alliance/src/bdd/src/bddgarbage.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddgarbage.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_GARBAGE_H +# define BDD_GARBAGE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddheath.c b/alliance/src/bdd/src/bddheath.c new file mode 100644 index 00000000..d20bd3f7 --- /dev/null +++ b/alliance/src/bdd/src/bddheath.c @@ -0,0 +1,170 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddheath.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddheath.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variable | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Get Bdd Var Heath | +| | +\------------------------------------------------------------*/ + +bddheath *getbddheathvar( BddSystem, BddNode, Variable ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddvar Variable; +{ + bddheath *BddHeath; + bddnode *BddVarNode; + bddindex Index; + + checkbddvar( BddSystem, Variable, 1 ); + + Index = BddLocalSystem->VAR_TO_INDEX[ Variable ]; + BddVarNode = BddLocalSystem->VAR_NODE[ Index ]; + + BddHeath = allocbddheath(); + BddHeath->VAR = BddVarNode; + + BddHeath->PLUS = restrictbddnode( (bddsystem *)0, BddNode, Variable, BddLocalSystem->ONE ); + BddHeath->MINUS = restrictbddnode( (bddsystem *)0, BddNode, Variable, BddLocalSystem->ZERO ); + + return( BddHeath ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Heath | +| | +\------------------------------------------------------------*/ + +bddheath *getbddheath( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + chain_list *Support; + chain_list *ScanSupport; + bddheath *HeadHeath; + bddheath *BddHeath; + bddvar BddVar; + + setbddlocalsystem( BddSystem ); + + Support = getbddnodesupport( (bddsystem *)0, BddNode, BDD_SUPPORT_CHAIN ); + HeadHeath = (bddheath *)0; + + for ( ScanSupport = Support; + ScanSupport != (chain_list *)0; + ScanSupport = ScanSupport->NEXT ) + { + BddHeath = allocbddheath(); + BddHeath->NEXT = HeadHeath; + BddHeath->VAR = (bddnode *)( ScanSupport->DATA ); + + BddVar = BddLocalSystem->INDEX_TO_VAR[ BddHeath->VAR->INDEX ]; + BddHeath->PLUS = restrictbddnode( (bddsystem *)0, BddNode, BddVar, BddLocalSystem->ONE ); + BddHeath->MINUS = restrictbddnode( (bddsystem *)0, BddNode, BddVar, BddLocalSystem->ZERO ); + + HeadHeath = BddHeath; + } + + freechain( Support ); + + return( HeadHeath ); +} + +/*------------------------------------------------------------\ +| | +| Del Bdd Heath | +| | +\------------------------------------------------------------*/ + +void delbddheath( BddSystem, BddHeath ) + + bddsystem *BddSystem; + bddheath *BddHeath; +{ + bddheath *DelHeath; + + setbddlocalsystem( BddSystem ); + + while ( BddHeath != (bddheath *)0 ) + { + DelHeath = BddHeath; + BddHeath = BddHeath->NEXT; + + decbddrefext( DelHeath->PLUS ); + decbddrefext( DelHeath->MINUS ); + + freebddheath( DelHeath ); + } +} diff --git a/alliance/src/bdd/src/bddheath.h b/alliance/src/bdd/src/bddheath.h new file mode 100644 index 00000000..b10acb56 --- /dev/null +++ b/alliance/src/bdd/src/bddheath.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddheath.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_HEATH_H +# define BDD_HEATH_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddhnode.c b/alliance/src/bdd/src/bddhnode.c new file mode 100644 index 00000000..b9fca894 --- /dev/null +++ b/alliance/src/bdd/src/bddhnode.c @@ -0,0 +1,662 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddhnode.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include +# include "bddhnode.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long (*funcbddhnodesize )() = getbddhnodesize; + static long (*funcbddhnodekey )() = getbddhnodekey; + static long (*funcbddhnodeindex)() = getbddhnodeindex; + + long BDD_HNODE_STRETCH_FACTOR = HNODE_STRETCH_FACTOR; + long BDD_HNODE_RESIZE_FACTOR = HNODE_RESIZE_FACTOR; + long BDD_HNODE_MIN_FILL_FACTOR = HNODE_MIN_FILL_FACTOR; + long BDD_HNODE_MAX_SCAN = HNODE_MAX_SCAN; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Set Hash Size Function | +| | +\------------------------------------------------------------*/ + +void setbddhnodefunc( FuncSize, FuncKey, FuncIndex ) + + long (*FuncSize)(); + long (*FuncKey)(); + long (*FuncIndex)(); +{ + if ( FuncSize != 0 ) funcbddhnodesize = FuncSize; + else funcbddhnodesize = getbddhnodesize; + + if ( FuncKey != 0 ) funcbddhnodekey = FuncKey; + else funcbddhnodekey = getbddhnodekey; + + if ( FuncIndex != 0 ) funcbddhnodeindex = FuncIndex; + else funcbddhnodeindex = getbddhnodeindex; +} + +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Get Hash Size | +| | +\------------------------------------------------------------*/ + +long getbddhnodesize( Size ) + + long Size; +{ + int Index; + + for ( Index = 0; Index < AUT_MAX_PRIME_NUMBER; Index++ ) + { + if ( AUT_HASH_PRIME_NUMBER[ Index ] > Size ) + { + return( AUT_HASH_PRIME_NUMBER[ Index ] ); + } + } + + if ( ( Size & 1 ) == 0 ) Size++; + + return( Size ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Get Hash Key | +| | +\------------------------------------------------------------*/ + +long getbddhnodekey( Table, BddNode ) + + bddhnodetable *Table; + bddnode *BddNode; +{ + return( ( ((unsigned long)BddNode->HIGH >> 2 ) + + ((unsigned long)BddNode->LOW << 1 ) ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Get Hash Index | +| | +\------------------------------------------------------------*/ + +long getbddhnodeindex( Table, BddNode, Index ) + + bddhnodetable *Table; + bddnode *BddNode; + long Index; +{ + return( ( ((unsigned long)Index ) + + ((unsigned long)Index << 2 ) + + ((unsigned long)BddNode->HIGH ) + + ((unsigned long)BddNode->LOW << 1 ) ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Check Hash Node | +| | +\------------------------------------------------------------*/ + +int checkbddhnode( HashNode, Severity ) + + bddnode *HashNode; + int Severity; +{ + if ( ( HashNode == BDD_HASH_NODE_EMPTY ) || + ( HashNode == BDD_HASH_NODE_DELETED ) ) + { + if ( Severity ) + { + bdderror( BDD_HNODE_KEY_ERROR, HashNode ); + } + + return( 0 ); + } + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Create Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Create Hash Table | +| | +\------------------------------------------------------------*/ + +bddhnodetable *createbddhnodetable( Length ) + + long Length; +{ + bddhnodetable *HashTable; + bddhnode *Table; + + if ( Length < 0 ) + { + bdderror( BDD_HNODE_SIZE_ERROR, Length ); + } + + Length = (*funcbddhnodesize)( Length ); + + HashTable = allocbddhnodetable(); + Table = allocbddhnode( Length ); + + HashTable->TABLE = Table; + HashTable->TABLE_SIZE = Length; + + return( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Destroy Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Destroy Hash Table | +| | +\------------------------------------------------------------*/ + +void destroybddhnodetable( HashTable ) + + bddhnodetable *HashTable; +{ + freebddhnode( HashTable->TABLE ); + freebddhnodetable( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Reset Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Reset Hash Table | +| | +\------------------------------------------------------------*/ + +void resetbddhnodetable( HashTable ) + + bddhnodetable *HashTable; +{ + if ( HashTable->NUMBER_NODE > 0 ) + { + memset( (void *)HashTable->TABLE, 0, + (size_t)HashTable->TABLE_SIZE * sizeof( bddhnode ) ); + + HashTable->NUMBER_NODE = 0; + } + + HashTable->NUMBER_ADD = 0; + HashTable->NUMBER_SCAN = 0; + HashTable->NUMBER_STRETCH = 0; +} + +/*------------------------------------------------------------\ +| | +| Stretch Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Resize Hash Table | +| | +\------------------------------------------------------------*/ + +void resizebddhnodetable( HashTable ) + + bddhnodetable *HashTable; +{ + bddhnode *NewTable; + bddhnode *Table; + long NewLength; + long Length; + long NumberNode; + + Length = HashTable->TABLE_SIZE; + NumberNode = HashTable->NUMBER_NODE; + + if ( NumberNode >= ( Length * BDD_HNODE_MIN_FILL_FACTOR ) / 100 ) + { + return; + } + + Table = HashTable->TABLE; + NewLength = (*funcbddhnodesize)( NumberNode * BDD_HNODE_RESIZE_FACTOR / 100 ); + NewTable = allocbddhnode( NewLength ); + + HashTable->TABLE = NewTable; + HashTable->TABLE_SIZE = NewLength; + HashTable->NUMBER_NODE = 0; + HashTable->NUMBER_RESIZE += 1; + + while ( Length > 0 ) + { + Length = Length - 1; + + if ( ( Table[ Length ] != BDD_HASH_NODE_EMPTY ) && + ( Table[ Length ] != BDD_HASH_NODE_DELETED ) ) + { + addbddhnode( HashTable, Table[ Length ] ); + } + } + + freebddhnode( Table ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Stretch Hash Table | +| | +\------------------------------------------------------------*/ + +void stretchbddhnodetable( HashTable ) + + bddhnodetable *HashTable; +{ + bddhnode *NewTable; + bddhnode *Table; + long NewLength; + long Length; + + Length = HashTable->TABLE_SIZE; + Table = HashTable->TABLE; + NewLength = (*funcbddhnodesize)( Length * BDD_HNODE_STRETCH_FACTOR / 100 ); + NewTable = allocbddhnode( NewLength ); + + HashTable->TABLE = NewTable; + HashTable->TABLE_SIZE = NewLength; + HashTable->NUMBER_NODE = 0; + HashTable->NUMBER_STRETCH += 1; + + while ( Length > 0 ) + { + Length = Length - 1; + + if ( ( Table[ Length ] != BDD_HASH_NODE_EMPTY ) && + ( Table[ Length ] != BDD_HASH_NODE_DELETED ) ) + { + addbddhnode( HashTable, Table[ Length ] ); + } + } + + freebddhnode( Table ); +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Add Hash Element | +| | +\------------------------------------------------------------*/ + +bddnode *addbddhnode( HashTable, BddNode ) + + bddhnodetable *HashTable; + bddnode *BddNode; +{ + bddnode *HashNode; + long HashIndex; + long Deleted; + long NumberScan; + char Stop; + + check_bddhnode( BddNode ); + + HashIndex = (*funcbddhnodekey)( HashTable, BddNode ); + Deleted = -1; + + NumberScan = 0; + Stop = 0; + + HashTable->NUMBER_ADD++; + + do + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( HashNode == BDD_HASH_NODE_DELETED ) + { + if ( Deleted == -1 ) Deleted = HashIndex; + } + else + if ( ( HashNode == BDD_HASH_NODE_EMPTY ) || + ( ( HashNode->INDEX == BddNode->INDEX ) && + ( HashNode->HIGH == BddNode->HIGH ) && + ( HashNode->LOW == BddNode->LOW ) ) ) + { + if ( HashNode == BDD_HASH_NODE_EMPTY ) + { + HashTable->NUMBER_NODE++; + + if ( Deleted != -1 ) + { + HashIndex = Deleted; + } + + HashNode = BddNode; + } + else + if ( Deleted != -1 ) + { + HashTable->TABLE[ HashIndex ] = BDD_HASH_NODE_DELETED; + + HashIndex = Deleted; + } + + Stop = 1; + } + + NumberScan += 1; + + if ( Stop == 0 ) + { + if ( NumberScan > BDD_HNODE_MAX_SCAN ) + { + if ( Deleted != -1 ) + { + HashTable->TABLE[ Deleted ] = BDD_HASH_NODE_EMPTY; + HashIndex = Deleted; + Deleted = -1; + } + else + { + stretchbddhnodetable( HashTable ); + + HashIndex = (*funcbddhnodekey)( HashTable, BddNode ); + NumberScan = 0; + } + } + else + { + HashIndex = (*funcbddhnodeindex)( HashTable, BddNode, HashIndex ); + } + } + } + while ( Stop == 0 ); + + HashTable->NUMBER_SCAN += NumberScan; + + HashTable->TABLE[ HashIndex ] = HashNode; + + return( HashNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Del Hash Element | +| | +\------------------------------------------------------------*/ + +int delbddhnode( HashTable, BddNode ) + + bddhnodetable *HashTable; + bddnode *BddNode; +{ + bddnode *HashNode; + long HashIndex; + int NumberScan; + + check_bddhnode( BddNode ); + + HashIndex = (*funcbddhnodekey)( HashTable, BddNode ); + NumberScan = 0; + + do + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( HashNode == BDD_HASH_NODE_EMPTY ) + { + return( 0 ); + } + + if ( ( HashNode != BDD_HASH_NODE_DELETED ) && + ( HashNode->INDEX == BddNode->INDEX ) && + ( HashNode->HIGH == BddNode->HIGH ) && + ( HashNode->LOW == BddNode->LOW ) ) + { + HashTable->NUMBER_NODE--; + + HashTable->TABLE[ HashIndex ] = BDD_HASH_NODE_DELETED; + + HashTable->NUMBER_SCAN += NumberScan + 1; + + return( 1 ); + } + + NumberScan += 1; + HashIndex = (*funcbddhnodeindex)( HashTable, BddNode, HashIndex ); + + } + while ( NumberScan <= BDD_HNODE_MAX_SCAN ); + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Hash Node | +| | +\------------------------------------------------------------*/ + +void viewbddhnode( HashNode ) + + bddnode *HashNode; +{ + fprintf( stdout, "Node INDEX: %ld MARK: %ld REF_EXT: %ld REF_INT: %ld\n", + (long)( HashNode->INDEX ), + (long)( HashNode->MARK ), + (long)( HashNode->REF_EXT ), + (long)( HashNode->REF_INT ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Hash Table | +| | +\------------------------------------------------------------*/ + +void viewbddhnodetable( HashTable, FuncView ) + + bddhnodetable *HashTable; + void (*FuncView)(); +{ + bddnode *HashNode; + long HashIndex; + + fprintf( stdout, "--> HashNodeTable\n" ); + fprintf( stdout, " SIZE : %ld\n", HashTable->TABLE_SIZE ); + fprintf( stdout, " NODE : %ld\n", HashTable->NUMBER_NODE ); + fprintf( stdout, " STRETCH : %ld\n", HashTable->NUMBER_STRETCH ); + fprintf( stdout, " RESIZE : %ld\n", HashTable->NUMBER_RESIZE ); + fprintf( stdout, " SCAN : %ld\n", HashTable->NUMBER_SCAN ); + fprintf( stdout, " ADD : %ld\n", HashTable->NUMBER_ADD ); + + if ( FuncView ) + { + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + fprintf( stdout, " INDEX: %10ld ", HashIndex ); + + (*FuncView)( HashNode ); + } + } + } + + fprintf( stdout, "<-- HashNodeTable\n" ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Index Node | +| | +\------------------------------------------------------------*/ + +void viewbddindexnode( BddSystem, FuncView ) + + bddsystem *BddSystem; + void (*FuncView)(); +{ + bddindexnode *IndexNode; + bddindex Index; + bddindex NumberIndex; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + IndexNode = BddSystem->INDEX_NODE; + NumberIndex = BddSystem->NUMBER_INDEX; + + fprintf( stdout, "--> BddIndexNode\n" ); + + for ( Index = 0; Index < NumberIndex; Index++ ) + { + fprintf( stdout, "--> INDEX_NODE[ %d ]\n", Index ); + + viewbddhnodetable( IndexNode[ Index ], FuncView ); + + fprintf( stdout, "<-- INDEX_NODE[ %d ]\n", Index ); + } + + fprintf( stdout, "<-- BddIndexNode\n" ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Variable Node | +| | +\------------------------------------------------------------*/ + +void viewbddvarnode( BddSystem, FuncView ) + + bddsystem *BddSystem; + void (*FuncView)(); +{ + bddvarnode *VarNode; + bddindex Index; + bddindex NumberIndex; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + VarNode = BddSystem->VAR_NODE; + NumberIndex = BddSystem->NUMBER_INDEX; + + fprintf( stdout, "--> BddVarNode\n" ); + + for ( Index = 0; Index < NumberIndex; Index++ ) + { + fprintf( stdout, "--> VAR_NODE[ %d ] : ", Index ); + + if ( FuncView ) + { + (*FuncView)( VarNode[ Index ] ); + } + else + { + fprintf( stdout, "\n" ); + } + } + + fprintf( stdout, "<-- BddVarNode\n" ); +} diff --git a/alliance/src/bdd/src/bddhnode.h b/alliance/src/bdd/src/bddhnode.h new file mode 100644 index 00000000..13cc2215 --- /dev/null +++ b/alliance/src/bdd/src/bddhnode.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddhnode.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_HNODE_H +# define BDD_HNODE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define HNODE_STRETCH_FACTOR 150 +# define HNODE_RESIZE_FACTOR 175 +# define HNODE_MIN_FILL_FACTOR 20 +# define HNODE_MAX_SCAN 30 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define check_bddhnode( N ) \ + \ + do { if ( ( (N) == BDD_HASH_NODE_EMPTY ) || \ + ( (N) == BDD_HASH_NODE_DELETED ) ) \ + { \ + bdderror( BDD_HNODE_KEY_ERROR, (N) ); \ + \ + } } while (0) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void resizebddhnodetable __P((bddhnodetable *HashTable)); + +# endif diff --git a/alliance/src/bdd/src/bddhoper.c b/alliance/src/bdd/src/bddhoper.c new file mode 100644 index 00000000..19c94b32 --- /dev/null +++ b/alliance/src/bdd/src/bddhoper.c @@ -0,0 +1,422 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddhoper.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include +# include "bddhoper.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long (*funcbddhopersize )() = getbddhopersize; + static long (*funcbddhoperkey )() = getbddhoperkey; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Set Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Set Hash Size Function | +| | +\------------------------------------------------------------*/ + +void setbddhoperfunc( FuncSize, FuncKey ) + + long (*FuncSize)(); + long (*FuncKey)(); +{ + if ( FuncSize != 0 ) funcbddhopersize = FuncSize; + else funcbddhopersize = getbddhopersize; + + if ( FuncKey != 0 ) funcbddhoperkey = FuncKey; + else funcbddhoperkey = getbddhoperkey; +} + +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Get Hash Size | +| | +\------------------------------------------------------------*/ + +long getbddhopersize( Size ) + + long Size; +{ + int Index; + + for ( Index = 0; Index < AUT_MAX_PRIME_NUMBER; Index++ ) + { + if ( AUT_HASH_PRIME_NUMBER[ Index ] > Size ) + { + return( AUT_HASH_PRIME_NUMBER[ Index ] ); + } + } + + if ( ( Size & 1 ) == 0 ) Size++; + + return( Size ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Get Hash Key | +| | +\------------------------------------------------------------*/ + +long getbddhoperkey( Table, Oper, BddLeft, BddRight ) + + bddhopertable *Table; + long Oper; + bddnode *BddLeft; + bddnode *BddRight; +{ + return( ( ((unsigned long)Oper ) + + ((unsigned long)BddLeft >> 1 ) + + ((unsigned long)BddRight << 5 ) ) % Table->TABLE_SIZE ); +} + +/*------------------------------------------------------------\ +| | +| Create Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Create Hash Oper Table | +| | +\------------------------------------------------------------*/ + +bddhopertable *createbddhopertable( Length ) + + long Length; +{ + bddhopertable *HashTable; + bddhoper *Table; + + if ( Length <= 0 ) + { + bdderror( BDD_HOPER_SIZE_ERROR, Length ); + } + + Length = (*funcbddhopersize)( Length ); + + HashTable = allocbddhopertable(); + Table = allocbddhoper( Length ); + + HashTable->TABLE = Table; + HashTable->TABLE_SIZE = Length; + + return( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Destroy Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Destroy Hash Oper Table | +| | +\------------------------------------------------------------*/ + +void destroybddhopertable( HashTable ) + + bddhopertable *HashTable; +{ + freebddhoper( HashTable->TABLE ); + freebddhopertable( HashTable ); +} + +/*------------------------------------------------------------\ +| | +| Reset Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Reset Hash Oper Table | +| | +\------------------------------------------------------------*/ + +void resetbddhopertable( HashTable ) + + bddhopertable *HashTable; +{ + bddassoc *ScanAssoc; + + if ( HashTable->NUMBER_OPER > 0 ) + { + memset( (void *)HashTable->TABLE, 0, + (size_t)HashTable->TABLE_SIZE * sizeof( bddhoper ) ); + + HashTable->NUMBER_OPER = 0; + HashTable->NUMBER_RESET++; + + if ( BddLocalSystem->ASSOC_RESET ) + { + BddLocalSystem->ASSOC_RESET = 0; + + for ( ScanAssoc = BddLocalSystem->ASSOC; + ScanAssoc != (bddassoc *)0; + ScanAssoc = ScanAssoc->NEXT ) + { + ScanAssoc->CACHE = 0; + } + } + + execbdduserfunc( BddLocalSystem, BDD_FUNC_RESET_HASH_OPER ); + } + + HashTable->NUMBER_ADD = 0; + HashTable->NUMBER_HIT = 0; + HashTable->NUMBER_MISS = 0; +} + +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Add Hash Element | +| | +\------------------------------------------------------------*/ + +bddhoper *addbddhoper( HashTable, Oper, BddLeft, BddRight, BddFather ) + + bddhopertable *HashTable; + long Oper; + bddnode *BddLeft; + bddnode *BddRight; + bddnode *BddFather; +{ + bddhoper *HashOper; + bddnode *BddSwap; + long HashIndex; + + if ( HashTable->TABLE_FREEZE ) return( (bddhoper *)0 ); + + if ( ( BddLeft == (bddnode *)0 ) || + ( BddRight == (bddnode *)0 ) ) + { + bdderror( BDD_HOPER_KEY_ERROR, 0 ); + } + + if ( ( BddLeft < BddRight ) && + ( ! ( Oper & BDD_OPER_MASK ) ) ) + { + BddSwap = BddRight; + BddRight = BddLeft; + BddLeft = BddSwap; + } + + HashIndex = (*funcbddhoperkey)( HashTable, Oper, BddLeft, BddRight ); + HashOper = &HashTable->TABLE[ HashIndex ]; + + HashTable->NUMBER_ADD++; + + if ( HashOper->LEFT == (bddnode *)0 ) + { + HashTable->NUMBER_OPER++; + } + + HashOper->LEFT = BddLeft; + HashOper->RIGHT = BddRight; + HashOper->OPERATOR = Oper; + HashOper->FATHER = BddFather; + + return( HashOper ); +} + +/*------------------------------------------------------------\ +| | +| Search Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Search Hash Element | +| | +\------------------------------------------------------------*/ + +bddhoper *searchbddhoper( HashTable, Oper, BddLeft, BddRight ) + + bddhopertable *HashTable; + long Oper; + bddnode *BddLeft; + bddnode *BddRight; +{ + bddhoper *HashOper; + bddnode *BddSwap; + long HashIndex; + + if ( HashTable->TABLE_FREEZE ) return( (bddhoper *)0 ); + + if ( ( BddLeft == (bddnode *)0 ) || + ( BddRight == (bddnode *)0 ) ) + { + bdderror( BDD_HOPER_KEY_ERROR, 0 ); + } + + if ( ( BddLeft < BddRight ) && + ( ! ( Oper & BDD_OPER_MASK ) ) ) + { + BddSwap = BddRight; + BddRight = BddLeft; + BddLeft = BddSwap; + } + + HashIndex = (*funcbddhoperkey)( HashTable, Oper, BddLeft, BddRight ); + HashOper = &HashTable->TABLE[ HashIndex ]; + + if ( ( HashOper->OPERATOR == Oper ) && + ( HashOper->LEFT == BddLeft ) && + ( HashOper->RIGHT == BddRight ) ) + { + HashTable->NUMBER_HIT++; + + return( HashOper ); + } + + HashTable->NUMBER_MISS++; + + return( (bddhoper *)0 ); +} + + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd View Hash Oper | +| | +\------------------------------------------------------------*/ + +void viewbddhoper( HashOper ) + + bddhoper *HashOper; +{ + fprintf( stdout, "OPERATOR: %lx LEFT : %lx RIGHT : %lx FATHER : %lx\n", + HashOper->OPERATOR, + (long)HashOper->LEFT, + (long)HashOper->RIGHT, + (long)HashOper->FATHER ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Hash Oper Table | +| | +\------------------------------------------------------------*/ + +void viewbddhopertable( HashTable, FuncView ) + + bddhopertable *HashTable; + void (*FuncView)(); +{ + bddhoper *HashOper; + long HashIndex; + + fprintf( stdout, "--> HashOperTable\n" ); + fprintf( stdout, " SIZE : %ld\n", HashTable->TABLE_SIZE ); + fprintf( stdout, " FREEZE : %ld\n", HashTable->TABLE_FREEZE ); + fprintf( stdout, " OPER : %ld\n", HashTable->NUMBER_OPER ); + fprintf( stdout, " ADD : %ld\n", HashTable->NUMBER_ADD ); + fprintf( stdout, " HIT : %ld\n", HashTable->NUMBER_HIT ); + fprintf( stdout, " MISS : %ld\n", HashTable->NUMBER_MISS ); + fprintf( stdout, " RESET : %ld\n", HashTable->NUMBER_RESET ); + + if ( FuncView ) + { + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashOper = &HashTable->TABLE[ HashIndex ]; + + if ( HashOper->LEFT != (bddnode *)0 ) + { + fprintf( stdout, " INDEX: %10ld ", HashIndex ); + + (*FuncView)( HashOper ); + } + } + } + + fprintf( stdout, "<-- HashOperTable\n" ); +} diff --git a/alliance/src/bdd/src/bddhoper.h b/alliance/src/bdd/src/bddhoper.h new file mode 100644 index 00000000..c7e3c223 --- /dev/null +++ b/alliance/src/bdd/src/bddhoper.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddhoper.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_HOPER_H +# define BDD_HOPER_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddimply.c b/alliance/src/bdd/src/bddimply.c new file mode 100644 index 00000000..a9edaf87 --- /dev/null +++ b/alliance/src/bdd/src/bddimply.c @@ -0,0 +1,229 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddimply.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include + +# include "bddapply.h" +# include "bddimply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Intersect Bdd Node | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_intersectbdd( BddNode1, BddNode2 ) + + bddnode *BddNode1; + bddnode *BddNode2; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddindex Index1; + bddindex Index2; + + Index1 = BddNode1->INDEX; + Index2 = BddNode2->INDEX; + + if ( Index1 < BDD_INDEX_MIN ) + { + if ( Index1 == BDD_INDEX_ZERO ) + { + return( BddLocalSystem->ZERO ); + } + + return( incbddrefext( BddNode2 ) ); + } + + if ( Index2 < BDD_INDEX_MIN ) + { + if ( Index2 == BDD_INDEX_ZERO ) + { + return( BddLocalSystem->ZERO ); + } + + return( incbddrefext( BddNode1 ) ); + } + + if ( BddNode1 == BddNode2 ) + { + return( incbddrefext( BddNode1 ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_INTERSECT, BddNode1, BddNode2 ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( Index1 == Index2 ) + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1->HIGH, BddNode2->HIGH ) ); + + if ( BddNode != BddLocalSystem->ZERO ) + { + BddNode = addbddnode( (bddsystem *)0, Index1, + BddNode, BddLocalSystem->ZERO ); + } + else + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1->LOW, BddNode2->LOW ) ); + + BddNode = addbddnode( (bddsystem *)0, Index1, + BddLocalSystem->ZERO, BddNode ); + } + } + else + if ( BddLocalSystem->INDEX_TO_VAR[ Index1 ] > + BddLocalSystem->INDEX_TO_VAR[ Index2 ] ) + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1, BddNode2->HIGH ) ); + + if ( BddNode != BddLocalSystem->ZERO ) + { + BddNode = addbddnode( (bddsystem *)0, Index2, + BddNode, BddLocalSystem->ZERO ); + } + else + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1, BddNode2->LOW ) ); + + BddNode = addbddnode( (bddsystem *)0, Index2, + BddLocalSystem->ZERO, BddNode ); + } + } + else + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1->HIGH, BddNode2 ) ); + + if ( BddNode != BddLocalSystem->ZERO ) + { + BddNode = addbddnode( (bddsystem *)0, Index1, + BddNode, BddLocalSystem->ZERO ); + } + else + { + BddNode = decbddrefext( loc_intersectbdd( BddNode1->LOW, BddNode2 ) ); + + BddNode = addbddnode( (bddsystem *)0, Index1, + BddLocalSystem->ZERO, BddNode ); + } + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_INTERSECT, + BddNode, BddNode1, BddNode2 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Imply Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *implybddnode( BddSystem, BddNode1, BddNode2 ) + + bddsystem *BddSystem; + bddnode *BddNode1; + bddnode *BddNode2; +{ + setbddlocalsystem( BddSystem ); + + BddNode2 = decbddrefext( loc_applybddnot( BddNode2 ) ); + BddNode1 = loc_intersectbdd( BddNode1, BddNode2 ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode1 ); +} + +/*------------------------------------------------------------\ +| | +| Intersect Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *intersectbddnode( BddSystem, BddNode1, BddNode2 ) + + bddsystem *BddSystem; + bddnode *BddNode1; + bddnode *BddNode2; +{ + setbddlocalsystem( BddSystem ); + + BddNode1 = loc_intersectbdd( BddNode1, BddNode2 ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode1 ); +} diff --git a/alliance/src/bdd/src/bddimply.h b/alliance/src/bdd/src/bddimply.h new file mode 100644 index 00000000..112736a0 --- /dev/null +++ b/alliance/src/bdd/src/bddimply.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddimply.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_IMPLY_H +# define BDD_IMPLY_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddlog.c b/alliance/src/bdd/src/bddlog.c new file mode 100644 index 00000000..9e5a31f2 --- /dev/null +++ b/alliance/src/bdd/src/bddlog.c @@ -0,0 +1,184 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddlog.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include "bddlog.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Get Bdd Node One | +| | +\------------------------------------------------------------*/ + +bddnode *getlogbddnodeone() +{ + return( BddLocalSystem->ONE ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Zero | +| | +\------------------------------------------------------------*/ + +bddnode *getlogbddnodezero() +{ + return( BddLocalSystem->ZERO ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Term | +| | +\------------------------------------------------------------*/ + +bddnode *getlogbddnodeterm( Index ) + + bddindex Index; +{ + if ( Index < BddLocalSystem->NUMBER_INDEX ) + { + return( getbddvarnodebyindex( (bddsystem *)0, Index ) ); + } + + return( addbddvarfirst( (bddsystem *)0 ) ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Not | +| | +\------------------------------------------------------------*/ + +bddnode *getlogbddnodenot( BddNode ) + + bddnode *BddNode; +{ + return( applybddnodenot( (bddsystem *)0, BddNode ) ); +} + +/*------------------------------------------------------------\ +| | +| Apply Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *applylogbddnode( Oper, BddNode1, BddNode2 ) + + long Oper; + bddnode *BddNode1; + bddnode *BddNode2; +{ + return( applybddnode( (bddsystem *)0, Oper, BddNode1, BddNode2 ) ); +} + +/*------------------------------------------------------------\ +| | +| Convert Bdd Node | +| | +\------------------------------------------------------------*/ + +ablexpr *convertlogbddnode( BddCircuit, BddNode ) + + bddcircuit *BddCircuit; + bddnode *BddNode; +{ + return( convertbddnodeabl( (bddsystem *)0, BddCircuit->NAME_IN, + (bddindex *)0, BddNode ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Circuit Input | +| | +\------------------------------------------------------------*/ + +short addlogbddcircuitin( BddCircuit, Name ) + + bddcircuit *BddCircuit; + char *Name; +{ + bddnode *BddNode; + + BddNode = addbddcircuitin( BddCircuit, Name, 0, BDD_IN_MODE_LAST ); + + if ( BddNode == (bddnode *)0 ) + { + return( 0 ); + } + + return( BddNode->INDEX ); +} + diff --git a/alliance/src/bdd/src/bddlog.h b/alliance/src/bdd/src/bddlog.h new file mode 100644 index 00000000..71dd0b06 --- /dev/null +++ b/alliance/src/bdd/src/bddlog.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddlog.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_LOG_H +# define BDD_LOG_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddmark.c b/alliance/src/bdd/src/bddmark.c new file mode 100644 index 00000000..94efbbea --- /dev/null +++ b/alliance/src/bdd/src/bddmark.c @@ -0,0 +1,116 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddmark.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddmark.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static long BddMarkNumberNode = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +void +#ifndef __STDC__ +newbddsystemmark( bddsystem *BddSystem ) +#else +newbddsystemmark( BddSystem ) + + bddsystem *BddSystem; +#endif +{ + setbddlocalsystem( BddSystem ); + BddLocalSystem->MARK += 1; +} + +void +#ifndef __STDC__ +setbddnodemark( bddsystem *BddSystem, bddnode *BddNode ) +#else +setbddnodemark( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +#endif +{ + setbddlocalsystem( BddSystem ); + BddNode->MARK = BddLocalSystem->MARK; +} + +int +#ifndef __STDC__ +testbddnodemark( bddsystem *BddSystem, bddnode *BddNode ) +#else +testbddnodemark( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +#endif +{ + setbddlocalsystem( BddSystem ); + return BddNode->MARK == BddLocalSystem->MARK; +} + diff --git a/alliance/src/bdd/src/bddmark.h b/alliance/src/bdd/src/bddmark.h new file mode 100644 index 00000000..e8d7ae5b --- /dev/null +++ b/alliance/src/bdd/src/bddmark.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddmark.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_MARK_H +# define BDD_MARK_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddnode.c b/alliance/src/bdd/src/bddnode.c new file mode 100644 index 00000000..c250c8df --- /dev/null +++ b/alliance/src/bdd/src/bddnode.c @@ -0,0 +1,386 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddnode.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include +# include "bddnode.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static bddnode BddTerminalHighNode = + { + (bddnode *)0, /* HIGH */ + (bddnode *)0, /* LOW */ + BDD_MAX_INDEX, /* INDEX */ + (bddmark)0, /* MARK */ + (bddflag)0, /* FLAG */ + BDD_MAX_REF, /* REF_EXT */ + BDD_MAX_REF /* REF_INT */ + }; + + static bddnode BddTerminalLowNode = + { + (bddnode *)0, /* HIGH */ + (bddnode *)0, /* LOW */ + BDD_MAX_INDEX, /* INDEX */ + (bddmark)0, /* MARK */ + (bddflag)0, /* FLAG */ + BDD_MAX_REF, /* REF_EXT */ + BDD_MAX_REF /* REF_INT */ + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *addbddnode( BddSystem, Index, High, Low ) + + bddsystem *BddSystem; + bddindex Index; + bddnode *High; + bddnode *Low; +{ + bddblock *BddBlock; + bddnode *BddNode; + bddnode *NewBddNode; + + setbddlocalsystem( BddSystem ); + + if ( Index >= BddLocalSystem->NUMBER_INDEX ) + { + bdderror( BDD_BAD_INDEX_ERROR, Index ); + } + + if ( ( ! IsBddSystemSwapVar( BddLocalSystem ) ) && + ( IsBddSystemExplosionOn( BddLocalSystem ) ) && + ( BddLocalSystem->EXPLOSION_LIMIT <= BddLocalSystem->NUMBER_NODE ) ) + { + if ( ! IsBddSystemExplosion( BddLocalSystem ) ) + { + BddLocalSystem->HASH_OPER->TABLE_FREEZE; + + if ( BddLocalSystem->EXPLOSION_FUNC != NULL ) + { + BddLocalSystem->EXPLOSION_FUNC( BddLocalSystem ); + } + else + { + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_DYNAMIC_EXPLOSION_WARNING, + BddLocalSystem->NUMBER_NODE, BddLocalSystem->EXPLOSION_LIMIT ); + } + } + + SetBddSystemExplosion( BddLocalSystem ); + } + + return( BddLocalSystem->ZERO ); + } + + if ( High == (bddnode *)0 ) High = &BddTerminalHighNode; + if ( Low == (bddnode *)0 ) Low = &BddTerminalLowNode; + + if ( High == Low ) + { + return( incbddrefext( High ) ); + } + + BddBlock = BddLocalSystem->BLOCK; + + if ( BddLocalSystem->NODE_FREE == (bddnode *)0 ) + { + if ( ( BddBlock == (bddblock *)0 ) || + ( BddBlock->NODE_FREE == 0 ) ) + { + BddBlock = addbddblock( (bddsystem *)0 ); + } + + BddBlock->NODE_FREE--; + BddNode = &BddBlock->NODE[ BddBlock->NODE_FREE ]; + } + else + { + BddNode = BddLocalSystem->NODE_FREE; + BddLocalSystem->NODE_FREE = BddNode->HIGH; + + BddLocalSystem->NUMBER_FREE--; + } + + BddNode->HIGH = High; + BddNode->LOW = Low; + BddNode->INDEX = Index; + + NewBddNode = addbddhnode( BddLocalSystem->INDEX_NODE[ Index ], BddNode ); + + if ( NewBddNode == BddNode ) + { + incbddrefint( High ); + incbddrefint( Low ); + BddNode->MARK = 0; + BddNode->FLAG = 0; + + BddLocalSystem->NUMBER_NODE++; + + if ( BddLocalSystem->NUMBER_NODE > BddLocalSystem->TOP_NODE ) + { + BddLocalSystem->TOP_NODE = BddLocalSystem->NUMBER_NODE; + } + } + else + { + BddNode->LOW = (bddnode *)0; + BddNode->INDEX = 0; + + BddNode->HIGH = BddLocalSystem->NODE_FREE; + BddLocalSystem->NODE_FREE = BddNode; + + BddLocalSystem->NUMBER_FREE++; + } + + return( incbddrefext( NewBddNode ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Add List Node | +| | +\------------------------------------------------------------*/ + +chain_list *addbddnodelist( BddSystem, HeadList, BddNode ) + + bddsystem *BddSystem; + chain_list *HeadList; + bddnode *BddNode; +{ + chain_list **PrevList; + chain_list *ScanList; + chain_list *NewList; + bddvar *IndexToVar; + bddvar Variable; + bddvar ScanVar; + + setbddlocalsystem( BddSystem ); + + NewList = addchain( (chain_list *)0, (void *)incbddrefext( BddNode ) ); + + if ( HeadList == (chain_list *)0 ) + { + return( NewList ); + } + + IndexToVar = BddLocalSystem->INDEX_TO_VAR; + + PrevList = &HeadList; + ScanList = HeadList; + Variable = IndexToVar[ BddNode->INDEX ]; + + while ( ScanList != (chain_list *)0 ) + { + ScanVar = IndexToVar[ ((bddnode *)ScanList->DATA)->INDEX ]; + + if ( Variable <= ScanVar ) break; + + PrevList = &ScanList->NEXT; + ScanList = ScanList->NEXT; + } + + NewList->NEXT = ScanList; + *PrevList = NewList; + + return( HeadList ); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Bdd Del Node | +| | +\------------------------------------------------------------*/ + +static void loc_delbdd( BddNode ) + + bddnode *BddNode; +{ + if ( ( BddNode->REF_INT == 0 ) && + ( BddNode->REF_EXT == 0 ) ) + { + decbddrefint( BddNode->HIGH ); + decbddrefint( BddNode->LOW ); + + loc_delbdd( BddNode->HIGH ); + loc_delbdd( BddNode->LOW ); + + delbddhnode( BddLocalSystem->INDEX_NODE[ BddNode->INDEX ], BddNode ); + + memset( (void *)BddNode, 0, sizeof( bddnode ) ); + + BddNode->HIGH = BddLocalSystem->NODE_FREE; + BddLocalSystem->NODE_FREE = BddNode; + BddLocalSystem->NUMBER_NODE--; + BddLocalSystem->NUMBER_FREE++; + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Del Node | +| | +\------------------------------------------------------------*/ + +void delbddnode( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + long NumberNode; + + setbddlocalsystem( BddSystem ); + + NumberNode = BddLocalSystem->NUMBER_NODE; + + loc_delbdd( BddNode ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + resetbddhopertable( BddLocalSystem->HASH_OPER ); + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Del List Node | +| | +\------------------------------------------------------------*/ + +void delbddnodelist( BddSystem, HeadList ) + + bddsystem *BddSystem; + chain_list *HeadList; +{ + chain_list *ScanList; + + setbddlocalsystem( BddSystem ); + + for ( ScanList = HeadList; + ScanList != (chain_list *)0; + ScanList = ScanList->NEXT ) + { + decbddrefext( (bddnode *)ScanList->DATA ); + } + + freechain( HeadList ); +} + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd View Node | +| | +\------------------------------------------------------------*/ + +void viewbddnode( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + fprintf( stdout, + "Node VAR: %ld INDEX: %ld MARK: %ld FLAG: %ld REF_EXT: %ld REF_INT: %ld\n", + (long)( BddSystem->INDEX_TO_VAR[ BddNode->INDEX ] ), + (long)( BddNode->INDEX ), + (long)( BddNode->MARK ), + (long)( BddNode->FLAG ), + (long)( BddNode->REF_EXT ), + (long)( BddNode->REF_INT ) ); +} diff --git a/alliance/src/bdd/src/bddnode.h b/alliance/src/bdd/src/bddnode.h new file mode 100644 index 00000000..25aa1b84 --- /dev/null +++ b/alliance/src/bdd/src/bddnode.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddnode.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_NODE_H +# define BDD_NODE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddoptimize.c b/alliance/src/bdd/src/bddoptimize.c new file mode 100644 index 00000000..54c0a2a4 --- /dev/null +++ b/alliance/src/bdd/src/bddoptimize.c @@ -0,0 +1,175 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* Includes */ +/*----------------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddoptimize.h" +# include "bdderror.h" + +/*----------------------------------------------------------------------*/ +/* Constant declarations */ +/*----------------------------------------------------------------------*/ + +/* # define DEBUG */ + +/*----------------------------------------------------------------------*/ +/* Type declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Stucture declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Variable declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Macro declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Static function prototypes */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Definition of static functions */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Definition of exported functions */ +/*----------------------------------------------------------------------*/ + +void optimizebddcircuit( BddCircuit, CostFunc, MaxSizeFactor ) + bddcircuit *BddCircuit; + long (*CostFunc)(); + float MaxSizeFactor; +{ + long CurrSize; + long MaxSize; + bddvar StartPos; + bddvar CurrPos; + bddvar BestPos; + long CurrCost; + long BestCost; + bddindex BddIndex; + bddindex NumberIndex; + bddvar NumberVar; + + setbddlocalcircuit( BddCircuit ); + +# ifndef DEBUG + printf( " - optimizing: " ); +# endif + garbagebddsystem( BddLocalSystem ); + + NumberIndex = BddLocalSystem->NUMBER_INDEX; + NumberVar = BddLocalSystem->NUMBER_VAR; + + for ( BddIndex = BDD_INDEX_MIN; BddIndex < NumberIndex; BddIndex++ ) { + +# ifndef DEBUG + putchar( '.' ); fflush( stdout ); +# endif + StartPos = BddLocalSystem->INDEX_TO_VAR[ BddIndex ]; + CurrPos = StartPos; + BestPos = StartPos; + CurrCost = CostFunc( BddLocalCircuit ); + BestCost = CurrCost; + + CurrSize = BddLocalSystem->NUMBER_NODE; + MaxSize = MaxSizeFactor * CurrSize; + + if ( BddLocalSystem->MAX_NODE != 0 && MaxSize > BddLocalSystem->MAX_NODE ) + MaxSize = BddLocalSystem->MAX_NODE; + +# ifdef DEBUG + printf( " swapping index %d [ bddvar = %d ]\n", BddIndex, StartPos ); + printf( " initial cost = %ld\n", CurrCost ); +# endif + + while ( CurrPos < NumberVar - 1 && CurrSize < MaxSize ) { + swapbddvar( BddLocalSystem, CurrPos ); + CurrPos += 1; + CurrSize = BddLocalSystem->NUMBER_NODE; + CurrCost = CostFunc( BddLocalCircuit ); + if ( CurrCost < BestCost ) { +# ifdef DEBUG + printf( " --> BestCost = %ld\n", CurrCost ); +# endif + BestPos = CurrPos; + BestCost = CurrCost; + } + } +# ifdef DEBUG + if ( ! ( CurrSize < MaxSize ) ) + printf( " --> Max Size Limit Reached (%ld)!!!\n", MaxSize ); +# endif + + while ( CurrPos != StartPos ) { + CurrPos -= 1; + swapbddvar( BddLocalSystem, CurrPos ); + } + + CurrSize = BddLocalSystem->NUMBER_NODE; + while ( CurrPos != 0 && CurrSize < MaxSize ) { + CurrPos -= 1; + swapbddvar( BddLocalSystem, CurrPos ); + CurrSize = BddLocalSystem->NUMBER_NODE; + CurrCost = CostFunc( BddLocalCircuit ); + if ( CurrCost < BestCost ) { +# ifdef DEBUG + printf( " --> BestCost = %ld\n", CurrCost ); +# endif + BestPos = CurrPos; + BestCost = CurrCost; + } + } + +# ifdef DEBUG + if ( ! ( CurrSize < MaxSize ) ) + printf( " --> Max Size Limit Reached (%ld)!!!\n", MaxSize ); +# endif + + while ( CurrPos != BestPos) { + swapbddvar( BddLocalSystem, CurrPos ); + CurrPos += 1; + } + } + + garbagebddsystem( BddLocalSystem ); +# ifndef DEBUG + putchar( '\n' ); +# endif +} diff --git a/alliance/src/bdd/src/bddoptimize.h b/alliance/src/bdd/src/bddoptimize.h new file mode 100644 index 00000000..88755121 --- /dev/null +++ b/alliance/src/bdd/src/bddoptimize.h @@ -0,0 +1,66 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __bddoptimize_h +#define __bddoptimize_h + +/*----------------------------------------------------------------------*/ +/* Nested includes */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Constant declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Macro declarations */ +/*----------------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(args) args +# else +# define __P(args) () +# endif +#endif + +/*----------------------------------------------------------------------*/ +/* Type declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Stucture declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Variable declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Function prototypes */ +/*----------------------------------------------------------------------*/ + +#endif /* __bddoptimize_h */ diff --git a/alliance/src/bdd/src/bddreduce.c b/alliance/src/bdd/src/bddreduce.c new file mode 100644 index 00000000..c6b826ff --- /dev/null +++ b/alliance/src/bdd/src/bddreduce.c @@ -0,0 +1,181 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddreduce.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddassoc.h" +# include "bddreduce.h" +# include "bddapply.h" +# include "bddexist.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Reduce Bdd Node | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_reducebdd( BddNode1, BddNode2 ) + + bddnode *BddNode1; + bddnode *BddNode2; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddnode *BddHigh; + bddnode *BddLow; + bddindex Index1; + bddindex Index2; + + Index1 = BddNode1->INDEX; + Index2 = BddNode2->INDEX; + + if ( Index2 < BDD_INDEX_MIN ) + { + if ( Index2 == BDD_INDEX_ZERO ) + { + return( (bddnode *)0 ); + } + + return( incbddrefext( BddNode1 ) ); + } + + if ( Index1 < BDD_INDEX_MIN ) + { + return( BddNode1 ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_REDUCE, BddNode1, BddNode2 ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( BddLocalSystem->INDEX_TO_VAR[ Index1 ] > + BddLocalSystem->INDEX_TO_VAR[ Index2 ] ) + { + BddHigh = loc_applybdd( ABL_OR, BddNode2->HIGH, BddNode2->LOW ); + BddNode = loc_reducebdd( BddNode1, BddHigh ); + decbddrefext( BddHigh ); + } + else + { + if ( Index1 == Index2 ) + { + BddHigh = loc_reducebdd( BddNode1->HIGH, BddNode2->HIGH ); + BddLow = loc_reducebdd( BddNode1->LOW , BddNode2->LOW ); + } + else + { + BddHigh = loc_reducebdd( BddNode1->HIGH, BddNode2 ); + BddLow = loc_reducebdd( BddNode1->LOW , BddNode2 ); + } + + if ( BddHigh == (bddnode *)0 ) BddNode = BddLow; + else + if ( BddLow == (bddnode *)0 ) BddNode = BddHigh; + else + BddNode = addbddnode( (bddsystem *)0, Index1, + decbddrefext( BddHigh ), + decbddrefext( BddLow ) ); + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_REDUCE, + BddNode1, BddNode2, BddNode ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Reduce Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *reducebddnode( BddSystem, BddNode1, BddNode2 ) + + bddsystem *BddSystem; + bddnode *BddNode1; + bddnode *BddNode2; +{ + setbddlocalsystem( BddSystem ); + + BddNode1 = loc_reducebdd( BddNode1, BddNode2 ); + + if ( BddNode1 == (bddnode *)0 ) + { + BddNode1 = BddLocalSystem->ZERO; + } + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode1 ); +} + diff --git a/alliance/src/bdd/src/bddreduce.h b/alliance/src/bdd/src/bddreduce.h new file mode 100644 index 00000000..162d1d15 --- /dev/null +++ b/alliance/src/bdd/src/bddreduce.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddreduce.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_REDUCE_H +# define BDD_REDUCE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddref.c b/alliance/src/bdd/src/bddref.c new file mode 100644 index 00000000..7dbed8a4 --- /dev/null +++ b/alliance/src/bdd/src/bddref.c @@ -0,0 +1,417 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddref.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddref.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Update Reference | +| | +\------------------------------------------------------------*/ + +void updatebddref( BddNode ) + + bddnode *BddNode; +{ + if ( ( BddNode->REF_INT == 0 ) && + ( BddNode->REF_EXT == 0 ) ) + { + decbddrefint( BddNode->HIGH ); + decbddrefint( BddNode->LOW ); + + updatebddref( BddNode->HIGH ); + updatebddref( BddNode->LOW ); + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Inc External Reference | +| | +\------------------------------------------------------------*/ + +bddnode *incbddrefext( BddNode ) + + bddnode *BddNode; +{ + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( BddNode->REF_EXT < BDD_MAX_REF ) ) + { + BddNode->REF_EXT++; + + if ( BddNode->REF_EXT == BDD_MAX_REF ) + { + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_OVERFLOW_REF_EXT_WARNING, BddNode->INDEX, 0 ); + } + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Inc Internal Reference | +| | +\------------------------------------------------------------*/ + +bddnode *incbddrefint( BddNode ) + + bddnode *BddNode; +{ + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( BddNode->REF_INT < BDD_MAX_REF ) ) + { + BddNode->REF_INT++; + + if ( BddNode->REF_INT == BDD_MAX_REF ) + { + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_OVERFLOW_REF_INT_WARNING, BddNode->INDEX, 0 ); + } + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Dec External Reference | +| | +\------------------------------------------------------------*/ + +bddnode *decbddrefext( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->REF_EXT > 0 ) + { + if ( BddNode->REF_EXT < BDD_MAX_REF ) + { + BddNode->REF_EXT--; + } + } + else + { + bdderror( BDD_NEGATIVE_REF_EXT_ERROR, BddNode->INDEX ); + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Dec Internal Reference | +| | +\------------------------------------------------------------*/ + +bddnode *decbddrefint( BddNode ) + + bddnode *BddNode; +{ + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( BddNode->REF_INT > 0 ) && + ( BddNode->REF_INT < BDD_MAX_REF ) ) + { + BddNode->REF_INT--; + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Set External Reference | +| | +\------------------------------------------------------------*/ + +bddnode *setbddrefext( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->REF_INT > 0 ) + { + if ( BddNode->REF_INT < BDD_MAX_REF ) + { + BddNode->REF_INT--; + } + } + else + { + bdderror( BDD_NEGATIVE_REF_INT_ERROR, BddNode->INDEX ); + } + + if ( BddNode->REF_EXT < BDD_MAX_REF ) + { + BddNode->REF_EXT++; + + if ( BddNode->REF_EXT == BDD_MAX_REF ) + { + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_OVERFLOW_REF_EXT_WARNING, BddNode->INDEX, 0 ); + } + } + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd UnSet External Reference | +| | +\------------------------------------------------------------*/ + +bddnode *unsetbddrefext( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->REF_EXT > 0 ) + { + if ( BddNode->REF_EXT < BDD_MAX_REF ) + { + BddNode->REF_EXT--; + } + } + else + { + bdderror( BDD_NEGATIVE_REF_EXT_ERROR, BddNode->INDEX ); + } + + if ( BddNode->REF_INT < BDD_MAX_REF ) + { + BddNode->REF_INT++; + + if ( BddNode->REF_INT == BDD_MAX_REF ) + { + if ( ! IsBddSystemNoWarning( BddLocalSystem ) ) + { + bddwarning( BDD_OVERFLOW_REF_INT_WARNING, BddNode->INDEX, 0 ); + } + } + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Clear Internal Reference | +| | +\------------------------------------------------------------*/ + +void clearbddsystemrefint( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddindex *VarToIndex; + bddvar NumberVar; + bddvar Variable; + long HashIndex; + + setbddlocalsystem( BddSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + IndexNode = BddLocalSystem->INDEX_NODE; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + HashTable = IndexNode[ VarToIndex[ Variable ] ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + HashNode->REF_INT = 0; + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Clear External Reference | +| | +\------------------------------------------------------------*/ + +void clearbddsystemrefext( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddnode *BddNode; + bddindex *VarToIndex; + bddvarnode *VarNode; + bddvar NumberVar; + bddvar Variable; + bddindex Index; + long HashIndex; + + setbddlocalsystem( BddSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + IndexNode = BddLocalSystem->INDEX_NODE; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + VarNode = BddLocalSystem->VAR_NODE; + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + Index = VarToIndex[ Variable ]; + BddNode = VarNode [ Index ]; + HashTable = IndexNode [ Index ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) && + ( HashNode != BddNode ) ) + { + HashNode->REF_EXT = 0; + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Clear Reference | +| | +\------------------------------------------------------------*/ + +void clearbddsystemref( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddnode *BddNode; + bddindex *VarToIndex; + bddvarnode *VarNode; + bddvar NumberVar; + bddvar Variable; + bddindex Index; + long HashIndex; + + setbddlocalsystem( BddSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + IndexNode = BddLocalSystem->INDEX_NODE; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + VarNode = BddLocalSystem->VAR_NODE; + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + Index = VarToIndex[ Variable ]; + BddNode = VarNode [ Index ]; + HashTable = IndexNode [ Index ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + if ( HashNode != BddNode ) + { + HashNode->REF_EXT = 0; + } + + HashNode->REF_INT = 0; + } + } + } +} diff --git a/alliance/src/bdd/src/bddref.h b/alliance/src/bdd/src/bddref.h new file mode 100644 index 00000000..a5a5c826 --- /dev/null +++ b/alliance/src/bdd/src/bddref.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddref.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_REF_H +# define BDD_REF_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddrelprod.c b/alliance/src/bdd/src/bddrelprod.c new file mode 100644 index 00000000..902e1661 --- /dev/null +++ b/alliance/src/bdd/src/bddrelprod.c @@ -0,0 +1,228 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddrelprod.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddassoc.h" +# include "bddrelprod.h" +# include "bddapply.h" +# include "bddexist.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Relation Product With Association | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_relprodbddnode( BddNode1, BddNode2 ) + + bddnode *BddNode1; + bddnode *BddNode2; +{ + bddhoper *HashOper; + bddnode *BddRelProd; + bddnode *BddHigh; + bddnode *BddLow; + bddvar NodeVar1; + bddvar NodeVar2; + + if ( ( BddNode1->INDEX < BDD_INDEX_MIN ) || + ( BddNode2->INDEX < BDD_INDEX_MIN ) ) + { + if ( ( BddNode1->INDEX == BDD_INDEX_ZERO ) || + ( BddNode2->INDEX == BDD_INDEX_ZERO ) ) + { + return( BddLocalSystem->ZERO ); + } + + if ( ( BddNode1->INDEX == BDD_INDEX_ONE ) && + ( BddNode2->INDEX == BDD_INDEX_ONE ) ) + { + return( BddLocalSystem->ONE ); + } + + if ( BddNode1->INDEX == BDD_INDEX_ONE ) + { + return( loc_existbddnode( BddNode2 ) ); + } + + return( loc_existbddnode( BddNode1 ) ); + } + + NodeVar1 = BddLocalSystem->INDEX_TO_VAR[ BddNode1->INDEX ]; + NodeVar2 = BddLocalSystem->INDEX_TO_VAR[ BddNode2->INDEX ]; + + if ( ( BddLocalAssoc->LAST < NodeVar1 ) && + ( BddLocalAssoc->LAST < NodeVar2 ) ) + { + return( loc_applybdd( ABL_AND, BddNode1, BddNode2 ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_REL_PROD + BddLocalAssoc->IDENT, + BddNode1, BddNode2 ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( NodeVar2 == NodeVar1 ) + { + BddHigh = loc_relprodbddnode( BddNode1->HIGH, BddNode2->HIGH ); + BddRelProd = BddLocalAssocNode[ NodeVar1 ]; + } + else + if ( NodeVar2 > NodeVar1 ) + { + BddHigh = loc_relprodbddnode( BddNode1->HIGH, BddNode2 ); + BddRelProd = BddLocalAssocNode[ NodeVar1 ]; + } + else + { + BddHigh = loc_relprodbddnode( BddNode2->HIGH, BddNode1 ); + BddRelProd = BddLocalAssocNode[ NodeVar2 ]; + } + + if ( ( BddRelProd != (bddnode *)0 ) && + ( BddHigh->INDEX == BDD_INDEX_ONE ) ) + { + BddRelProd = BddHigh; + } + else + { + if ( NodeVar2 == NodeVar1 ) + { + BddLow = loc_relprodbddnode( BddNode1->LOW, BddNode2->LOW ); + } + else + if ( NodeVar2 > NodeVar1 ) + { + BddLow = loc_relprodbddnode( BddNode1->LOW, BddNode2 ); + } + else + { + BddLow = loc_relprodbddnode( BddNode2->LOW, BddNode1 ); + } + + BddHigh = decbddrefext( BddHigh ); + BddLow = decbddrefext( BddLow ); + + if ( BddRelProd != (bddnode *)0 ) + { + BddRelProd = loc_applybdd( ABL_OR, BddHigh, BddLow ); + } + else + if ( NodeVar2 >= NodeVar1 ) + { + BddRelProd = addbddnode( (bddsystem *)0, BddNode1->INDEX, BddHigh, BddLow ); + } + else + { + BddRelProd = addbddnode( (bddsystem *)0, BddNode2->INDEX, BddHigh, BddLow ); + } + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_REL_PROD + BddLocalAssoc->IDENT, + BddNode1, BddNode2, BddRelProd ); + + BddLocalAssoc->CACHE = 1; + + return( BddRelProd ); +} + +/*------------------------------------------------------------\ +| | +| Relational Product Bdd Node With Association | +| | +\------------------------------------------------------------*/ + +bddnode *relprodbddnodeassoc( BddSystem, BddNode1, BddNode2, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode1; + bddnode *BddNode2; + bddassoc *BddAssoc; +{ + bddnode *BddRelProd; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( loc_applybdd( ABL_AND, BddNode1, BddNode2 ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddRelProd = loc_relprodbddnode( BddNode1, BddNode2 ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddRelProd ); +} diff --git a/alliance/src/bdd/src/bddrelprod.h b/alliance/src/bdd/src/bddrelprod.h new file mode 100644 index 00000000..29dbc2a3 --- /dev/null +++ b/alliance/src/bdd/src/bddrelprod.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddrelprod.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_REL_PROD_H +# define BDD_REL_PROD_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddreorder.c b/alliance/src/bdd/src/bddreorder.c new file mode 100644 index 00000000..beb6d365 --- /dev/null +++ b/alliance/src/bdd/src/bddreorder.c @@ -0,0 +1,462 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddorder.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| Modif : Arnaud Caron - 16 Oct 1998 | +| Suppression des bddvartrees. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddreorder.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Reorder Bdd Variable Window 2 | +| | +\------------------------------------------------------------*/ + +int +#ifdef __STDC__ +reorderbddvarwindow2( bddsystem *BddSystem, bddvar BddVar ) +#else +reorderbddvarwindow2( BddSystem, BddVar ) + + bddsystem *BddSystem; + bddvar BddVar; +#endif +{ + long NumberNode; + + setbddlocalsystem( BddSystem ); + + NumberNode = BddLocalSystem->NUMBER_NODE; + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + return( 1 ); + } + + swapbddvar( BddLocalSystem, BddVar ); + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Reorder Bdd Variable Window 3 | +| | +\------------------------------------------------------------*/ + +int +#ifdef __STDC__ +reorderbddvarwindow3( bddsystem *BddSystem, bddvar BddVar ) +#else +reorderbddvarwindow3( BddSystem, BddVar ) + + bddsystem *BddSystem; + bddvar BddVar; +#endif +{ + long NumberNode; + char BestOrder; + + setbddlocalsystem( BddSystem ); + + BestOrder = BDD_REORDER_123; + NumberNode = BddLocalSystem->NUMBER_NODE; + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + NumberNode = BddLocalSystem->NUMBER_NODE; + BestOrder = BDD_REORDER_213; + } + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + NumberNode = BddLocalSystem->NUMBER_NODE; + BestOrder = BDD_REORDER_231; + } + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + NumberNode = BddLocalSystem->NUMBER_NODE; + BestOrder = BDD_REORDER_321; + } + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + NumberNode = BddLocalSystem->NUMBER_NODE; + BestOrder = BDD_REORDER_312; + } + + swapbddvar( BddLocalSystem, BddVar ); + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + NumberNode = BddLocalSystem->NUMBER_NODE; + BestOrder = BDD_REORDER_132; + } + + switch ( BestOrder ) + { + case BDD_REORDER_123 : swapbddvar( BddLocalSystem, BddVar ); + break; + + case BDD_REORDER_213 : swapbddvar( BddLocalSystem, BddVar ); + swapbddvar( BddLocalSystem, BddVar ); + break; + + case BDD_REORDER_231 : swapbddvar( BddLocalSystem, BddVar ); + swapbddvar( BddLocalSystem, BddVar ); + swapbddvar( BddLocalSystem, BddVar ); + break; + + case BDD_REORDER_321 : swapbddvar( BddLocalSystem, BddVar ); + swapbddvar( BddLocalSystem, BddVar ); + break; + + case BDD_REORDER_312 : swapbddvar( BddLocalSystem, BddVar ); + break; + } + + return( BestOrder != BDD_REORDER_123 ); +} + + +/*------------------------------------------------------------\ +| | +| Reorder Bdd System Simple | +| | +\------------------------------------------------------------*/ + +void +#ifdef __STDC__ +reorderbddsystemsimple( bddsystem *BddSystem ) +#else +reorderbddsystemsimple( BddSystem ) + + bddsystem *BddSystem; +#endif +{ + bddvar BddVar; + + setbddlocalsystem( BddSystem ); + + garbagebddsystem( BddLocalSystem ); + + for ( BddVar = 0; BddVar < BddLocalSystem->NUMBER_VAR - 1; BddVar++ ) + { + if ( BddVar < BddLocalSystem->NUMBER_VAR - 2 ) + { + reorderbddvarwindow3( BddLocalSystem, BddVar ); + } + else + { + reorderbddvarwindow2( BddLocalSystem, BddVar ); + } + } + garbagebddsystem( BddLocalSystem ); +} + +/*------------------------------------------------------------\ +| | +| Reorder Bdd System Window | +| | +\------------------------------------------------------------*/ + +void +#ifdef __STDC__ +reorderbddsystemwindow( bddsystem *BddSystem ) +#else +reorderbddsystemwindow( BddSystem ) + + bddsystem *BddSystem; +#endif +{ + bddvar NumberVar; + bddvar BddVar; + char Moved; + char AnySwap; + char *BddReorderLevel; + + setbddlocalsystem( BddSystem ); + + BddReorderLevel = autallocblock( BddLocalSystem->NUMBER_VAR + 1 ); + + garbagebddsystem( BddLocalSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + + for ( BddVar = 0; BddVar < NumberVar - 1; BddVar++ ) + { + BddReorderLevel[ BddVar ] = 1; + } + + do + { + AnySwap = 0; + + for ( BddVar = 0; BddVar < NumberVar - 1; BddVar++ ) + { + if ( BddReorderLevel[ BddVar ] ) + { + if ( BddVar < NumberVar - 2 ) + { + Moved = reorderbddvarwindow3( BddLocalSystem, BddVar ); + } + else + { + Moved = reorderbddvarwindow2( BddLocalSystem, BddVar ); + } + + if ( Moved ) + { + AnySwap = 1; + + if ( BddVar > 0 ) BddReorderLevel[ BddVar - 1 ] = 1; + if ( BddVar > 1 ) BddReorderLevel[ BddVar - 2 ] = 1; + + BddReorderLevel[ BddVar + 1 ] = 1; + + if ( BddVar < NumberVar - 2 ) BddReorderLevel[ BddVar + 2 ] = 1; + if ( BddVar < NumberVar - 3 ) BddReorderLevel[ BddVar + 3 ] = 1; + if ( BddVar < NumberVar - 4 ) BddReorderLevel[ BddVar + 4 ] = 1; + } + else + { + BddReorderLevel[ BddVar ] = 0; + } + } + } + } + while ( AnySwap ); + + autfreeblock( BddReorderLevel ); + + garbagebddsystem( BddLocalSystem ); +} + +/*------------------------------------------------------------\ +| | +| Reorder Bdd System Top | +| | +\------------------------------------------------------------*/ + +void +#ifdef __STDC__ +reorderbddsystemtop( bddsystem *BddSystem ) +#else +reorderbddsystemtop( BddSystem ) + + bddsystem *BddSystem; +#endif +{ + long NumberNode; + bddvar NumberVar; + bddvar BestVar; + bddvar VarCount; + bddvar VarTo; + bddvar VarFrom; + char SwapReorder; + char *BddReorderLevel; + + setbddlocalsystem( BddSystem ); + + BddReorderLevel = autallocblock( BddLocalSystem->NUMBER_VAR + 1 ); + + garbagebddsystem( BddLocalSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + + for ( VarFrom = 0; VarFrom < ( NumberVar - 1 ); VarFrom++ ) + { + BddReorderLevel[ VarFrom ] = 1; + } + + NumberNode = BddLocalSystem->NUMBER_NODE; + VarCount = NumberVar - 1; + VarFrom = 0; + + while ( VarCount > 0 ) + { +# ifdef BDD_DEBUG + fprintf( stdout, "-> VarFrom %d\n", VarFrom ); +# endif + + BddReorderLevel[ VarFrom ] = 0; + + BestVar = VarFrom; + + for ( VarTo = VarFrom; VarTo < NumberVar - 1; VarTo++ ) + { +# ifdef BDD_DEBUG + fprintf( stdout, "-> Swap %d and %d\n", VarTo, VarTo + 1 ); +# endif + + swapbddvar( BddLocalSystem, VarTo ); + + SwapReorder = BddReorderLevel[ VarTo ]; + BddReorderLevel[ VarTo ] = BddReorderLevel[ VarTo + 1 ]; + BddReorderLevel[ VarTo + 1 ] = SwapReorder; + + if ( BddLocalSystem->NUMBER_NODE < NumberNode ) + { + BestVar = VarTo + 1; NumberNode = BddLocalSystem->NUMBER_NODE; + } + } + +# ifdef BDD_DEBUG + fprintf( stdout, "--> Best one %d\n", BestVar ); + fprintf( stdout, "--> Number nodes %d\n", NumberNode ); +# endif + + for ( VarTo = NumberVar - 1; VarTo > BestVar; VarTo-- ) + { +# ifdef BDD_DEBUG + fprintf( stdout, "-> UnSwap %d and %d\n", VarTo - 1, VarTo ); +# endif + + SwapReorder = BddReorderLevel[ VarTo - 1 ]; + BddReorderLevel[ VarTo - 1 ] = BddReorderLevel[ VarTo ]; + BddReorderLevel[ VarTo ] = SwapReorder; + + swapbddvar( BddLocalSystem, VarTo - 1 ); + } + + while ( ! BddReorderLevel[ VarFrom ] ) + { + VarFrom = VarFrom + 1; + } + + VarCount = VarCount - 1; + } + + autfreeblock( BddReorderLevel ); + + garbagebddsystem( BddLocalSystem ); +} + +/*----------------------------------------------------------------------*/ +/* Reorder Bdd System Sift */ +/*----------------------------------------------------------------------*/ + +void +#ifdef __STDC__ +reorderbddsystemsift( bddsystem *BddSystem ) +#else +reorderbddsystemsift( BddSystem ) + + bddsystem *BddSystem; +#endif +{ + setbddlocalsystem( BddSystem ); + + garbagebddsystem( BddLocalSystem ); + + fprintf( stderr, "reorderbddsystemsift: not implemented\n" ); + + garbagebddsystem( BddLocalSystem ); +} + +/*------------------------------------------------------------\ +| | +| Reorder Bdd System Dynamic | +| | +\------------------------------------------------------------*/ + +void reorderbddsystemdynamic( BddSystem, ReorderFunc, ReorderLow, ReorderRatio ) + + bddsystem *BddSystem; + void (*ReorderFunc)(); + long ReorderLow; + long ReorderRatio; +{ + setbddlocalsystem( BddSystem ); + + if ( ReorderFunc != (void *)0 ) + { + SetBddSystemReorderOn( BddLocalSystem ); + } + else + { + ClearBddSystemReorderOn( BddLocalSystem ); + } + + BddLocalSystem->REORDER_FUNC = ReorderFunc; + BddLocalSystem->REORDER_LOW = ReorderLow; + BddLocalSystem->REORDER_LIMIT = ReorderLow; + BddLocalSystem->REORDER_RATIO = ReorderRatio + 100; +} diff --git a/alliance/src/bdd/src/bddreorder.h b/alliance/src/bdd/src/bddreorder.h new file mode 100644 index 00000000..7c05f180 --- /dev/null +++ b/alliance/src/bdd/src/bddreorder.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddreorder.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_REORDER_H +# define BDD_REORDER_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define BDD_REORDER_123 0 +# define BDD_REORDER_213 1 +# define BDD_REORDER_231 2 +# define BDD_REORDER_321 3 +# define BDD_REORDER_312 4 +# define BDD_REORDER_132 5 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddresize.c b/alliance/src/bdd/src/bddresize.c new file mode 100644 index 00000000..747606f6 --- /dev/null +++ b/alliance/src/bdd/src/bddresize.c @@ -0,0 +1,205 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddresize.c | +| | +| Date : 03.12.96 | +| | +| Bddhor : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddresize.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Bdd Resize Variable Node | +| | +\------------------------------------------------------------*/ + +bddvarnode *resizebddvarnode( BddVarNode, OldNum, NewNum ) + + bddvarnode *BddVarNode; + long OldNum; + long NewNum; +{ + BddAllocInfo.VAR_NODE += NewNum - OldNum; + + return( (bddvarnode *)autresizeblock( (char *)BddVarNode, + sizeof( bddvarnode ) * OldNum, + sizeof( bddvarnode ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Variable | +| | +\------------------------------------------------------------*/ + +bddvar *resizebddvar( BddVar, OldNum, NewNum ) + + bddvar *BddVar; + long OldNum; + long NewNum; +{ + BddAllocInfo.VAR += NewNum - OldNum; + + return( (bddvar *)autresizeblock( (char *)BddVar, + sizeof( bddvar ) * OldNum, + sizeof( bddvar ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Index Node | +| | +\------------------------------------------------------------*/ + +bddindexnode *resizebddindexnode( BddIndexNode, OldNum, NewNum ) + + bddindexnode *BddIndexNode; + long OldNum; + long NewNum; +{ + BddAllocInfo.INDEX_NODE += NewNum - OldNum; + + return( (bddindexnode *)autresizeblock( (char *)BddIndexNode, + sizeof( bddindexnode ) * OldNum, + sizeof( bddindexnode ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Index | +| | +\------------------------------------------------------------*/ + +bddindex *resizebddindex( BddIndex, OldNum, NewNum ) + + bddindex *BddIndex; + long OldNum; + long NewNum; +{ + BddAllocInfo.INDEX += NewNum - OldNum; + + return( (bddindex *)autresizeblock( (char *)BddIndex, + sizeof( bddindex ) * OldNum, + sizeof( bddindex ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Assoc Node | +| | +\------------------------------------------------------------*/ + +bddassocnode *resizebddassocnode( BddAssocNode, OldNum, NewNum ) + + bddassocnode *BddAssocNode; + long OldNum; + long NewNum; +{ + BddAllocInfo.ASSOC_NODE += NewNum - OldNum; + + return( (bddassocnode *)autresizeblock( (char *)BddAssocNode, + sizeof( bddassocnode ) * OldNum, + sizeof( bddassocnode ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Name Input | +| | +\------------------------------------------------------------*/ + +bddnamein *resizebddnamein( NameIn, OldNum, NewNum ) + + bddnamein *NameIn; + long OldNum; + long NewNum; +{ + BddAllocInfo.NAME_IN += NewNum - OldNum; + + return( (bddnamein *)autresizeblock( (char *)NameIn, + sizeof( bddnamein ) * OldNum, + sizeof( bddnamein ) * NewNum ) ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Resize Index Input | +| | +\------------------------------------------------------------*/ + +bddindex *resizebddindexin( IndexIn, OldNum, NewNum ) + + bddindex *IndexIn; + long OldNum; + long NewNum; +{ + BddAllocInfo.INDEX_IN += NewNum - OldNum; + + return( (bddindex *)autresizeblock( (char *)IndexIn, + sizeof( bddindex ) * OldNum, + sizeof( bddindex ) * NewNum ) ); +} diff --git a/alliance/src/bdd/src/bddresize.h b/alliance/src/bdd/src/bddresize.h new file mode 100644 index 00000000..a4ce7dbf --- /dev/null +++ b/alliance/src/bdd/src/bddresize.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddresize.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_RESIZE_H +# define BDD_RESIZE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsatisfy.c b/alliance/src/bdd/src/bddsatisfy.c new file mode 100644 index 00000000..ddd1625d --- /dev/null +++ b/alliance/src/bdd/src/bddsatisfy.c @@ -0,0 +1,233 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsatisfy.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddsatisfy.h" +# include "bddassoc.h" +# include "bddapply.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Satisfy Bdd Node | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_satisfybdd( BddNode ) + + bddnode *BddNode; +{ + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->HIGH == BddLocalSystem->ZERO ) + { + BddNode = addbddnode( (bddsystem *)0, BddNode->INDEX, + BddLocalSystem->ZERO, + decbddrefext( loc_satisfybdd( BddNode->LOW ) ) ); + } + else + { + BddNode = addbddnode( (bddsystem *)0, BddNode->INDEX, + decbddrefext( loc_satisfybdd( BddNode->HIGH ) ), + BddLocalSystem->ZERO ); + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Satisfy Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *satisfybddnode( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +{ + setbddlocalsystem( BddSystem ); + + if ( BddNode->INDEX == BDD_INDEX_ZERO ) + { + bdderror( BDD_BAD_INDEX_ERROR, BDD_INDEX_ZERO ); + } + + BddNode = loc_satisfybdd( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Local Satisfy Bdd Node Assoc | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_satisfybddassoc( BddNode ) + + bddnode *BddNode; +{ + bddnode *NodeVar; + bddvar Variable; + + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + if ( BddNode->HIGH == BddLocalSystem->ZERO ) + { + BddNode = addbddnode( (bddsystem *)0, BddNode->INDEX, + BddLocalSystem->ZERO, + decbddrefext( loc_satisfybddassoc( BddNode->LOW ) ) ); + } + else + { + BddNode = addbddnode( (bddsystem *)0, BddNode->INDEX, + decbddrefext( loc_satisfybddassoc( BddNode->HIGH ) ), + BddLocalSystem->ZERO ); + } + + if ( BddNode->INDEX >= BDD_INDEX_MIN ) + { + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( ( Variable >= BddLocalAssoc->FIRST ) && + ( Variable <= BddLocalAssoc->LAST ) ) + { + NodeVar = BddLocalSystem->VAR_NODE[ BddNode->INDEX ]; + NodeVar->FLAG |= BDD_FLAG_NUM_MASK; + } + } + } + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Satisfy Bdd Node | +| | +\------------------------------------------------------------*/ + +bddnode *satisfybddnodeassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddMore; + bddnode *NodeVar; + long Variable; + bddindex Index; + + if ( BddNode->INDEX == BDD_INDEX_ZERO ) + { + bdderror( BDD_BAD_INDEX_ERROR, BDD_INDEX_ZERO ); + } + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddNode = loc_satisfybddassoc( BddNode ); + BddMore = BddLocalSystem->ONE; + + for ( Variable = (long)BddLocalAssoc->LAST; + Variable >= (long)BddLocalAssoc->FIRST; + Variable = Variable - 1 ) + { + if ( BddLocalAssocNode[ Variable ] != (bddnode *)0 ) + { + Index = BddLocalSystem->VAR_TO_INDEX[ Variable ]; + NodeVar = BddLocalSystem->VAR_NODE[ Index ]; + + if ( NodeVar->FLAG & BDD_FLAG_NUM_MASK ) + { + NodeVar->FLAG &= ~BDD_FLAG_NUM_MASK; + } + else + { + BddMore = loc_applybdd( ABL_AND, decbddrefext( BddMore ), NodeVar ); + } + } + } + + BddNode = loc_applybdd( ABL_AND, + decbddrefext( BddNode ), + decbddrefext( BddMore ) ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddNode ); +} diff --git a/alliance/src/bdd/src/bddsatisfy.h b/alliance/src/bdd/src/bddsatisfy.h new file mode 100644 index 00000000..958576d2 --- /dev/null +++ b/alliance/src/bdd/src/bddsatisfy.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsatisfy.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_SATISFY_H +# define BDD_SATISFY_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsimpdc.c b/alliance/src/bdd/src/bddsimpdc.c new file mode 100644 index 00000000..f9ef67e2 --- /dev/null +++ b/alliance/src/bdd/src/bddsimpdc.c @@ -0,0 +1,325 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsimpdc.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddapply.h" +# include "bddsimpdc.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Simplify Node Dc On | +| | +\------------------------------------------------------------*/ + +bddnode *loc_simpbdddcon( BddOn, BddDc ) + + bddnode *BddOn; + bddnode *BddDc; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddnode *BddNode1; + + if ( BddDc == BddLocalSystem->ZERO ) + { + return( incbddrefext( BddOn ) ); + } + + if ( BddOn == BddDc ) + { + return( BddLocalSystem->ZERO ); + } + + if ( BddOn->INDEX < BDD_INDEX_MIN ) + { + return( BddOn ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_SIMP_DC_ON, BddOn, BddDc ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( BddOn->INDEX == BddDc->INDEX ) + { + if ( BddDc->HIGH == BddLocalSystem->ONE ) + { + return( loc_simpbdddcon( BddOn->LOW, BddDc->LOW ) ); + } + + if ( BddDc->LOW == BddLocalSystem->ONE ) + { + return( loc_simpbdddcon( BddOn->HIGH, BddDc->HIGH ) ); + } + + if ( BddOn->HIGH == BddLocalSystem->ONE ) + { + BddNode = decbddrefext( loc_applybddnot( BddDc->HIGH ) ); + BddNode1 = decbddrefext( loc_applybdd( ABL_AND, BddOn->LOW, BddNode ) ); + + if ( BddNode1 == BddNode ) + { + BddNode = decbddrefext( loc_applybdd( ABL_AND, BddDc->HIGH, BddDc->LOW ) ); + + return( loc_simpbdddcon( BddOn->LOW, BddNode ) ); + } + } + + if ( BddOn->LOW == BddLocalSystem->ONE ) + { + BddNode = decbddrefext( loc_applybddnot( BddDc->LOW ) ); + BddNode1 = decbddrefext( loc_applybdd( ABL_AND, BddOn->HIGH, BddNode ) ); + + if ( BddNode1 == BddNode ) + { + BddNode = decbddrefext( loc_applybdd( ABL_AND, BddDc->HIGH, BddDc->LOW ) ); + + return( loc_simpbdddcon( BddOn->HIGH, BddNode ) ); + } + } + + BddNode1 = decbddrefext( loc_simpbdddcon( BddOn->HIGH, BddDc->HIGH ) ); + BddNode = decbddrefext( loc_simpbdddcon( BddOn->LOW , BddDc->LOW ) ); + BddNode = addbddnode( (bddsystem *)0, BddOn->INDEX, BddNode1, BddNode ); + } + else + if ( BddLocalSystem->INDEX_TO_VAR[ BddOn->INDEX ] < + BddLocalSystem->INDEX_TO_VAR[ BddDc->INDEX ] ) + { + BddNode1 = decbddrefext( loc_simpbdddcon( BddOn->HIGH, BddDc ) ); + BddNode = decbddrefext( loc_simpbdddcon( BddOn->LOW , BddDc ) ); + BddNode = addbddnode( (bddsystem *)0, BddOn->INDEX, BddNode1, BddNode ); + } + else + { + BddNode1 = decbddrefext( loc_applybdd( ABL_AND, BddDc->HIGH, BddDc->LOW ) ); + BddNode = loc_simpbdddcon( BddOn, BddNode1 ); + } + + addbddhoper( BddLocalSystem->HASH_OPER, BDD_OPER_SIMP_DC_ON, + BddOn, BddDc, BddNode ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Simplify Bdd Node Dc On | +| | +\------------------------------------------------------------*/ + +bddnode *simpbddnodedcon( BddSystem, BddOn, BddDc ) + + bddsystem *BddSystem; + bddnode *BddOn; + bddnode *BddDc; +{ + bddnode *BddDcOn; + + setbddlocalsystem( BddSystem ); + + BddDcOn = loc_simpbdddcon( BddOn, BddDc ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddDcOn ); +} + +/*------------------------------------------------------------\ +| | +| Simplify Node Dc Off | +| | +\------------------------------------------------------------*/ + +bddnode *loc_simpbdddcoff( BddOff, BddDc ) + + bddnode *BddOff; + bddnode *BddDc; +{ + bddhoper *HashOper; + bddnode *BddNode; + bddnode *BddNode1; + + if ( BddDc == BddLocalSystem->ZERO ) + { + return( incbddrefext( BddOff ) ); + } + + if ( BddOff->INDEX < BDD_INDEX_MIN ) + { + return( BddOff ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_SIMP_DC_OFF, BddOff, BddDc ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + if ( BddOff->INDEX == BddDc->INDEX ) + { + if ( BddDc->HIGH == BddLocalSystem->ONE ) + { + return( loc_simpbdddcoff( BddOff->LOW, BddDc->LOW ) ); + } + + if ( BddDc->LOW == BddLocalSystem->ONE ) + { + return( loc_simpbdddcoff( BddOff->HIGH, BddDc->HIGH ) ); + } + + if ( BddOff->HIGH == BddLocalSystem->ZERO ) + { + BddNode1 = loc_applybdd( ABL_AND, BddOff->LOW, BddDc->HIGH ); + + if ( BddNode1 == BddOff->LOW ) + { + return( BddNode1 ); + } + + decbddrefext( BddNode1 ); + } + + if ( BddOff->LOW == BddLocalSystem->ZERO ) + { + BddNode1 = loc_applybdd( ABL_AND, BddOff->HIGH, BddDc->LOW ); + + if ( BddNode1 == BddOff->HIGH ) + { + return( BddNode1 ); + } + + decbddrefext( BddNode1 ); + } +/*\ + BddOrH = decbddrefext( loc_applybdd( ABL_OR , BddOff->LOW , BddDc->LOW ) ); + BddOrL = decbddrefext( loc_applybdd( ABL_OR , BddOff->HIGH, BddDc->HIGH ) ); + BddAndH = decbddrefext( loc_applybdd( ABL_AND, BddOff->HIGH, BddOrL ) ); + BddAndL = decbddrefext( loc_applybdd( ABL_AND, BddOff->LOW , BddOrH ) ); + + if ( ( BddAndH == BddOff->HIGH ) && + ( BddAndL == BddOff->LOW ) ) + { + BddOrL = decbddrefext( loc_applybdd( ABL_OR , BddOff->LOW, BddOff->HIGH ) ); + BddAndL = decbddrefext( loc_applybdd( ABL_AND, BddDc->LOW , BddDc->HIGH ) ); + BddNode = loc_simpbdddcoff( BddOrL, BddAndL ); + } + else +\*/ + BddNode1 = decbddrefext( loc_simpbdddcoff( BddOff->HIGH, BddDc->HIGH ) ); + BddNode = decbddrefext( loc_simpbdddcoff( BddOff->LOW , BddDc->LOW ) ); + BddNode = addbddnode( (bddsystem *)0, BddOff->INDEX, BddNode1, BddNode ); + } + else + if ( BddLocalSystem->INDEX_TO_VAR[ BddOff->INDEX ] < + BddLocalSystem->INDEX_TO_VAR[ BddDc->INDEX ] ) + { + BddNode1 = decbddrefext( loc_simpbdddcoff( BddOff->HIGH, BddDc ) ); + BddNode = decbddrefext( loc_simpbdddcoff( BddOff->LOW , BddDc ) ); + BddNode = addbddnode( (bddsystem *)0, BddOff->INDEX, BddNode1, BddNode ); + } + else + { + BddNode1 = decbddrefext( loc_applybdd( ABL_AND, BddDc->HIGH, BddDc->LOW ) ); + BddNode = loc_simpbdddcoff( BddOff, BddNode1 ); + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_SIMP_DC_OFF, BddOff, BddDc, BddNode ); + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Simplify Bdd Node Dc On | +| | +\------------------------------------------------------------*/ + +bddnode *simpbddnodedcoff( BddSystem, BddOff, BddDc ) + + bddsystem *BddSystem; + bddnode *BddOff; + bddnode *BddDc; +{ + bddnode *BddDcOff; + + setbddlocalsystem( BddSystem ); + + BddDcOff = loc_simpbdddcoff( BddOff, BddDc ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddDcOff ); +} diff --git a/alliance/src/bdd/src/bddsimpdc.h b/alliance/src/bdd/src/bddsimpdc.h new file mode 100644 index 00000000..fced84dc --- /dev/null +++ b/alliance/src/bdd/src/bddsimpdc.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsimpdc.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_SIMP_DC_H +# define BDD_SIMP_DC_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsubst.c b/alliance/src/bdd/src/bddsubst.c new file mode 100644 index 00000000..0b543e0e --- /dev/null +++ b/alliance/src/bdd/src/bddsubst.c @@ -0,0 +1,178 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsubst.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddassoc.h" +# include "bddapply.h" +# include "bddsubst.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Substitute Node With Association | +| | +\------------------------------------------------------------*/ + +static bddnode *loc_substbddnode( BddNode ) + + bddnode *BddNode; +{ + bddhoper *HashOper; + bddnode *BddSubst; + bddnode *BddHigh; + bddnode *BddLow; + bddvar NodeVar; + + NodeVar = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( BddLocalAssoc->LAST < NodeVar ) + { + return( incbddrefext( BddNode ) ); + } + + HashOper = searchbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_SUBSTITUTE + BddLocalAssoc->IDENT, + BddNode, BddNode ); + + if ( HashOper != (bddhoper *)0 ) + { + return( incbddrefext( HashOper->FATHER ) ); + } + + BddSubst = BddLocalAssocNode[ NodeVar ]; + + if ( BddSubst == (bddnode *)0 ) + { + BddSubst = BddNode; + } + + if ( BddSubst->INDEX < BDD_INDEX_MIN ) + { + if ( BddSubst->INDEX == BDD_INDEX_ONE ) + { + BddSubst = loc_substbddnode( BddNode->HIGH ); + } + else + { + BddSubst = loc_substbddnode( BddNode->LOW ); + } + } + else + { + BddHigh = decbddrefext( loc_substbddnode( BddNode->HIGH ) ); + BddLow = decbddrefext( loc_substbddnode( BddNode->LOW ) ); + + if ( ( BddSubst->INDEX == BddNode->INDEX ) && + ( NodeVar < BddLocalSystem->INDEX_TO_VAR[ BddHigh->INDEX ] ) && + ( NodeVar < BddLocalSystem->INDEX_TO_VAR[ BddLow->INDEX ] ) ) + { + BddSubst = addbddnode( (bddsystem *)0, BddNode->INDEX, BddHigh, BddLow ); + } + else + { + BddSubst = loc_applybddite( BddSubst, BddHigh, BddLow ); + } + } + + addbddhoper( BddLocalSystem->HASH_OPER, + BDD_OPER_SUBSTITUTE + BddLocalAssoc->IDENT, + BddNode, BddNode, BddSubst ); + + BddLocalAssoc->CACHE = 1; + + return( BddSubst ); +} + +/*------------------------------------------------------------\ +| | +| Substitute Bdd Node With Association | +| | +\------------------------------------------------------------*/ + +bddnode *substbddnodeassoc( BddSystem, BddNode, BddAssoc ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddassoc *BddAssoc; +{ + bddnode *BddSubst; + + if ( checkbddassoc( BddSystem, BddAssoc, 1 ) == 2 ) + { + return( incbddrefext( BddNode ) ); + } + + BddLocalAssoc = BddAssoc; + BddLocalAssocNode = BddAssoc->ASSOC_NODE; + + BddSubst = loc_substbddnode( BddNode ); + + checkbddmaxnode( (bddsystem *)0, 1 ); + + return( BddSubst ); +} diff --git a/alliance/src/bdd/src/bddsubst.h b/alliance/src/bdd/src/bddsubst.h new file mode 100644 index 00000000..17abc04f --- /dev/null +++ b/alliance/src/bdd/src/bddsubst.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsubst.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_SUBST_H +# define BDD_SUBST_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsupport.c b/alliance/src/bdd/src/bddsupport.c new file mode 100644 index 00000000..d8fea219 --- /dev/null +++ b/alliance/src/bdd/src/bddsupport.c @@ -0,0 +1,292 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsupport.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddsupport.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static chain_list *BddGetHeadChain = (chain_list *)0; + static ptype_list *BddGetHeadPType = (ptype_list *)0; + static bddvar BddLocalVariable = (bddvar)0; + static long BddGetSupportSize = 0L; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Get Bdd Node Support PType | +| | +\------------------------------------------------------------*/ + +static void loc_getbddsupportptype( BddNode ) + + bddnode *BddNode; +{ + bddnode *BddVarNode; + + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( ! testbddnodemark( BddLocalSystem, BddNode ) ) ) + { + BddVarNode = BddLocalSystem->VAR_NODE[ BddNode->INDEX ]; + + if ( ! testbddnodemark( BddLocalSystem, BddVarNode ) ) + { + setbddnodemark( BddLocalSystem, BddVarNode ); + + BddGetHeadPType = addptype( BddGetHeadPType, 0, (void *)BddVarNode ); + } + + setbddnodemark( BddLocalSystem, BddNode ); + + loc_getbddsupportptype( BddNode->HIGH ); + loc_getbddsupportptype( BddNode->LOW ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Get Bdd Node Support Chain | +| | +\------------------------------------------------------------*/ + +static void loc_getbddsupportchain( BddNode ) + + bddnode *BddNode; +{ + bddnode *BddVarNode; + + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( ! testbddnodemark( BddLocalSystem, BddNode ) ) ) + { + BddVarNode = BddLocalSystem->VAR_NODE[ BddNode->INDEX ]; + + if ( ! testbddnodemark( BddLocalSystem, BddVarNode ) ) + { + setbddnodemark( BddLocalSystem, BddVarNode ); + + BddGetHeadChain = addchain( BddGetHeadChain, (void *)BddVarNode ); + } + + setbddnodemark( BddLocalSystem, BddNode ); + + loc_getbddsupportchain( BddNode->HIGH ); + loc_getbddsupportchain( BddNode->LOW ); + } +} + +/*------------------------------------------------------------\ +| | +| Bdd Get Node Support | +| | +\------------------------------------------------------------*/ + +void * +#ifdef __STDC__ +getbddnodesupport( bddsystem *BddSystem, bddnode *BddNode, int Mode ) +#else +getbddnodesupport( BddSystem, BddNode, Mode ) + + bddsystem *BddSystem; + bddnode *BddNode; + int Mode; +#endif +{ + setbddlocalsystem( BddSystem ); + newbddsystemmark( BddLocalSystem ); + + if ( Mode == BDD_SUPPORT_CHAIN ) + { + BddGetHeadChain = (chain_list *)0; + loc_getbddsupportchain( BddNode ); + return (void *)BddGetHeadChain; + } + else + { + BddGetHeadPType = (ptype_list *)0; + loc_getbddsupportptype( BddNode ); + return (void *)BddGetHeadPType; + } +} + +/*------------------------------------------------------------\ +| | +| Local Mark Bdd Variable In Support | +| | +\------------------------------------------------------------*/ + +static int +#ifdef __STDC__ +loc_isbddvarinsupport( bddnode *BddNode ) +#else +loc_isbddvarinsupport( BddNode ) + + bddnode *BddNode; +#endif +{ + bddvar Variable; + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNode->INDEX ]; + + if ( ( BddLocalVariable < Variable ) || + ( testbddnodemark( BddLocalSystem, BddNode ) ) ) + { + return( 0 ); + } + + if ( BddLocalVariable == Variable ) + { + return( 1 ); + } + + setbddnodemark( BddLocalSystem, BddNode ); + + if ( loc_isbddvarinsupport( BddNode->HIGH ) ) + { + return( 1 ); + } + + return loc_isbddvarinsupport( BddNode->LOW ); +} + +/*------------------------------------------------------------\ +| | +| Is Bdd Variable In Support | +| | +\------------------------------------------------------------*/ + +int +#ifdef __STDC__ +isbddvarinsupport( bddsystem *BddSystem, bddnode *BddNode, bddvar Variable ) +#else +isbddvarinsupport( BddSystem, BddNode, Variable ) + + bddsystem *BddSystem; + bddnode *BddNode; + bddvar Variable; +#endif +{ + checkbddvar( BddSystem, Variable, 1 ); + + newbddsystemmark( BddLocalSystem ); + BddLocalVariable = Variable; + + return loc_isbddvarinsupport( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Node Support Size | +| | +\------------------------------------------------------------*/ + +static void +#ifdef __STDC__ +loc_getbddsupportsize( bddnode *BddNode ) +#else +loc_getbddsupportsize( BddNode ) + + bddnode *BddNode; +#endif +{ + bddnode *BddVarNode; + + if ( ( BddNode->INDEX >= BDD_INDEX_MIN ) && + ( ! testbddnodemark( BddLocalSystem, BddNode ) ) ) + { + BddVarNode = BddLocalSystem->VAR_NODE[ BddNode->INDEX ]; + + if ( ! testbddnodemark( BddLocalSystem, BddVarNode ) ) + { + setbddnodemark( BddLocalSystem, BddVarNode ); + + BddGetSupportSize += 1; + } + + setbddnodemark( BddLocalSystem, BddNode ); + + loc_getbddsupportsize( BddNode->HIGH ); + loc_getbddsupportsize( BddNode->LOW ); + } +} + +long +#ifdef __STDC__ +getbddnodesupportsize( bddsystem *BddSystem, bddnode *BddNode ) +#else +getbddnodesupportsize( BddSystem, BddNode ) + + bddsystem *BddSystem; + bddnode *BddNode; +#endif +{ + setbddlocalsystem( BddSystem ); + newbddsystemmark( BddLocalSystem ); + + BddGetSupportSize = 0L; + loc_getbddsupportsize( BddNode ); + return BddGetSupportSize; +} diff --git a/alliance/src/bdd/src/bddsupport.h b/alliance/src/bdd/src/bddsupport.h new file mode 100644 index 00000000..df2e1958 --- /dev/null +++ b/alliance/src/bdd/src/bddsupport.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsupport.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_SUPPORT_H +# define BDD_SUPPORT_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define BDD_MARK_SUPPORT_MASK BDD_MARK_NUM_MASK + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsweep.c b/alliance/src/bdd/src/bddsweep.c new file mode 100644 index 00000000..a9528155 --- /dev/null +++ b/alliance/src/bdd/src/bddsweep.c @@ -0,0 +1,96 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsweep.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddsweep.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Sweep System | +| | +\------------------------------------------------------------*/ + +void sweepbddsystem( BddSystem ) + + bddsystem *BddSystem; +{ + bddvar NumberVar; + bddvar Variable; + + setbddlocalsystem( BddSystem ); + + resetbddhopertable( BddLocalSystem->HASH_OPER ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + + for ( Variable = 0; Variable < NumberVar; Variable++ ) + { + sweepbddvar( (bddsystem *)0, Variable, 1 ); + } +} diff --git a/alliance/src/bdd/src/bddsweep.h b/alliance/src/bdd/src/bddsweep.h new file mode 100644 index 00000000..859f4835 --- /dev/null +++ b/alliance/src/bdd/src/bddsweep.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddgarbage.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_GARBAGE_H +# define BDD_GARBAGE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddsystem.c b/alliance/src/bdd/src/bddsystem.c new file mode 100644 index 00000000..443bd122 --- /dev/null +++ b/alliance/src/bdd/src/bddsystem.c @@ -0,0 +1,406 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsystem.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddsystem.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + bddsystem *BddLocalSystem = (bddsystem *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Create System | +| | +\------------------------------------------------------------*/ + +bddsystem *createbddsystem( ModelVar, ModelOper, MaxVar, MaxNode ) + + long ModelVar; + long ModelOper; + long MaxVar; + long MaxNode; +{ + bddsystem *BddSystem; + bddnode *BddOne; + bddnode *BddZero; + long MaxIndex; + + MaxIndex = BDD_INDEX_MIN + MaxVar; + + if ( ModelVar <= 0 ) + { + bdderror( BDD_MODEL_VAR_ERROR, ModelVar ); + } + + if ( MaxVar >= BDD_MAX_VAR ) + { + bdderror( BDD_BAD_VAR_ERROR, MaxVar ); + } + + if ( ModelOper <= 0 ) + { + bdderror( BDD_MODEL_OPER_ERROR, ModelOper ); + } + + BddSystem = allocbddsystem(); + + BddSystem->HASH_OPER = createbddhopertable( ModelOper ); + BddSystem->OPER_MODEL = ModelOper; + + BddSystem->MAX_VAR = MaxVar; + BddSystem->MAX_INDEX = MaxIndex; + BddSystem->MAX_NODE = MaxNode; + BddSystem->VAR_NODE = allocbddvarnode( MaxIndex ); + BddSystem->VAR_MODEL = ModelVar; + + BddSystem->INDEX_NODE = allocbddindexnode( MaxIndex ); + BddSystem->INDEX_NODE[ BDD_INDEX_ZERO ] = createbddhnodetable( ModelVar ); + BddSystem->INDEX_NODE[ BDD_INDEX_ONE ] = BddSystem->INDEX_NODE[ BDD_INDEX_ZERO ]; + + BddSystem->VAR_TO_INDEX = allocbddindex( MaxVar ); + BddSystem->INDEX_TO_VAR = allocbddvar( MaxIndex ); + BddSystem->INDEX_TO_VAR[ BDD_INDEX_ZERO ] = BDD_MAX_VAR; + BddSystem->INDEX_TO_VAR[ BDD_INDEX_ONE ] = BDD_MAX_VAR; + + BddSystem->NUMBER_VAR = 0; + BddSystem->NUMBER_INDEX = BDD_INDEX_MIN; + + setbddlocalsystem( BddSystem ); + + createbddblock( (bddsystem *)0 ); + + BddOne = addbddnode( (bddsystem *)0, BDD_INDEX_ONE , (bddnode *)0, (bddnode *)0 ); + BddZero = addbddnode( (bddsystem *)0, BDD_INDEX_ZERO, (bddnode *)0, (bddnode *)0 ); + + BddOne->REF_EXT = BDD_MAX_REF; + BddOne->REF_INT = BDD_MAX_REF; + BddZero->REF_EXT = BDD_MAX_REF; + BddZero->REF_INT = BDD_MAX_REF; + + BddSystem->ONE = BddOne; + BddSystem->ZERO = BddZero; + + BddSystem->VAR_NODE[ BDD_INDEX_ZERO ] = BddZero; + BddSystem->VAR_NODE[ BDD_INDEX_ONE ] = BddOne; + + return( BddSystem ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Reset System | +| | +\------------------------------------------------------------*/ + +void resetbddsystem( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddnode *BddOne; + bddnode *BddZero; + bddindex NumberIndex; + bddindex Index; + + setbddlocalsystem( BddSystem ); + + resetbddblock( (bddsystem *)0 ); + destroybddassoc( (bddsystem *)0 ); + + resetbddhopertable( BddLocalSystem->HASH_OPER ); + + NumberIndex = BddLocalSystem->NUMBER_INDEX; + IndexNode = BddLocalSystem->INDEX_NODE; + + resetbddhnodetable( IndexNode[ BDD_INDEX_ZERO ] ); + + for ( Index = BDD_INDEX_MIN; Index < NumberIndex; Index++ ) + { + resetbddhnodetable( IndexNode[ Index ] ); + } + + BddLocalSystem->NUMBER_VAR = 0; + BddLocalSystem->NUMBER_INDEX = BDD_INDEX_MIN; + BddLocalSystem->FLAGS = 0; + BddLocalSystem->MARK = 0; + + BddOne = addbddnode( (bddsystem *)0, BDD_INDEX_ONE , (bddnode *)0, (bddnode *)0 ); + BddZero = addbddnode( (bddsystem *)0, BDD_INDEX_ZERO, (bddnode *)0, (bddnode *)0 ); + + BddOne->REF_EXT = BDD_MAX_REF; + BddOne->REF_INT = BDD_MAX_REF; + BddZero->REF_EXT = BDD_MAX_REF; + BddZero->REF_INT = BDD_MAX_REF; + + BddLocalSystem->ONE = BddOne; + BddLocalSystem->ZERO = BddZero; + + BddLocalSystem->VAR_NODE[ BDD_INDEX_ZERO ] = BddZero; + BddLocalSystem->VAR_NODE[ BDD_INDEX_ONE ] = BddOne; + + BddLocalSystem->REORDER_LIMIT = BddLocalSystem->REORDER_LOW; +} + +/*------------------------------------------------------------\ +| | +| Bdd Destroy System | +| | +\------------------------------------------------------------*/ + +void destroybddsystem( BddSystem ) + + bddsystem *BddSystem; +{ + bddindexnode *IndexNode; + bddindex NumberIndex; + bddindex Index; + + setbddlocalsystem( BddSystem ); + + destroybddblock( (bddsystem *)0 ); + destroybddassoc( (bddsystem *)0 ); + destroybdduserfunc( (bddsystem *)0 ); + + destroybddhopertable( BddLocalSystem->HASH_OPER ); + + NumberIndex = BddLocalSystem->NUMBER_INDEX; + IndexNode = BddLocalSystem->INDEX_NODE; + + destroybddhnodetable( IndexNode[ BDD_INDEX_ZERO ] ); + + for ( Index = BDD_INDEX_MIN; Index < NumberIndex; Index++ ) + { + destroybddhnodetable( IndexNode[ Index ] ); + } + + freebddvar( BddLocalSystem->INDEX_TO_VAR ); + freebddindex( BddLocalSystem->VAR_TO_INDEX ); + + freebddindexnode( BddLocalSystem->INDEX_NODE ); + freebddvarnode( BddLocalSystem->VAR_NODE ); + + freebddsystem( BddLocalSystem ); + + BddLocalSystem = (bddsystem *)0; +} + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd View System | +| | +\------------------------------------------------------------*/ + +void viewbddsystem( BddSystem, ViewIndex ) + + bddsystem *BddSystem; + char ViewIndex; +{ + bddvar *IndexToVar; + bddindex *VarToIndex; + bddvar Variable; + bddindex Index; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + fprintf( stdout, "--> BddSystem\n" ); + + fprintf( stdout, " NUMBER_NODE : %ld\n", BddSystem->NUMBER_NODE ); + fprintf( stdout, " NUMBER_FREE : %ld\n", BddSystem->NUMBER_FREE ); + fprintf( stdout, " MAX_NODE : %ld\n", BddSystem->MAX_NODE ); + fprintf( stdout, " TOP_NODE : %ld\n", BddSystem->TOP_NODE ); + fprintf( stdout, " NUMBER_VAR : %ld\n", BddSystem->NUMBER_VAR ); + fprintf( stdout, " MAX_VAR : %ld\n", BddSystem->MAX_VAR ); + fprintf( stdout, " NUMBER_INDEX : %ld\n", BddSystem->NUMBER_INDEX ); + fprintf( stdout, " MAX_INDEX : %ld\n", BddSystem->MAX_INDEX ); + fprintf( stdout, " ASSOC_RESET : %d\n" , BddSystem->ASSOC_RESET ); + fprintf( stdout, " FLAGS : %lx\n", BddSystem->FLAGS ); + fprintf( stdout, " REORDER_LOW : %ld\n", BddSystem->REORDER_LOW ); + fprintf( stdout, " REORDER_LIMIT : %ld\n", BddSystem->REORDER_LIMIT ); + fprintf( stdout, " REORDER_RATIO : %ld\n", BddSystem->REORDER_RATIO ); + fprintf( stdout, " EXPLOSION_LIMIT : %ld\n", BddSystem->EXPLOSION_LIMIT ); + fprintf( stdout, " VAR_MODEL : %ld\n", BddSystem->VAR_MODEL ); + fprintf( stdout, " OPER_MODEL : %ld\n", BddSystem->OPER_MODEL ); + + if ( ViewIndex ) + { + IndexToVar = BddSystem->INDEX_TO_VAR; + VarToIndex = BddSystem->VAR_TO_INDEX; + + for ( Index = 0; Index < BddSystem->NUMBER_INDEX; Index++ ) + { + fprintf( stdout, " INDEX_TO_VAR[ %d ] = %d\n", + Index, IndexToVar[ Index ] ); + } + + for ( Variable = 0; Variable < BddSystem->NUMBER_VAR; Variable++ ) + { + fprintf( stdout, " VAR_TO_INDEX[ %d ] = %d\n", + Variable, VarToIndex[ Variable ] ); + } + } + + fprintf( stdout, "<-- BddSystem\n" ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View System Info | +| | +\------------------------------------------------------------*/ + +void viewbddsysteminfo( BddSystem ) + + bddsystem *BddSystem; +{ + bddhopertable *HashOper; + bddindexnode *IndexNode; + bddhnodetable *HashTable; + long NumberIndex; + long Index; + long Sum; + long Slot; + long Fill; + long Hit; + long Miss; + long Stretch; + long Resize; + long Scan; + + if ( BddSystem == (bddsystem *)0 ) + { + BddSystem = BddLocalSystem; + } + + HashOper = BddSystem->HASH_OPER; + IndexNode = BddSystem->INDEX_NODE; + + fprintf( stdout, "--> BddSystem Info\n" ); + + Slot = HashOper->TABLE_SIZE; + Fill = ( HashOper->NUMBER_OPER * 100 ) / Slot; + Sum = HashOper->NUMBER_HIT + HashOper->NUMBER_MISS; + + if ( Sum != 0 ) + { + Hit = ( 100 * HashOper->NUMBER_HIT ) / Sum; + Miss = ( 100 * HashOper->NUMBER_MISS ) / Sum; + } + else + { + Hit = Miss = -1; + } + + fprintf( stdout, " HASH_OPER SLOTS : %ld \n", Slot ); + fprintf( stdout, " HASH_OPER FILL RATE : %ld %%\n", Fill ); + fprintf( stdout, " HASH_OPER HIT RATE : %ld %%\n", Hit ); + fprintf( stdout, " HASH_OPER MISS RATE : %ld %%\n", Miss ); + + Slot = 0; + Fill = 0; + Scan = 0; + Stretch = 0; + Resize = 0; + + NumberIndex = BddLocalSystem->NUMBER_INDEX; + + for ( Index = BDD_INDEX_MIN; Index < NumberIndex; Index++ ) + { + HashTable = IndexNode[ Index ]; + + Slot += HashTable->TABLE_SIZE; + Fill += ( HashTable->NUMBER_NODE * 100 ) / HashTable->TABLE_SIZE; + Scan += HashTable->NUMBER_SCAN; + Stretch += HashTable->NUMBER_STRETCH; + Resize += HashTable->NUMBER_RESIZE; + } + + NumberIndex -= BDD_INDEX_MIN; + + Slot /= NumberIndex; + Fill /= NumberIndex; + Scan /= NumberIndex; + Stretch /= NumberIndex; + Resize /= NumberIndex; + + fprintf( stdout, " HASH_NODE SLOTS AVERAGE : %ld \n", Slot ); + fprintf( stdout, " HASH_NODE FILL RATE : %ld %%\n", Fill ); + fprintf( stdout, " HASH_NODE SCAN AVERAGE : %ld \n", Scan ); + fprintf( stdout, " HASH_OPER STRETCH AVERAGE : %ld \n", Stretch ); + fprintf( stdout, " HASH_OPER RESIZE AVERAGE : %ld \n", Resize ); + + fprintf( stdout, "<-- BddSystem Info\n" ); +} diff --git a/alliance/src/bdd/src/bddsystem.h b/alliance/src/bdd/src/bddsystem.h new file mode 100644 index 00000000..3b2de033 --- /dev/null +++ b/alliance/src/bdd/src/bddsystem.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddsystem.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_SYSTEM_H +# define BDD_SYSTEM_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddtest.c b/alliance/src/bdd/src/bddtest.c new file mode 100644 index 00000000..ab4bbfd6 --- /dev/null +++ b/alliance/src/bdd/src/bddtest.c @@ -0,0 +1,1864 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddtest.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include "bddtest.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static char TestBuffer[ BDD_TEST_BUFFER_SIZE ]; + static char TestExit = 0; + static char TestLogout = 0; + static char TestViewSumProd = 0; + + static command TestCommandDefine[ BDD_TEST_MAX_COMMAND ] = + { + { "addass" , TestCommandAddAssoc , "in out" }, + { "addaux" , TestCommandAddAuxiliar, "aux out [s|g]" }, + { "addin" , TestCommandAddInput , "in [f|l|b|a] [in]" }, + { "addout" , TestCommandAddOutput , "out" }, + { "cofact" , TestCommandCofactor , "out out" }, + { "compose" , TestCommandCompose , "out in out" }, + { "delass" , TestCommandDelAssoc , "[in]" }, + { "delout" , TestCommandDelOutput , "out" }, + { "dumpcir" , TestCommandDumpCircuit, "name" }, + { "exist" , TestCommandExist , "out [m]" }, + { "forall" , TestCommandForall , "out [m]" }, + { "fraction" , TestCommandFraction , "out" }, + { "garbage" , TestCommandGarbage , "none" }, + { "help" , TestCommandHelp , "[keyword]" }, + { "imply" , TestCommandImply , "out out" }, + { "inter" , TestCommandIntersect , "out out" }, + { "list" , TestCommandHelp , "[keyword]" }, + { "logout" , TestCommandLogout , "none" }, + { "optimize" , TestCommandOptimize , "[s|n]" }, + { "quit" , TestCommandExit , "none" }, + { "reduce" , TestCommandReduce , "out out" }, + { "relprod" , TestCommandRelProduct , "out out" }, + { "renin" , TestCommandRenInput , "in name" }, + { "reorder" , TestCommandReorder , "[s|w|t]" }, + { "restrict" , TestCommandRestrict , "out in 0|1" }, + { "satisfy" , TestCommandSatisfy , "out [a]" }, + { "simpoff" , TestCommandSimpOff , "out out" }, + { "simpon" , TestCommandSimpOn , "out out" }, + { "subst" , TestCommandSubstitute , "out" }, + { "support" , TestCommandSupport , "out" }, + { "swapvar" , TestCommandSwapVar , "variable" }, + { "sweep" , TestCommandSweep , "none" }, + { "viewass" , TestCommandViewAssoc , "none" }, + { "viewblo" , TestCommandViewBlock , "none" }, + { "viewcir" , TestCommandViewCircuit, "none" }, + { "viewhea" , TestCommandViewHeath , "out" }, + { "viewid" , TestCommandViewIndex , "[index]" }, + { "viewin" , TestCommandViewInput , "[in]" }, + { "viewop" , TestCommandViewOper , "none" }, + { "viewout" , TestCommandViewOutput , "[out]" }, + { "viewsum" , TestCommandViewSumProd, "none" }, + { "viewsys" , TestCommandViewSystem , "[i]" }, + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Test Get Name | +| | +\------------------------------------------------------------*/ + +static char *TestGetName( Name ) + + char *Name; +{ + char *Scan; + + Scan = strchr( Name, '(' ); + if ( Scan != (char *)0 ) *Scan = ' '; + + Scan = strchr( Name, ')' ); + if ( Scan != (char *)0 ) *Scan = '\0'; + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Compare | +| | +\------------------------------------------------------------*/ + +static int TestCommandCompare( FirstKey, SecondKey ) + + command *FirstKey; + command *SecondKey; +{ + return( strcmp( FirstKey->NAME, SecondKey->NAME ) ); +} + +/*------------------------------------------------------------\ +| | +| Test Get Command Value | +| | +\------------------------------------------------------------*/ + +static command *TestGetCommand( String ) + + char *String; +{ + command Entry; + + Entry.NAME = String; + + return( (command *)bsearch( (char *)(&Entry), + (char *)TestCommandDefine, + BDD_TEST_MAX_COMMAND, + sizeof( command ), + TestCommandCompare ) ); +} + +/*------------------------------------------------------------\ +| | +| Test View Input Element | +| | +\------------------------------------------------------------*/ + +static void TestViewInput( Element ) + + authelem *Element; +{ + fprintf( stdout, "NAME: '%s' ", Element->KEY ); + + viewbddnode( (bddsystem *)0, (bddnode *)( Element->VALUE ) ); +} + +/*------------------------------------------------------------\ +| | +| Test View Node Expression | +| | +\------------------------------------------------------------*/ + +static void TestViewNodeExpr( BddNode ) + + bddnode *BddNode; +{ + chain_list *Expr; + + if ( TestViewSumProd != 2 ) + { + viewbddnode( (bddsystem *)0, BddNode ); + + if ( TestViewSumProd == 1 ) + { + Expr = convertbddcircuitsumabl( (bddcircuit *)0, BddNode ); + } + else + { + Expr = convertbddcircuitabl( (bddcircuit *)0, BddNode ); + } + + viewablexpr( Expr, ABL_VIEW_INFIX ); + delablexpr( Expr ); + } + + fprintf( stdout, "\n" ); + +} + +/*------------------------------------------------------------\ +| | +| Test View Assoc | +| | +\------------------------------------------------------------*/ + +static void TestViewAssoc( Variable, BddNode ) + + bddvar Variable; + bddnode *BddNode; +{ + char *NameIn; + bddindex BddIndex; + + BddIndex = getbddvarindex( BddLocalSystem, Variable ); + NameIn = getbddcircuitinname( BddLocalCircuit, BddIndex ); + + fprintf( stdout, "%s -> ", NameIn ); + TestViewNodeExpr( BddNode ); +} + + +/*------------------------------------------------------------\ +| | +| Test View Output Element | +| | +\------------------------------------------------------------*/ + +static void TestViewOutput( Element ) + + authelem *Element; +{ + fprintf( stdout, "NAME: '%s' ", Element->KEY ); + + TestViewNodeExpr( (bddnode *)( Element->VALUE ) ); +} + +/*------------------------------------------------------------\ +| | +| Command Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Test Command Exit | +| | +\------------------------------------------------------------*/ + +static void TestCommandExit( String ) + + char *String; +{ + fprintf( stdout, "--> exit\n" ); + TestExit = 1; +} + +/*------------------------------------------------------------\ +| | +| Test Command Logout | +| | +\------------------------------------------------------------*/ + +static void TestCommandLogout( String ) + + char *String; +{ + fprintf( stdout, "--> logout\n" ); + TestLogout = 1; +} + +/*------------------------------------------------------------\ +| | +| Test Command Optimize | +| | +\------------------------------------------------------------*/ + +static void TestCommandOptimize( String ) + + char *String; +{ + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 'n' ) ) + { + fprintf( stdout, "--> optimize num nodes\n" ); + fprintf( stdout, "Number nodes before optimization%ld\n", getbddcircuitnumnode( (bddcircuit *)0 )); + + optimizebddcircuit( (bddcircuit *)0, getbddcircuitnumnode, 2.0 ); + + fprintf( stdout, "Number nodes after optimization%ld\n", getbddcircuitnumnode( (bddcircuit *)0 )); + } + + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 's' ) ) + { + fprintf( stdout, "--> optimize size\n" ); + fprintf( stdout, "Size before optimization %ld\n", getbddcircuitsize( (bddcircuit *)0 )); + + optimizebddcircuit( (bddcircuit *)0, getbddcircuitsize, 2.0 ); + + fprintf( stdout, "Size after optimization %ld\n", getbddcircuitsize( (bddcircuit *)0 )); + } + +} + +/*------------------------------------------------------------\ +| | +| Test Command Help | +| | +\------------------------------------------------------------*/ + +static void TestCommandHelp( String ) + + char *String; +{ + command *Command; + int Counter; + + fprintf( stdout, "--> help" ); + + if ( String != (char *)0 ) + { + Command = TestGetCommand( String ); + + if ( Command != (command *)0 ) + { + fprintf( stdout, " %s %s\n", Command->NAME, Command->COMMENT ); + + return; + } + } + + for ( Counter = 0; Counter < BDD_TEST_MAX_COMMAND; Counter++ ) + { + if ( ( Counter & 0x3 ) == 0 ) + { + fprintf( stdout, "\n" ); + } + + fprintf( stdout, " %-8s", TestCommandDefine[ Counter ].NAME ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View SumProd | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewSumProd( String ) + + char *String; +{ + TestViewSumProd = ( TestViewSumProd + 1 ) % 3; + + fprintf( stdout, "--> viewsum %d\n", TestViewSumProd ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Input | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddInput( String ) + + char *String; +{ + bddnode *BddNode; + bddnode *BddNodeIn; + bddindex BddIndex; + char *Scan; + char *NameIn; + char *NameIn2; + long Mode; + + if ( String != (char *)0 ) + { + BddIndex = 0; + Mode = BDD_IN_MODE_LAST; + + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + NameIn = TestGetName( String ); + + switch( Scan[ 1 ] ) + { + case 'f' : Mode = BDD_IN_MODE_FIRST; + break; + case 'l' : Mode = BDD_IN_MODE_LAST; + break; + case 'b' : Mode = BDD_IN_MODE_BEFORE; + break; + case 'a' : Mode = BDD_IN_MODE_AFTER; + break; + } + + if ( ( Mode == BDD_IN_MODE_AFTER ) || + ( Mode == BDD_IN_MODE_BEFORE ) ) + { + String = Scan + 2; + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + NameIn2 = TestGetName( Scan + 1 ); + + BddNodeIn = searchbddcircuitin( (bddcircuit *)0, NameIn2 ); + + if ( BddNodeIn == (bddnode *)0 ) + { + Mode = BDD_IN_MODE_LAST; + } + else + { + BddIndex = BddNodeIn->INDEX; + String = NameIn2; + } + } + else + { + Mode = BDD_IN_MODE_LAST; + } + } + } + else + { + NameIn = TestGetName( String ); + } + + fprintf( stdout, "--> addin %s %ld %s\n", NameIn, Mode, String ); + BddNode = addbddcircuitin( (bddcircuit *)0, NameIn, BddIndex, Mode ); + + viewbddnode( (bddsystem *)0, BddNode ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Ren Input | +| | +\------------------------------------------------------------*/ + +static void TestCommandRenInput( String ) + + char *String; +{ + bddnode *BddNode; + char *Scan; + char *NameIn; + char *NameIn2; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + NameIn = TestGetName( String ); + NameIn2 = TestGetName( Scan + 1 ); + + fprintf( stdout, "--> renin %s %s\n", NameIn, NameIn2 ); + BddNode = renamebddcircuitin( (bddcircuit *)0, NameIn, NameIn2 ); + + if ( BddNode != (bddnode *)0 ) + { + viewbddnode( (bddsystem *)0, BddNode ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Auxiliar | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddAuxiliar( String ) + + char *String; +{ + bddnode *BddNode; + bddnode *BddNodeOut; + char *Scan; + char *NameAux; + long Mode; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + + NameAux = TestGetName( String ); + String = Scan + 1; + + Scan = strchr( String, ' ' ); + Mode = BDD_AUX_MODE_SINGLE; + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + + switch( Scan[ 1 ] ) + { + case 's' : Mode = BDD_AUX_MODE_SINGLE; + break; + case 'g' : Mode = BDD_AUX_MODE_GLOBAL; + break; + } + } + + String = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut != (bddnode *)0 ) + { + fprintf( stdout, "--> addaux %s %s %ld\n", NameAux, String, Mode ); + BddNode = addbddcircuitaux( (bddcircuit *)0, NameAux, BddNodeOut, (void *)0, Mode ); + + viewbddnode( (bddsystem *)0, BddNode ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Assoc | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddAssoc( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeIn; + bddnode *BddNodeOut; + char *Scan; + char *NameIn; + bddvar Variable; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + + *Scan = '\0'; + NameIn = TestGetName( String ); + + BddNodeIn = searchbddcircuitin( (bddcircuit *)0, NameIn ); + + if ( BddNodeIn == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut == (bddnode *)0 ) + { + BddNodeOut = searchbddcircuitin( (bddcircuit *)0, String ); + + if ( BddNodeOut == (bddnode *)0 ) return; + } + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNodeIn->INDEX ]; + + fprintf( stdout, "--> addassoc %s %s\n", NameIn, String ); + + if ( BddLocalSystem->ASSOC == (bddassoc *)0 ) + { + BddAssoc = addbddassoc( (bddsystem *)0 ); + } + else + { + BddAssoc = BddLocalSystem->ASSOC; + } + + BddAssoc = addbddnodeassoc( (bddsystem *)0, BddAssoc, + Variable , BddNodeOut ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Del Assoc | +| | +\------------------------------------------------------------*/ + +static void TestCommandDelAssoc( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeIn; + bddvar Variable; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( BddAssoc != (bddassoc *)0 ) + { + if ( String != (char *)0 ) + { + String = TestGetName( String ); + BddNodeIn = searchbddcircuitin( (bddcircuit *)0, String ); + + if ( BddNodeIn == (bddnode *)0 ) return; + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNodeIn->INDEX ]; + + fprintf( stdout, "--> delassoc %s\n", String ); + + delbddnodeassoc( (bddsystem *)0, BddAssoc, Variable ); + } + else + { + fprintf( stdout, "--> delassoc\n" ); + + delbddassoc( (bddsystem *)0, BddAssoc ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Assoc | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewAssoc( String ) + + char *String; +{ + bddassoc *BddAssoc; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( BddAssoc != (bddassoc *)0 ) + { + fprintf( stdout, "--> viewassoc\n" ); + + viewbddassoc( (bddsystem *)0, BddAssoc, TestViewAssoc ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Input | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewInput( String ) + + char *String; +{ + bddnode *BddNode; + + if ( String != (char *)0 ) + { + String = TestGetName( String ); + fprintf( stdout, "--> viewin %s\n", String ); + BddNode = searchbddcircuitin( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + viewbddnode( (bddsystem *)0, BddNode ); + } + else + { + fprintf( stderr, "Input %s doesn't exist\n", String ); + } + } + else + { + viewauthtable( BddLocalCircuit->HASH_IN, TestViewInput ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Add Output | +| | +\------------------------------------------------------------*/ + +static void TestCommandAddOutput( String ) + + char *String; +{ + bddnode *BddNode; + char *Scan; + chain_list *Expr; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + String = TestGetName( String ); + + Expr = strablexpr( Scan + 1, ABL_VIEW_INFIX ); + + if ( Expr != (chain_list *)0 ) + { + BddNode = addbddcircuitabl( (bddcircuit *)0, Expr ); + decbddrefext( BddNode ); + + delablexpr( Expr ); + + fprintf( stdout, "--> addout %s\n", String ); + + BddNode = addbddcircuitout( (bddcircuit *)0, String, BddNode ); + + TestViewNodeExpr( BddNode ); + } + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Del Output | +| | +\------------------------------------------------------------*/ + +static void TestCommandDelOutput( String ) + + char *String; +{ + char *Scan; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = TestGetName( String ); + + if ( delbddcircuitout( (bddcircuit *)0, String ) ) + { + fprintf( stdout, "--> delout %s\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Support Output | +| | +\------------------------------------------------------------*/ + +static void TestCommandSupport( String ) + + char *String; +{ + bddnode *BddNode; + chain_list *Support; + chain_list *ScanChain; + + if ( String != (char *)0 ) + { + String = TestGetName( String ); + fprintf( stdout, "--> support %s\n", String ); + BddNode = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + Support = getbddnodesupportchain( (bddsystem *)0, BddNode ); + + for ( ScanChain = Support; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewbddnode( (bddsystem *)0, ScanChain->DATA ); + } + + freechain( Support ); + } + else + { + fprintf( stderr, "Output %s doesn't exist\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Output | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewOutput( String ) + + char *String; +{ + bddnode *BddNode; + + if ( String != (char *)0 ) + { + String = TestGetName( String ); + fprintf( stdout, "--> viewout %s\n", String ); + BddNode = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + TestViewNodeExpr( BddNode ); + } + else + { + fprintf( stderr, "Output %s doesn't exist\n", String ); + } + } + else + { + viewauthtable( BddLocalCircuit->HASH_OUT, TestViewOutput ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Heath | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewHeath( String ) + + char *String; +{ + bddnode *BddNode; + char *Scan; + bddheath *BddHeath; + bddheath *ScanHeath; + chain_list *Expr; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = TestGetName( String ); + fprintf( stdout, "--> viewheath %s\n", String ); + BddNode = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + BddHeath = getbddheath( (bddsystem *)0, BddNode ); + + for ( ScanHeath = BddHeath; + ScanHeath != (bddheath *)0; + ScanHeath = ScanHeath->NEXT ) + { + fprintf( stdout, "Variable: " ); + Expr = convertbddcircuitabl( (bddcircuit *)0, ScanHeath->VAR ); + viewablexpr( Expr, ABL_VIEW_INFIX ); + delablexpr( Expr ); + fprintf( stdout, " Plus: " ); + Expr = convertbddcircuitabl( (bddcircuit *)0, ScanHeath->PLUS ); + viewablexpr( Expr, ABL_VIEW_INFIX ); + delablexpr( Expr ); + fprintf( stdout, " Minus: " ); + + Expr = convertbddcircuitabl( (bddcircuit *)0, ScanHeath->MINUS ); + viewablexpr( Expr, ABL_VIEW_INFIX ); + fprintf( stdout, "\n" ); + delablexpr( Expr ); + } + } + else + { + fprintf( stderr, "Output %s doesn't exist\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Hash Oper | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewOper( String ) + + char *String; +{ + fprintf( stdout, "--> viewop\n" ); + viewbddhopertable( BddLocalSystem->HASH_OPER, viewbddhoper ); +} + +/*------------------------------------------------------------\ +| | +| Test Command View Index Node | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewIndex( String ) + + char *String; +{ + char *Scan; + long Index; + + fprintf( stdout, "--> viewid\n" ); + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + Index = atol( String ); + + if ( checkbddindex( (bddsystem *)0, Index, 0 ) ) + { + viewbddhnodetable( BddLocalSystem->INDEX_NODE[ Index ], TestViewNodeExpr ); + + return; + } + } + + viewbddindexnode( (bddsystem *)0, viewbddhnode ); +} + +/*------------------------------------------------------------\ +| | +| Test Command View Block Node | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewBlock( String ) + + char *String; +{ + fprintf( stdout, "--> viewblo\n" ); + viewbddblock( (bddsystem *)0, viewbddhnode ); +} + +/*------------------------------------------------------------\ +| | +| Test Command View System | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewSystem( String ) + + char *String; +{ + fprintf( stdout, "--> viewsys\n" ); + + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 'i' ) ) + { + viewbddsystem( (bddsystem *)0, 1 ); + } + else + { + viewbddsystem( (bddsystem *)0, 0 ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command View Circuit | +| | +\------------------------------------------------------------*/ + +static void TestCommandViewCircuit( String ) + + char *String; +{ + fprintf( stdout, "--> viewcir\n" ); + viewbddcircuit( (bddcircuit *)0, 1 ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Dump Circuit | +| | +\------------------------------------------------------------*/ + +static void TestCommandDumpCircuit( String ) + + char *String; +{ + if ( String != (char *)0 ) + { + dumpbddcircuit( (bddcircuit *)0, String ); + fprintf( stdout, "--> dumpcir %s\n", String ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Swap Variable | +| | +\------------------------------------------------------------*/ + +static void TestCommandSwapVar( String ) + + char *String; +{ + long Variable; + + if ( String != (char *)0 ) + { + Variable = atol( String ); + + if ( ( checkbddvar( (bddsystem *)0, Variable , 0 ) ) && + ( checkbddvar( (bddsystem *)0, Variable + 1, 0 ) ) ) + { + fprintf( stdout, "--> swapvar %ld with %ld\n", Variable, Variable + 1 ); + + swapbddvar( (bddsystem *)0, Variable ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Sweep | +| | +\------------------------------------------------------------*/ + +static void TestCommandSweep( String ) + + char *String; +{ + fprintf( stdout, "--> sweep\n" ); + fprintf( stdout, "Number nodes before %ld\n", BddLocalSystem->NUMBER_NODE ); + sweepbddsystem( (bddsystem *)0 ); + fprintf( stdout, "Number nodes after %ld\n", BddLocalSystem->NUMBER_NODE ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Garbage Collection | +| | +\------------------------------------------------------------*/ + +static void TestCommandGarbage( String ) + + char *String; +{ + fprintf( stdout, "--> garbage\n" ); + fprintf( stdout, "Number nodes before %ld\n", BddLocalSystem->NUMBER_NODE ); + garbagebddsystem( (bddsystem *)0 ); + fprintf( stdout, "Number nodes after %ld\n", BddLocalSystem->NUMBER_NODE ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Reorder | +| | +\------------------------------------------------------------*/ + +static void TestCommandReorder( String ) + + char *String; +{ + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 'w' ) ) + { + fprintf( stdout, "--> reorder window\n" ); + fprintf( stdout, "Number nodes before %ld\n", BddLocalSystem->NUMBER_NODE ); + + reorderbddsystemwindow( (bddsystem *)0 ); + } + + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 's' ) ) + { + fprintf( stdout, "--> reorder simple\n" ); + fprintf( stdout, "Number nodes before %ld\n", BddLocalSystem->NUMBER_NODE ); + + reorderbddsystemsimple( (bddsystem *)0 ); + } + + if ( ( String != (char *)0 ) && + ( String[ 0 ] == 't' ) ) + { + fprintf( stdout, "--> reorder top\n" ); + fprintf( stdout, "Number nodes before %ld\n", BddLocalSystem->NUMBER_NODE ); + + reorderbddsystemtop( (bddsystem *)0 ); + } + + fprintf( stdout, "Number nodes after %ld\n", BddLocalSystem->NUMBER_NODE ); +} + +/*------------------------------------------------------------\ +| | +| Test Command Restrict | +| | +\------------------------------------------------------------*/ + +static void TestCommandRestrict( String ) + + char *String; +{ + bddnode *BddNodeOut; + bddnode *BddNodeIn; + bddnode *BddNodeOne; + char *Scan; + char *NameOut; + long Value; + bddvar Variable; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + + *Scan = '\0'; + NameOut = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + String = Scan + 1; + Scan = strchr( String, ' ' ); + if ( Scan == (char *)0 ) return; + + *Scan = '\0'; + String = TestGetName( String ); + BddNodeIn = searchbddcircuitin( (bddcircuit *)0, String ); + + if ( BddNodeIn == (bddnode *)0 ) return; + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNodeIn->INDEX ]; + Value = atol( Scan + 1 ); + + if ( Value ) + { + BddNodeOne = BddLocalSystem->ONE; + } + else + { + BddNodeOne = BddLocalSystem->ZERO; + } + + fprintf( stdout, "--> restrict %s %s %ld\n", NameOut, String, Value ); + + BddNodeOut = restrictbddnode( (bddsystem *)0, + BddNodeOut, Variable, BddNodeOne ); + decbddrefext( BddNodeOut ); + + TestViewNodeExpr( BddNodeOut ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Compose | +| | +\------------------------------------------------------------*/ + +static void TestCommandCompose( String ) + + char *String; +{ + bddnode *BddNodeOut; + bddnode *BddNodeIn; + bddnode *BddNodeSubst; + char *Scan; + char *NameOut; + char *NameIn; + bddvar Variable; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + + *Scan = '\0'; + NameOut = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + String = Scan + 1; + Scan = strchr( String, ' ' ); + if ( Scan == (char *)0 ) return; + + *Scan = '\0'; + NameIn = TestGetName( String ); + BddNodeIn = searchbddcircuitin( (bddcircuit *)0, NameIn ); + + if ( BddNodeIn == (bddnode *)0 ) return; + + Variable = BddLocalSystem->INDEX_TO_VAR[ BddNodeIn->INDEX ]; + + String = TestGetName( Scan + 1 ); + BddNodeSubst = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeSubst == (bddnode *)0 ) return; + + fprintf( stdout, "--> compose %s %s %s\n", NameOut, NameIn, String ); + + BddNodeOut = composebddnode( (bddsystem *)0, + BddNodeOut, Variable, BddNodeSubst ); + decbddrefext( BddNodeOut ); + addbddcircuitout( (bddcircuit *)0, NameOut, BddNodeOut ); + + TestViewNodeExpr( BddNodeOut ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Substitute | +| | +\------------------------------------------------------------*/ + +static void TestCommandSubstitute( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeOut; + bddnode *BddNodeSubst; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( BddAssoc != (bddassoc *)0 ) + { + if ( String != (char *)0 ) + { + String = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + fprintf( stdout, "--> subst %s\n", String ); + + BddNodeSubst = substbddnodeassoc( (bddsystem *)0, BddNodeOut, BddAssoc ); + decbddrefext( BddNodeSubst ); + + TestViewNodeExpr( BddNodeSubst ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Relational Product | +| | +\------------------------------------------------------------*/ + +static void TestCommandRelProduct( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeOut1; + bddnode *BddNodeOut2; + bddnode *BddNodeRelProd; + char *NameOut; + char *Scan; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( BddAssoc != (bddassoc *)0 ) + { + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut1 = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut1 == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeOut2 = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut2 == (bddnode *)0 ) return; + + fprintf( stdout, "--> relprod %s %s\n", NameOut, String ); + + BddNodeRelProd = relprodbddnodeassoc( (bddsystem *)0, BddNodeOut1, + BddNodeOut2, BddAssoc ); + decbddrefext( BddNodeRelProd ); + + TestViewNodeExpr( BddNodeRelProd ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Forall | +| | +\------------------------------------------------------------*/ + +static void TestCommandForall( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeOut; + bddnode *BddNodeForall; + char *Scan; + int Miss; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( ( BddAssoc != (bddassoc *)0 ) && + ( BddAssoc->FIRST != BDD_MAX_VAR ) ) + { + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + Miss = 0; + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + if ( Scan[ 1 ] == 'm' ) Miss = 1; + } + + String = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + fprintf( stdout, "--> forall %s %d\n", String, Miss ); + + if ( Miss ) + { + BddNodeForall = forallbddnodemissassoc( (bddsystem *)0, BddNodeOut, BddAssoc ); + } + else + { + BddNodeForall = forallbddnodeassoc( (bddsystem *)0, BddNodeOut, BddAssoc ); + } + + decbddrefext( BddNodeForall ); + + TestViewNodeExpr( BddNodeForall ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Exist | +| | +\------------------------------------------------------------*/ + +static void TestCommandExist( String ) + + char *String; +{ + bddassoc *BddAssoc; + bddnode *BddNodeOut; + bddnode *BddNodeExist; + char *Scan; + int Miss; + + BddAssoc = BddLocalSystem->ASSOC; + + if ( ( BddAssoc != (bddassoc *)0 ) && + ( BddAssoc->FIRST != BDD_MAX_VAR ) ) + { + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + Miss = 0; + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + if ( Scan[ 1 ] == 'm' ) Miss = 1; + } + + String = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + fprintf( stdout, "--> exist %s %d\n", String, Miss ); + + if ( Miss ) + { + BddNodeExist = existbddnodemissassoc( (bddsystem *)0, BddNodeOut, BddAssoc ); + } + else + { + BddNodeExist = existbddnodeassoc( (bddsystem *)0, BddNodeOut, BddAssoc ); + } + + decbddrefext( BddNodeExist ); + + TestViewNodeExpr( BddNodeExist ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Simp Off | +| | +\------------------------------------------------------------*/ + +static void TestCommandSimpOff( String ) + + char *String; +{ + bddnode *BddNodeOut; + bddnode *BddNodeDc; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeDc = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeDc == (bddnode *)0 ) return; + + fprintf( stdout, "--> simp off %s with %s\n", NameOut, String ); + + BddNodeOut = simpbddnodedcoff( (bddsystem *)0, BddNodeOut, BddNodeDc ); + + decbddrefext( BddNodeOut ); + addbddcircuitout( (bddcircuit *)0, NameOut, BddNodeOut ); + + TestViewNodeExpr( BddNodeOut ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Simp On | +| | +\------------------------------------------------------------*/ + +static void TestCommandSimpOn( String ) + + char *String; +{ + bddnode *BddNodeOut; + bddnode *BddNodeDc; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeDc = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeDc == (bddnode *)0 ) return; + + fprintf( stdout, "--> simp on %s with %s\n", NameOut, String ); + + BddNodeOut = simpbddnodedcon( (bddsystem *)0, BddNodeOut, BddNodeDc ); + + decbddrefext( BddNodeOut ); + addbddcircuitout( (bddcircuit *)0, NameOut, BddNodeOut ); + + TestViewNodeExpr( BddNodeOut ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Imply | +| | +\------------------------------------------------------------*/ + +static void TestCommandImply( String ) + + char *String; +{ + bddnode *BddNodeOut1; + bddnode *BddNodeOut2; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut1 = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut1 == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeOut2 = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut2 == (bddnode *)0 ) return; + + fprintf( stdout, "--> imply %s and %s\n", NameOut, String ); + + BddNodeOut1 = implybddnode( (bddsystem *)0, BddNodeOut1, BddNodeOut2 ); + decbddrefext( BddNodeOut1 ); + + TestViewNodeExpr( BddNodeOut1 ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Intersect | +| | +\------------------------------------------------------------*/ + +static void TestCommandIntersect( String ) + + char *String; +{ + bddnode *BddNodeOut1; + bddnode *BddNodeOut2; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut1 = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut1 == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeOut2 = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut2 == (bddnode *)0 ) return; + + fprintf( stdout, "--> intersect %s and %s\n", NameOut, String ); + + BddNodeOut1 = intersectbddnode( (bddsystem *)0, BddNodeOut1, BddNodeOut2 ); + decbddrefext( BddNodeOut1 ); + + TestViewNodeExpr( BddNodeOut1 ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Cofactor | +| | +\------------------------------------------------------------*/ + +static void TestCommandCofactor( String ) + + char *String; +{ + bddnode *BddNodeOut1; + bddnode *BddNodeOut2; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut1 = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut1 == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeOut2 = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut2 == (bddnode *)0 ) return; + + fprintf( stdout, "--> cofactor %s by %s\n", NameOut, String ); + + BddNodeOut1 = cofactorbddnode( (bddsystem *)0, BddNodeOut1, BddNodeOut2 ); + decbddrefext( BddNodeOut1 ); + + TestViewNodeExpr( BddNodeOut1 ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Reduce | +| | +\------------------------------------------------------------*/ + +static void TestCommandReduce( String ) + + char *String; +{ + bddnode *BddNodeOut1; + bddnode *BddNodeOut2; + char *Scan; + char *NameOut; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan == (char *)0 ) return; + *Scan = '\0'; + + NameOut = TestGetName( String ); + BddNodeOut1 = searchbddcircuitout( (bddcircuit *)0, NameOut ); + + if ( BddNodeOut1 == (bddnode *)0 ) return; + + String = TestGetName( Scan + 1 ); + BddNodeOut2 = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNodeOut2 == (bddnode *)0 ) return; + + fprintf( stdout, "--> reduce %s by %s\n", NameOut, String ); + + BddNodeOut1 = reducebddnode( (bddsystem *)0, BddNodeOut1, BddNodeOut2 ); + decbddrefext( BddNodeOut1 ); + + TestViewNodeExpr( BddNodeOut1 ); + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Satisfy | +| | +\------------------------------------------------------------*/ + +static void TestCommandSatisfy( String ) + + char *String; +{ + bddnode *BddNode; + char *Scan; + bddnode *BddSatisfy; + int Assoc; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + Assoc = 0; + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + if ( Scan[ 1 ] == 'a' ) Assoc = 1; + } + + String = TestGetName( String ); + fprintf( stdout, "--> satisfy %s %d\n", String, Assoc ); + BddNode = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + if ( Assoc ) + { + if ( BddLocalSystem->ASSOC == (bddassoc *)0 ) return; + + BddSatisfy = satisfybddnodeassoc( (bddsystem *)0, BddNode, + BddLocalSystem->ASSOC ); + } + else + { + BddSatisfy = satisfybddnode( (bddsystem *)0, BddNode ); + } + + decbddrefext( BddSatisfy ); + + TestViewNodeExpr( BddSatisfy ); + } + else + { + fprintf( stderr, "Output %s doesn't exist\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Test Command Fraction | +| | +\------------------------------------------------------------*/ + +static void TestCommandFraction( String ) + + char *String; +{ + bddnode *BddNode; + char *Scan; + double Fraction; + + if ( String != (char *)0 ) + { + Scan = strchr( String, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + String = TestGetName( String ); + fprintf( stdout, "--> fraction %s\n", String ); + BddNode = searchbddcircuitout( (bddcircuit *)0, String ); + + if ( BddNode != (bddnode *)0 ) + { + Fraction = fractionbddnode( (bddsystem *)0, BddNode ); + fprintf( stdout, "%f\n", Fraction ); + } + else + { + fprintf( stderr, "Output %s doesn't exist\n", String ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Main Loop | +| | +\------------------------------------------------------------*/ + +static int TestMainLoop() +{ + command *Command; + char *Scan; + + TestCommandViewSystem( (char *)0 ); + + TestExit = 0; + + do + { + fprintf( stdout, "\ncommand > " ); + + if ( ! fgets( TestBuffer, BDD_TEST_BUFFER_SIZE, stdin ) ) + { + fprintf( stderr, "Interrupt by user\n" ); + + return( 0 ); + } + + Scan = strchr( TestBuffer, '\n' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; + } + + Scan = strchr( TestBuffer, ' ' ); + + if ( Scan != (char *)0 ) + { + *Scan = '\0'; Scan = Scan + 1; + } + + Command = TestGetCommand( TestBuffer ); + + if ( Command != (command *)0 ) + { + (*Command->FUNCTION)( Scan ); + } + else + { + fprintf( stderr, "syntax error\n" ); + } + } + while ( ( TestExit == 0 ) && + ( TestLogout == 0 ) ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Test Bdd Circuit | +| | +\------------------------------------------------------------*/ + +int testbddcircuit( BddCircuit ) + + bddcircuit *BddCircuit; +{ + setbddlocalcircuit( BddCircuit ); + + if ( ! TestLogout ) + { + return( TestMainLoop() ); + } + + return( 0 ); +} diff --git a/alliance/src/bdd/src/bddtest.h b/alliance/src/bdd/src/bddtest.h new file mode 100644 index 00000000..72c46749 --- /dev/null +++ b/alliance/src/bdd/src/bddtest.h @@ -0,0 +1,140 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddtest.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_TEST_H +# define BDD_TEST_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define BDD_TEST_MAX_COMMAND 42 +# define BDD_TEST_BUFFER_SIZE 512 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ + + typedef struct command + { + char *NAME; + void (*FUNCTION)(); + char *COMMENT; + + } command; + +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + static void TestCommandExit(); + static void TestCommandLogout(); + static void TestCommandHelp(); + + static void TestCommandAddInput(); + static void TestCommandRenInput(); + static void TestCommandViewInput(); + static void TestCommandAddOutput(); + static void TestCommandDelOutput(); + static void TestCommandDelAssoc(); + static void TestCommandAddAuxiliar(); + static void TestCommandAddAssoc(); + + static void TestCommandViewSumProd(); + + static void TestCommandViewHeath(); + static void TestCommandViewOutput(); + static void TestCommandViewBlock(); + static void TestCommandViewOper(); + static void TestCommandViewIndex(); + static void TestCommandViewAssoc(); + static void TestCommandViewSystem(); + static void TestCommandViewCircuit(); + + static void TestCommandSwapVar(); + static void TestCommandGarbage(); + static void TestCommandSweep(); + static void TestCommandReorder(); + static void TestCommandOptimize(); + + static void TestCommandRestrict(); + static void TestCommandCompose(); + static void TestCommandSubstitute(); + static void TestCommandRelProduct(); + static void TestCommandExist(); + static void TestCommandForall(); + static void TestCommandSimpOff(); + static void TestCommandSimpOn(); + + static void TestCommandIntersect(); + static void TestCommandImply(); + static void TestCommandCofactor(); + static void TestCommandReduce(); + static void TestCommandSatisfy(); + static void TestCommandFraction(); + + static void TestCommandSupport(); + + static void TestCommandDumpCircuit(); + +# endif diff --git a/alliance/src/bdd/src/bddtransfert.c b/alliance/src/bdd/src/bddtransfert.c new file mode 100644 index 00000000..dc1aa57d --- /dev/null +++ b/alliance/src/bdd/src/bddtransfert.c @@ -0,0 +1,129 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*----------------------------------------------------------------------*/ +/* Includes */ +/*----------------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddtransfert.h" + +/*----------------------------------------------------------------------*/ +/* Constant declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Type declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Stucture declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Variable declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Macro declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Static function prototypes */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Definition of static functions */ +/*----------------------------------------------------------------------*/ + +/* Performs the recursive step of bddtransfertrec + */ +static bddnode * +transfertbddrec( SystemSrc, SystemDst, Node, HashTable ) + + bddsystem *SystemSrc; + bddsystem *SystemDst; + bddnode *Node; + authtable *HashTable; +{ + authelem *Element; + bddindex Index; + bddnode *High; + bddnode *Low; + bddnode *Res; + + if ( Node == SystemSrc->ONE ) + { + return( SystemDst->ONE ); + } + + if ( Node == SystemSrc->ZERO ) + { + return( SystemDst->ZERO ); + } + + if( ( Element = searchauthelem( HashTable, (char *)Node ) ) != NULL ) + return( (bddnode *)( Element->VALUE ) ); + + Index = Node->INDEX; + + High = transfertbddrec( SystemSrc, SystemDst, Node->HIGH, HashTable ); + Low = transfertbddrec( SystemSrc, SystemDst, Node->LOW, HashTable ); + + Res = addbddnode( SystemDst, Index, High, Low ); + + addauthelem( HashTable, (char *)Node, (long)Res ); + return( Res ); +} + +/*----------------------------------------------------------------------*/ +/* Definition of exported functions */ +/*----------------------------------------------------------------------*/ + +/* Convert a BDD from a system to another one. + */ +bddnode * +transfertbdd( SystemSrc, SystemDst, Node ) + + bddsystem *SystemSrc; + bddsystem *SystemDst; + bddnode *Node; +{ + bddnode *Res; + authtable *HashTable; + + HashTable = createauthtable( 1000 ); + Res = transfertbddrec( SystemSrc, SystemDst, Node, HashTable ); + destroyauthtable( HashTable ); + return( Res ); + +} + diff --git a/alliance/src/bdd/src/bddtransfert.h b/alliance/src/bdd/src/bddtransfert.h new file mode 100644 index 00000000..46203787 --- /dev/null +++ b/alliance/src/bdd/src/bddtransfert.h @@ -0,0 +1,67 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +#ifndef __bddtransfert_h +#define __bddtransfert_h + +/*----------------------------------------------------------------------*/ +/* Nested includes */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Constant declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Macro declarations */ +/*----------------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(args) args +# else +# define __P(args) () +# endif +#endif + +/*----------------------------------------------------------------------*/ +/* Type declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Stucture declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Variable declarations */ +/*----------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------*/ +/* Function prototypes */ +/*----------------------------------------------------------------------*/ + +#endif /* __bddtransfert_h */ + diff --git a/alliance/src/bdd/src/bdduser.c b/alliance/src/bdd/src/bdduser.c new file mode 100644 index 00000000..2509236e --- /dev/null +++ b/alliance/src/bdd/src/bdduser.c @@ -0,0 +1,208 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bdduser.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bdduser.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Add User Function | +| | +\------------------------------------------------------------*/ + +bdduserfunc *addbdduserfunc( BddSystem, Type, Func, Data ) + + bddsystem *BddSystem; + long Type; + void (*Func)(); + void *Data; +{ + bdduserfunc *BddUserFunc; + + setbddlocalsystem( BddSystem ); + + BddUserFunc = allocbdduserfunc(); + BddUserFunc->NEXT = BddLocalSystem->USER_FUNC; + BddLocalSystem->USER_FUNC = BddUserFunc; + + BddUserFunc->FUNC = Func; + BddUserFunc->DATA = Data; + BddUserFunc->TYPE = Type; + + return( BddUserFunc ); +} + +/*------------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Del User Function | +| | +\------------------------------------------------------------*/ + +int delbdduserfunc( BddSystem, BddUserFunc ) + + bddsystem *BddSystem; + bdduserfunc *BddUserFunc; +{ + bdduserfunc *ScanUserFunc; + bdduserfunc **PrevUserFunc; + + setbddlocalsystem( BddSystem ); + + PrevUserFunc = &BddLocalSystem->USER_FUNC; + + for ( ScanUserFunc = BddLocalSystem->USER_FUNC; + ScanUserFunc != (bdduserfunc *)0; + ScanUserFunc = ScanUserFunc->NEXT ) + { + if ( ScanUserFunc == BddUserFunc ) + { + *PrevUserFunc = ScanUserFunc->NEXT; + freebdduserfunc( ScanUserFunc ); + + return( 1 ); + } + + PrevUserFunc = &ScanUserFunc->NEXT; + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| Exec Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Exec User Function | +| | +\------------------------------------------------------------*/ + +void execbdduserfunc( BddSystem, Type ) + + bddsystem *BddSystem; + long Type; +{ + bdduserfunc *ScanUserFunc; + + setbddlocalsystem( BddSystem ); + + for ( ScanUserFunc = BddLocalSystem->USER_FUNC; + ScanUserFunc != (bdduserfunc *)0; + ScanUserFunc = ScanUserFunc->NEXT ) + { + if ( ScanUserFunc->TYPE == Type ) + { + (*ScanUserFunc->FUNC)( ScanUserFunc->DATA ); + } + } +} + +/*------------------------------------------------------------\ +| | +| Destroy Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Bdd Destroy User Function | +| | +\------------------------------------------------------------*/ + +void destroybdduserfunc( BddSystem ) + + bddsystem *BddSystem; +{ + bdduserfunc *ScanUserFunc; + bdduserfunc *DelUserFunc; + + setbddlocalsystem( BddSystem ); + + ScanUserFunc = BddLocalSystem->USER_FUNC; + BddLocalSystem->USER_FUNC = (bdduserfunc *)0; + + while ( ScanUserFunc != (bdduserfunc *)0 ) + { + DelUserFunc = ScanUserFunc; + ScanUserFunc = ScanUserFunc->NEXT; + + freebdduserfunc( DelUserFunc ); + } +} diff --git a/alliance/src/bdd/src/bdduser.h b/alliance/src/bdd/src/bdduser.h new file mode 100644 index 00000000..210e103f --- /dev/null +++ b/alliance/src/bdd/src/bdduser.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bdduser.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_USER_H +# define BDD_USER_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddvar.c b/alliance/src/bdd/src/bddvar.c new file mode 100644 index 00000000..a61e6416 --- /dev/null +++ b/alliance/src/bdd/src/bddvar.c @@ -0,0 +1,613 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvar.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include +# include + +# include "bddvar.h" +# include "bddhnode.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + long BDD_VAR_STRETCH_FACTOR = VAR_STRETCH_FACTOR; + + static bddhnode *BddSwapVarNodeArray = (bddhnode *)0; + static long BddSwapVarNodeSize = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| New Bdd Variable | +| | +\------------------------------------------------------------*/ + +bddindex newbddvar( BddSystem, Variable ) + + bddsystem *BddSystem; + bddvar Variable; +{ + bddvarnode *VarNode; + bddindexnode *IndexNode; + bddindex *IndexToVar; + bddvar *VarToIndex; + bddassoc *BddAssoc; + bddassocnode *BddAssocNode; + long MaxVar; + long MaxIndex; + long NumberVar; + long NumberIndex; + long Counter; + + setbddlocalsystem( BddSystem ); + + NumberVar = BddLocalSystem->NUMBER_VAR; + MaxVar = BddLocalSystem->MAX_VAR; + + if ( NumberVar >= BDD_MAX_VAR ) + { + bdderror( BDD_NO_MORE_VAR_ERROR, 0 ); + } + + if ( Variable > NumberVar ) + { + bdderror( BDD_BAD_VAR_ERROR, Variable ); + } + + if ( NumberVar == MaxVar ) + { + MaxVar = MaxVar * BDD_VAR_STRETCH_FACTOR; + + if ( MaxVar >= BDD_MAX_VAR ) + { + MaxVar = BDD_MAX_VAR - 1; + } + + MaxIndex = MaxVar + BDD_INDEX_MIN; + + VarNode = resizebddvarnode( BddLocalSystem->VAR_NODE, + BddLocalSystem->MAX_INDEX, MaxIndex ); + + IndexNode = resizebddindexnode( BddLocalSystem->INDEX_NODE, + BddLocalSystem->MAX_INDEX, MaxIndex ); + + IndexToVar = resizebddvar( BddLocalSystem->INDEX_TO_VAR, + BddLocalSystem->MAX_INDEX, MaxIndex ); + + VarToIndex = resizebddindex( BddLocalSystem->VAR_TO_INDEX, + BddLocalSystem->MAX_VAR, MaxVar ); + + for ( BddAssoc = BddLocalSystem->ASSOC; + BddAssoc != (bddassoc *)0; + BddAssoc = BddAssoc->NEXT ) + { + BddAssoc->ASSOC_NODE = + + resizebddassocnode( BddAssoc->ASSOC_NODE, + BddLocalSystem->MAX_VAR, MaxVar ); + } + + BddLocalSystem->MAX_VAR = MaxVar; + BddLocalSystem->MAX_INDEX = MaxIndex; + BddLocalSystem->VAR_NODE = VarNode; + BddLocalSystem->INDEX_NODE = IndexNode; + BddLocalSystem->INDEX_TO_VAR = IndexToVar; + BddLocalSystem->VAR_TO_INDEX = VarToIndex; + } + else + { + VarNode = BddLocalSystem->VAR_NODE; + IndexNode = BddLocalSystem->INDEX_NODE; + IndexToVar = BddLocalSystem->INDEX_TO_VAR; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + } + + NumberIndex = BddLocalSystem->NUMBER_INDEX; + + if ( Variable < NumberVar ) + { + for ( Counter = BDD_INDEX_MIN; Counter < NumberIndex; Counter++ ) + { + if ( IndexToVar[ Counter ] >= Variable ) + { + IndexToVar[ Counter ]++; + } + } + + for ( BddAssoc = BddLocalSystem->ASSOC; + BddAssoc != (bddassoc *)0; + BddAssoc = BddAssoc->NEXT ) + { + if ( ( BddAssoc->FIRST != BDD_MAX_VAR ) && + ( BddAssoc->LAST != BDD_MAX_VAR ) && + ( BddAssoc->LAST >= Variable ) ) + { + BddAssoc->LAST = BddAssoc->LAST + 1; + BddAssocNode = BddAssoc->ASSOC_NODE; + + for ( Counter = BddAssoc->LAST; Counter > Variable; Counter-- ) + { + if ( Counter == BddAssoc->FIRST ) break; + + BddAssocNode[ Counter ] = BddAssocNode[ Counter - 1 ]; + } + + if ( Counter == BddAssoc->FIRST ) + { + BddAssoc->FIRST = BddAssoc->FIRST + 1; + } + + BddAssocNode[ Counter ] = (bddnode *)0; + } + } + } + + IndexToVar[ NumberIndex ] = Variable; + + for ( Counter = NumberVar; Counter > Variable; Counter-- ) + { + VarToIndex[ Counter ] = VarToIndex[ Counter - 1 ]; + } + + VarToIndex[ Variable ] = NumberIndex; + + BddLocalSystem->NUMBER_VAR++; + BddLocalSystem->NUMBER_INDEX++; + + if ( IndexNode[ NumberIndex ] == (bddhnodetable *)0 ) + { + IndexNode[ NumberIndex ] = createbddhnodetable( BddLocalSystem->VAR_MODEL ); + } + + return( (bddindex)NumberIndex ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvar( BddSystem, Variable ) + + bddsystem *BddSystem; + bddvar Variable; +{ + bddnode *BddNode; + bddindex Index; + + Index = newbddvar( BddSystem, Variable ); + + BddNode = addbddnode( (bddsystem *)0, Index, + BddLocalSystem->ONE, BddLocalSystem->ZERO ); + + BddNode->REF_EXT = BDD_MAX_REF; + + BddLocalSystem->VAR_NODE[ Index ] = BddNode; + + return( BddNode ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Last Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarlast( BddSystem ) + + bddsystem *BddSystem; +{ + setbddlocalsystem( BddSystem ); + + return( addbddvar( (bddsystem *)0, + BddLocalSystem->NUMBER_VAR ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd First Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarfirst( BddSystem ) + + bddsystem *BddSystem; +{ + setbddlocalsystem( BddSystem ); + + return( addbddvar( (bddsystem *)0, 0 ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Before Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarbefore( BddSystem, Index ) + + bddsystem *BddSystem; + bddindex Index; +{ + bddvar Variable; + + checkbddindex( BddSystem, Index, 1 ); + + Variable = BddLocalSystem->INDEX_TO_VAR[ Index ]; + + return( addbddvar( (bddsystem *)0, Variable ) ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd After Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarafter( BddSystem, Index ) + + bddsystem *BddSystem; + bddindex Index; +{ + bddvar Variable; + + checkbddindex( BddSystem, Index, 1 ); + + Variable = BddLocalSystem->INDEX_TO_VAR[ Index ] + 1; + + return( addbddvar( (bddsystem *)0, Variable ) ); +} + +/*------------------------------------------------------------\ +| | +| Sweep Bdd Variable | +| | +\------------------------------------------------------------*/ + +void sweepbddvar( BddSystem, Variable, SweepRef ) + + bddsystem *BddSystem; + bddvar Variable; + int SweepRef; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddindex *VarToIndex; + long HashIndex; + + checkbddvar( BddSystem, Variable, 1 ); + + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + IndexNode = BddLocalSystem->INDEX_NODE; + + HashTable = IndexNode[ VarToIndex[ Variable ] ]; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + if ( ( ! HashNode->REF_INT ) && + ( ! HashNode->REF_EXT ) ) + { + HashTable->NUMBER_NODE--; + HashTable->TABLE[ HashIndex ] = BDD_HASH_NODE_DELETED; + + if ( SweepRef ) + { + decbddrefint( HashNode->LOW ); + decbddrefint( HashNode->HIGH ); + } + + memset( (void *)HashNode, 0, sizeof( bddnode ) ); + + HashNode->HIGH = BddLocalSystem->NODE_FREE; + BddLocalSystem->NODE_FREE = HashNode; + BddLocalSystem->NUMBER_NODE--; + BddLocalSystem->NUMBER_FREE++; + } + } + } + + resizebddhnodetable( HashTable ); + resetbddhopertable( BddLocalSystem->HASH_OPER ); +} + +/*------------------------------------------------------------\ +| | +| Swap Bdd Variable | +| | +\------------------------------------------------------------*/ + +int swapbddvar( BddSystem, Variable ) + + bddsystem *BddSystem; + bddvar Variable; +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddhnodetable *NextTable; + bddvar *VarToIndex; + bddindex *IndexToVar; + bddassoc *BddAssoc; + bddassocnode *BddAssocNode; + bddnode *HashNode; + bddnode *BddNodeLow; + bddnode *BddNodeHigh; + bddnode *BddNodeF11; + bddnode *BddNodeF01; + bddnode *BddNodeF10; + bddnode *BddNodeF00; + bddvar NextVar; + bddvar FirstVar; + bddvar LastVar; + bddindex Index; + bddindex NextIndex; + long HashIndex; + long SwapVarNodeIndex; + long NodeIndex; + + NextVar = Variable + 1; + + checkbddvar( BddSystem, NextVar, 1 ); + + SetBddSystemSwapVar( BddLocalSystem ); + + IndexNode = BddLocalSystem->INDEX_NODE; + VarToIndex = BddLocalSystem->VAR_TO_INDEX; + IndexToVar = BddLocalSystem->INDEX_TO_VAR; + + Index = VarToIndex[ Variable ]; + NextIndex = VarToIndex[ NextVar ]; + + HashTable = IndexNode[ Index ]; + NextTable = IndexNode[ NextIndex ]; + + if ( BddSwapVarNodeSize < HashTable->NUMBER_NODE ) + { + if ( BddSwapVarNodeArray != (bddhnode *)0 ) + { + freebddhnode( BddSwapVarNodeArray ); + } + + BddSwapVarNodeSize = HashTable->NUMBER_NODE << 1; + BddSwapVarNodeArray = allocbddhnode( BddSwapVarNodeSize ); + } + + SwapVarNodeIndex = 0; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + if ( ( HashNode->HIGH->INDEX == NextIndex ) || + ( HashNode->LOW->INDEX == NextIndex ) ) + { + HashTable->NUMBER_NODE--; + HashTable->TABLE[ HashIndex ] = BDD_HASH_NODE_DELETED; + + BddSwapVarNodeArray[ SwapVarNodeIndex ] = HashNode; + SwapVarNodeIndex = SwapVarNodeIndex + 1; + } + } + } + + for ( NodeIndex = 0; NodeIndex < SwapVarNodeIndex; NodeIndex++ ) + { + HashNode = BddSwapVarNodeArray[ NodeIndex ]; + + BddNodeLow = HashNode->LOW; + BddNodeHigh = HashNode->HIGH; + + if ( BddNodeHigh->INDEX == NextIndex ) + { + BddNodeF11 = BddNodeHigh->HIGH; + BddNodeF10 = BddNodeHigh->LOW; + } + else + { + BddNodeF11 = BddNodeHigh; + BddNodeF10 = BddNodeHigh; + } + + if ( BddNodeLow->INDEX == NextIndex ) + { + BddNodeF01 = BddNodeLow->HIGH; + BddNodeF00 = BddNodeLow->LOW; + } + else + { + BddNodeF01 = BddNodeLow; + BddNodeF00 = BddNodeLow; + } + + decbddrefint( BddNodeHigh ); + decbddrefint( BddNodeLow ); + + BddNodeHigh = unsetbddrefext( addbddnode( (bddsystem *)0, Index, + BddNodeF11, BddNodeF01 ) ); + BddNodeLow = unsetbddrefext( addbddnode( (bddsystem *)0, Index, + BddNodeF10, BddNodeF00 ) ); + HashNode->INDEX = NextIndex; + HashNode->HIGH = BddNodeHigh; + HashNode->LOW = BddNodeLow; + + addbddhnode( NextTable, HashNode ); + } + + VarToIndex[ NextVar ] = Index; + VarToIndex[ Variable ] = NextIndex; + + IndexToVar[ NextIndex ] = Variable; + IndexToVar[ Index ] = NextVar; + + for ( BddAssoc = BddLocalSystem->ASSOC; + BddAssoc != (bddassoc *)0; + BddAssoc = BddAssoc->NEXT ) + { + BddAssocNode = BddAssoc->ASSOC_NODE; + + BddNodeLow = BddAssocNode[ Variable ]; + BddNodeHigh = BddAssocNode[ NextVar ]; + + FirstVar = BddAssoc->FIRST; + LastVar = BddAssoc->LAST ; + + if ( ( Variable == FirstVar ) && + ( BddNodeHigh == (bddnode *)0 ) ) BddAssoc->FIRST++; + + if ( ( NextVar == LastVar ) && + ( BddNodeLow == (bddnode *)0 ) ) BddAssoc->LAST --; + + if ( NextVar == FirstVar ) BddAssoc->FIRST--; + if ( Variable == LastVar ) BddAssoc->LAST ++; + + BddAssocNode[ NextVar ] = BddNodeLow; + BddAssocNode[ Variable ] = BddNodeHigh; + } + + sweepbddvar( (bddsystem *)0, Variable, 1 ); + + ClearBddSystemSwapVar( BddLocalSystem ); + + return ( SwapVarNodeIndex != 0L ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Variable By Index | +| | +\------------------------------------------------------------*/ + +bddvar getbddvarbyindex( BddSystem, Index ) + + bddsystem *BddSystem; + bddindex Index; +{ + checkbddindex( BddSystem, Index, 1 ); + + return( BddLocalSystem->INDEX_TO_VAR[ Index ] ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Variable Index | +| | +\------------------------------------------------------------*/ + +bddindex getbddvarindex( BddSystem, Variable ) + + bddsystem *BddSystem; + bddvar Variable; +{ + checkbddvar( BddSystem, Variable, 1 ); + + return( BddLocalSystem->VAR_TO_INDEX[ Variable ] ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Variable Node | +| | +\------------------------------------------------------------*/ + +bddnode *getbddvarnode( BddSystem, Variable ) + + bddsystem *BddSystem; + bddvar Variable; +{ + bddindex Index; + + checkbddvar( BddSystem, Variable, 1 ); + + Index = BddLocalSystem->VAR_TO_INDEX[ Variable ]; + + return( BddLocalSystem->VAR_NODE[ Index ] ); +} + +/*------------------------------------------------------------\ +| | +| Get Bdd Variable Node By Index | +| | +\------------------------------------------------------------*/ + +bddnode *getbddvarnodebyindex( BddSystem, Index ) + + bddsystem *BddSystem; + bddindex Index; +{ + checkbddindex( BddSystem, Index, 1 ); + + return( BddLocalSystem->VAR_NODE[ Index ] ); +} diff --git a/alliance/src/bdd/src/bddvar.h b/alliance/src/bdd/src/bddvar.h new file mode 100644 index 00000000..51534715 --- /dev/null +++ b/alliance/src/bdd/src/bddvar.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvar.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_VAR_H +# define BDD_VAR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define VAR_STRETCH_FACTOR 2 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddvaraux.c b/alliance/src/bdd/src/bddvaraux.c new file mode 100644 index 00000000..a320f31c --- /dev/null +++ b/alliance/src/bdd/src/bddvaraux.c @@ -0,0 +1,260 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvaraux.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddapply.h" +# include "bddcofactor.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static bddhnode *BddAuxVarNodeArray = (bddhnode *)0; + static long BddAuxVarNodeSize = 0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Add Bdd Single Auxiliary Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarauxsingle( BddSystem, BddAux ) + + bddsystem *BddSystem; + bddnode *BddAux; +{ + bddindexnode *IndexNode; + bddnode *BddNotAux; + bddnode *BddNodeAux; + bddnode *BddNodeNotAux; + bddvar Variable; + bddindex AuxIndex; + bddindex Index; + + Index = BddAux->INDEX; + + checkbddindex( BddSystem, Index, 1 ); + + BddNotAux = decbddrefext( loc_applybddnot( BddAux ) ); + + Variable = BddLocalSystem->INDEX_TO_VAR[ Index ]; + AuxIndex = newbddvar( (bddsystem *)0, Variable ); + + IndexNode = BddLocalSystem->INDEX_NODE; + + delbddhnode( IndexNode[ Index ], BddNotAux ); + BddNodeNotAux = addbddnode( (bddsystem *)0, Index, BddNotAux->HIGH, BddNotAux->LOW ); + + BddNotAux->INDEX = AuxIndex; + BddNotAux->HIGH = BddLocalSystem->ZERO; + BddNotAux->LOW = BddLocalSystem->ONE; + + addbddhnode( IndexNode[ AuxIndex ], BddNotAux ); + + delbddhnode( IndexNode[ Index ], BddAux ); + BddNodeAux = addbddnode( (bddsystem *)0, Index, BddAux->HIGH, BddAux->LOW ); + + BddAux->INDEX = AuxIndex; + BddAux->HIGH = BddLocalSystem->ONE; + BddAux->LOW = BddLocalSystem->ZERO; + BddAux->REF_EXT = BDD_MAX_REF; + + addbddhnode( IndexNode[ AuxIndex ], BddAux ); + + BddLocalSystem->VAR_NODE[ AuxIndex ] = BddAux; + + resetbddhopertable( BddLocalSystem->HASH_OPER ); + + decbddrefext( BddNodeNotAux ); + + return( BddNodeAux ); +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Global Auxiliary Variable | +| | +\------------------------------------------------------------*/ + +bddnode *addbddvarauxglobal( BddSystem, BddAux, UserFunc ) + + bddsystem *BddSystem; + bddnode *BddAux; + int (*UserFunc)(); +{ + bddindexnode *IndexNode; + bddhnodetable *HashTable; + bddnode *HashNode; + bddnode NewNode; + bddnode *BddNotAux; + bddnode *BddNodeAux; + bddnode *BddNodeNotAux; + long AuxVarNodeIndex; + long HashIndex; + bddvar Variable; + bddindex AuxIndex; + bddindex Index; + + Index = BddAux->INDEX; + + checkbddindex( BddSystem, Index, 1 ); + + BddNotAux = decbddrefext( loc_applybddnot( BddAux ) ); + + Variable = BddLocalSystem->INDEX_TO_VAR[ Index ]; + AuxIndex = newbddvar( (bddsystem *)0, Variable ); + + IndexNode = BddLocalSystem->INDEX_NODE; + HashTable = IndexNode[ Index ]; + + if ( BddAuxVarNodeSize < HashTable->NUMBER_NODE ) + { + freebddhnode( BddAuxVarNodeArray ); + BddAuxVarNodeSize = HashTable->NUMBER_NODE << 1; + BddAuxVarNodeArray = allocbddhnode( BddAuxVarNodeSize ); + } + + AuxVarNodeIndex = 0; + + for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ ) + { + HashNode = HashTable->TABLE[ HashIndex ]; + + if ( ( HashNode != BDD_HASH_NODE_EMPTY ) && + ( HashNode != BDD_HASH_NODE_DELETED ) ) + { + if ( ( HashNode != BddAux ) && + ( HashNode != BddNotAux ) ) + { + BddAuxVarNodeArray[ AuxVarNodeIndex ] = HashNode; + AuxVarNodeIndex = AuxVarNodeIndex + 1; + } + } + } + + delbddhnode( IndexNode[ Index ], BddNotAux ); + BddNodeNotAux = addbddnode( (bddsystem *)0, Index, BddNotAux->HIGH, BddNotAux->LOW ); + + BddNotAux->INDEX = AuxIndex; + BddNotAux->HIGH = BddLocalSystem->ZERO; + BddNotAux->LOW = BddLocalSystem->ONE; + + addbddhnode( IndexNode[ AuxIndex ], BddNotAux ); + + delbddhnode( IndexNode[ Index ], BddAux ); + BddNodeAux = addbddnode( (bddsystem *)0, Index, BddAux->HIGH, BddAux->LOW ); + + BddAux->INDEX = AuxIndex; + BddAux->HIGH = BddLocalSystem->ONE; + BddAux->LOW = BddLocalSystem->ZERO; + BddAux->REF_EXT = BDD_MAX_REF; + + addbddhnode( IndexNode[ AuxIndex ], BddAux ); + + BddLocalSystem->VAR_NODE[ AuxIndex ] = BddAux; + + resetbddhopertable( BddLocalSystem->HASH_OPER ); + + BddLocalSystem->HASH_OPER->TABLE_FREEZE = 1; + + NewNode.INDEX = AuxIndex; + NewNode.REF_INT = 0; + NewNode.REF_EXT = 1; + NewNode.MARK = 0; + + while ( AuxVarNodeIndex > 0 ) + { + AuxVarNodeIndex = AuxVarNodeIndex - 1; + HashNode = BddAuxVarNodeArray[ AuxVarNodeIndex ]; + + NewNode.HIGH = decbddrefext( loc_cofactorbdd( HashNode, BddNodeAux ) ); + NewNode.LOW = decbddrefext( loc_cofactorbdd( HashNode, BddNodeNotAux ) ); + + if ( ( NewNode.HIGH != NewNode.LOW ) && + ( NewNode.HIGH != HashNode ) && + ( NewNode.LOW != HashNode ) ) + { + if ( UserFunc ) + { + if ( ! UserFunc( HashNode, &NewNode ) ) continue; + } + + delbddhnode( IndexNode[ Index ], HashNode ); + + HashNode->INDEX = AuxIndex; + HashNode->HIGH = incbddrefint( NewNode.HIGH ); + HashNode->LOW = incbddrefint( NewNode.LOW ); + + addbddhnode( IndexNode[ AuxIndex ], HashNode ); + } + } + + BddLocalSystem->HASH_OPER->TABLE_FREEZE = 0; + + decbddrefext( BddNodeNotAux ); + + return( BddNodeAux ); +} diff --git a/alliance/src/bdd/src/bddvaraux.h b/alliance/src/bdd/src/bddvaraux.h new file mode 100644 index 00000000..c9574a10 --- /dev/null +++ b/alliance/src/bdd/src/bddvaraux.h @@ -0,0 +1,80 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvaraux.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_VAR_AUX_H +# define BDD_VAR_AUX_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define VAR_AUX_STRETCH_FACTOR 2 + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/bdd/src/bddvartree.c b/alliance/src/bdd/src/bddvartree.c new file mode 100644 index 00000000..9d51c144 --- /dev/null +++ b/alliance/src/bdd/src/bddvartree.c @@ -0,0 +1,490 @@ +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvartree.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +# include +# include "bddvartree.h" +# include "bdderror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Search Bdd Variable Tree | +| | +\------------------------------------------------------------*/ + +bddvar searchbddvartree( BddVarTree, Variable ) + + bddvartree *BddVarTree; + bddvar Variable; +{ + long First; + long Last; + long Middle; + + if ( Variable > BddVarTree->LAST ) + { + return( BDD_MIN_VAR ); + } + + if ( ( BddVarTree->FIRST != BDD_MIN_VAR ) && + ( BddVarTree->FIRST > Variable ) ) + { + return( (bddvar)0 ); + } + + First = 0; + Last = BddVarTree->NUMBER_CHILD - 1; + + while ( First <= Last ) + { + Middle = ( First + Last ) >> 1; + + if ( ( BddVarTree->CHILD[ Middle ]->FIRST <= Variable ) && + ( BddVarTree->CHILD[ Middle ]->LAST >= Variable ) ) + { + return( (bddvar )Middle ); + } + + if ( BddVarTree->CHILD[ Middle ]->FIRST > Variable ) + { + Last = Middle - 1; + } + else + { + First = Middle + 1; + } + } + + return ( (bddvar)First ); +} + +/*------------------------------------------------------------\ +| | +| Delta Bdd Variable Tree | +| | +\------------------------------------------------------------*/ + +void deltabddvartree( BddVarTree, Delta ) + + bddvartree *BddVarTree; + long Delta; +{ + long Scan; + + BddVarTree->FIRST += Delta; + BddVarTree->LAST += Delta; + + for ( Scan = 0; Scan < BddVarTree->NUMBER_CHILD; Scan++ ) + { + deltabddvartree( BddVarTree->CHILD[ Scan ], Delta ); + } +} + +/*------------------------------------------------------------\ +| | +| Shift Bdd Variable Tree | +| | +\------------------------------------------------------------*/ + +bddvartree *shiftbddvartree( BddVarTree, Variable ) + + bddvartree *BddVarTree; + bddvar Variable; +{ + bddvartree *NewTree; + bddvarchild *NewChild; + bddvarchild *PrevChild; + long NumberChild; + long ScanChild; + long Child; + + if ( ( BddVarTree->FIRST != BDD_MIN_VAR ) && + ( BddVarTree->FIRST >= Variable ) ) + { + deltabddvartree( BddVarTree, 1 ); + + return( BddVarTree ); + } + + if ( Variable > BddVarTree->LAST ) + { + return( BddVarTree ); + } + + BddVarTree->LAST++; + + NumberChild = BddVarTree->NUMBER_CHILD; + PrevChild = BddVarTree->CHILD; + Child = searchbddvartree( BddVarTree, Variable ); + + if ( ( Child == BddVarTree->NUMBER_CHILD ) || + ( Child == BddVarTree->CHILD[ Child ]->FIRST ) ) + { + NumberChild = NumberChild + 1; + NewChild = allocbddvarchild( NumberChild ); + + if ( PrevChild != (bddvarchild *)0 ) + { + for ( ScanChild = NumberChild - 1; ScanChild >= 0; ScanChild-- ) + { + if ( ( ScanChild >= Child ) && + ( ScanChild > 0 ) ) + { + NewChild[ ScanChild ] = shiftbddvartree( PrevChild[ ScanChild - 1 ], Variable ); + } + else + { + NewChild[ ScanChild ] = PrevChild[ ScanChild ]; + } + } + + freebddvarchild( PrevChild ); + } + + NewTree = allocbddvartree(); + NewTree->FIRST = Variable; + NewTree->LAST = Variable; + NewChild[ Child ] = NewTree; + + BddVarTree->NUMBER_CHILD = NumberChild; + BddVarTree->CHILD = NewChild; + } + else + { + while ( Child < NumberChild ) + { + shiftbddvartree( PrevChild[ Child ], Variable ); + Child = Child + 1; + } + } + + return( BddVarTree ); +} + +/*------------------------------------------------------------\ +| | +| Add Variable Tree | +| | +\------------------------------------------------------------*/ + +static void addvartree( BddVarTree, NewVarTree ) + + bddvartree *BddVarTree; + bddvartree *NewVarTree; +{ + bddvarchild *NewChild; + bddvar FirstChild; + bddvar LastChild; + bddvar ScanChild; + bddvar NumberChild; + bddvar NewNumberChild; + + if ( BddVarTree->NUMBER_CHILD ) + { + FirstChild = searchbddvartree( BddVarTree, NewVarTree->FIRST ); + LastChild = searchbddvartree( BddVarTree, NewVarTree->LAST ); + + if ( FirstChild == LastChild ) + { + addvartree( BddVarTree->CHILD[ FirstChild ], NewVarTree ); + } + else + { + NewNumberChild = LastChild - FirstChild + 1; + NewChild = allocbddvarchild( NewNumberChild ); + + for ( ScanChild = 0; ScanChild < NewNumberChild; ScanChild++ ) + { + NewChild[ ScanChild ] = BddVarTree->CHILD[ FirstChild + ScanChild ]; + } + + NumberChild = BddVarTree->NUMBER_CHILD - ( NewNumberChild - 1 ); + resizebddvarchild( BddVarTree->CHILD, BddVarTree->NUMBER_CHILD, NumberChild ); + BddVarTree->NUMBER_CHILD = NumberChild; + + NewVarTree->NUMBER_CHILD = NewNumberChild; + NewVarTree->CHILD = NewChild; + } + } + else + { + NewChild = allocbddvarchild( 1 ); + NewChild[ 0 ] = NewVarTree; + + BddVarTree->NUMBER_CHILD = 1; + BddVarTree->CHILD = NewChild; + } +} + +/*------------------------------------------------------------\ +| | +| Add Bdd Variable Tree | +| | +\------------------------------------------------------------*/ + +bddvartree *addbddvartree( BddSystem, VarFrom, VarTo ) + + bddsystem *BddSystem; + bddvar VarFrom; + bddvar VarTo; +{ + bddvartree *BddVarTree; + + checkbddvar( BddSystem, VarFrom, 1 ); + checkbddvar( BddSystem, VarTo , 1 ); + + if ( VarFrom >= VarTo ) + { + bdderror( BDD_BAD_VAR_ERROR, VarFrom ); + } + + BddVarTree = allocbddvartree(); + BddVarTree->FIRST = VarFrom; + BddVarTree->LAST = VarTo; + + addvartree( BddLocalSystem->VAR_TREE, BddVarTree ); + + return( BddVarTree ); +} + +/*------------------------------------------------------------\ +| | +| Swap Bdd Variable Tree | +| | +\------------------------------------------------------------*/ + +void swapbddvartree( BddSystem, BddVarTree, Child ) + + bddsystem *BddSystem; + bddvartree *BddVarTree; + bddvar Child; +{ + bddvartree *BddVarChild; + bddvartree *BddVarNext; + long FirstIndex; + long DeltaIndex; + long DeltaNext; + long ScanIndex; + long ScanNext; + bddvar Variable; + + setbddlocalsystem( BddSystem ); + + if ( Child + 1 >= BddVarTree->NUMBER_CHILD ) + { + bdderror( BDD_BAD_CHILD_ERROR, Child ); + } + + BddVarChild = BddVarTree->CHILD[ Child ]; + BddVarNext = BddVarTree->CHILD[ Child + 1 ]; + + DeltaIndex = BddVarChild->LAST - BddVarChild->FIRST; + DeltaNext = BddVarNext->LAST - BddVarNext->FIRST; + + for ( ScanIndex = DeltaIndex; ScanIndex >= 0; ScanIndex-- ) + { + FirstIndex = BddVarChild->FIRST + ScanIndex; + + for ( ScanNext = 0; ScanNext <= DeltaNext; ScanNext++ ) + { + Variable = FirstIndex + ScanNext; + + swapbddvar( (bddsystem *)0, Variable ); + } + } + + deltabddvartree( BddVarChild, ( DeltaNext + 1 ) ); + deltabddvartree( BddVarNext , - ( DeltaIndex + 1 ) ); + + BddVarTree->CHILD[ Child ] = BddVarNext; + BddVarTree->CHILD[ Child + 1 ] = BddVarChild; + + resetbddhopertable( BddLocalSystem->HASH_OPER ); +} + +/*------------------------------------------------------------\ +| | +| Destroy Variable Tree | +| | +\------------------------------------------------------------*/ + +static void destroyvartree( BddVarTree ) + + bddvartree *BddVarTree; +{ + long Child; + + for ( Child = 0; Child < BddVarTree->NUMBER_CHILD; Child++ ) + { + destroyvartree( BddVarTree->CHILD[ Child ] ); + } + + if ( Child ) + { + freebddvarchild( BddVarTree->CHILD ); + } + + freebddvartree( BddVarTree ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Create Variable Tree | +| | +\------------------------------------------------------------*/ + +bddvartree *createbddvartree( BddSystem ) + + bddsystem *BddSystem; +{ + bddvartree *BddVarTree; + + setbddlocalsystem( BddSystem ); + + BddVarTree = allocbddvartree(); + BddVarTree->FIRST = BDD_MIN_VAR; + BddVarTree->REORDER = 1; + + BddLocalSystem->VAR_TREE = BddVarTree; + + return( BddVarTree ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Reset Variable Tree | +| | +\------------------------------------------------------------*/ + +void resetbddvartree( BddSystem ) + + bddsystem *BddSystem; +{ + setbddlocalsystem( BddSystem ); + + destroyvartree( BddLocalSystem->VAR_TREE ); + createbddvartree( (bddsystem *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Bdd Destroy Variable Tree | +| | +\------------------------------------------------------------*/ + +void destroybddvartree( BddSystem ) + + bddsystem *BddSystem; +{ + setbddlocalsystem( BddSystem ); + + destroyvartree( BddLocalSystem->VAR_TREE ); + BddLocalSystem->VAR_TREE = (bddvartree *)0; +} + +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| View Variable Tree Space | +| | +\------------------------------------------------------------*/ + +static void viewvartreespace( Space ) + + long Space; +{ + while ( Space > 0 ) + { + fprintf( stdout, " " ); + + Space = Space - 1; + } +} + +/*------------------------------------------------------------\ +| | +| View Variable Tree | +| | +\------------------------------------------------------------*/ + +static void viewvartree( BddVarTree, Space ) + + bddvartree *BddVarTree; + long Space; +{ + long Scan; + + viewvartreespace( Space ); + fprintf( stdout, "--> BddVarTree\n" ); + viewvartreespace( Space ); + fprintf( stdout, "NUMBER_CHILD : %d\n", BddVarTree->NUMBER_CHILD ); + viewvartreespace( Space ); + fprintf( stdout, "FIRST : %d\n", BddVarTree->FIRST ); + + for ( Scan = 0; Scan < BddVarTree->NUMBER_CHILD; Scan++ ) + { + viewvartree( BddVarTree->CHILD[ Scan ], Space + 2 ); + } + + viewvartreespace( Space ); + fprintf( stdout, "LAST : %d\n", BddVarTree->LAST ); + viewvartreespace( Space ); + fprintf( stdout, "REORDER : %d\n", BddVarTree->REORDER ); + viewvartreespace( Space ); + fprintf( stdout, "<-- BddVarTree\n" ); +} + +/*------------------------------------------------------------\ +| | +| Bdd View Variable Tree | +| | +\------------------------------------------------------------*/ + +void viewbddvartree( BddVarTree ) + + bddvartree *BddVarTree; +{ + viewvartree( BddVarTree, 0 ); +} diff --git a/alliance/src/bdd/src/bddvartree.h b/alliance/src/bdd/src/bddvartree.h new file mode 100644 index 00000000..d7b3757b --- /dev/null +++ b/alliance/src/bdd/src/bddvartree.h @@ -0,0 +1,51 @@ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Bdd | +| | +| File : bddvartree.h | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef BDD_VAR_TREE_H +# define BDD_VAR_TREE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void swapbddvartree __P((bddsystem *BddSystem, bddvartree *BddVarTree, bddvar Child)); + +# endif diff --git a/alliance/src/bdd/src/main.c b/alliance/src/bdd/src/main.c new file mode 100644 index 00000000..bf4ef820 --- /dev/null +++ b/alliance/src/bdd/src/main.c @@ -0,0 +1,64 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +# include + +# include MUT_H +# include AUT_H +# include ABL_H +# include BDD_H + +int main( argc, argv ) + + int argc; + char **argv; +{ + bddcircuit *BddCircuit; + bddsystem *BddSystem; + + mbkenv(); + autenv(); + ablenv(); + bddenv(); + + BddSystem = createbddsystem( 10, 1000, 3, 100000 ); + + if ( argc > 1 ) + { + BddCircuit = (bddcircuit *)undumpbddcircuit( BddSystem, argv[1] ); + } + else + { + BddCircuit = createbddcircuit( "Hello", 3, 3, BddSystem ); + } + + testbddcircuit( BddCircuit ); + + destroybddcircuit( BddCircuit ); + destroybddsystem( BddSystem ); + + return( 0 ); +}