abc/src/misc/bbl/bblif.c
/**Fnction*************************************************************

  Synopsis    [This demo shows using the internal to construct a half-adder.]

  Description [We construct the logic network for the half-adder represnted
  using the BLIF file below]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Fnction
Synopsis    [This demo shows using the internal to construct a half-adder.]

Description [We construct the logic network for the half-adder represnted
using the BLIF file below]




Fnction Synopsis [ This demo shows using the internal to construct a half - adder . ] Description [ We construct the logic network for the half - adder represnted using the BLIF file below ]
void Bbl_ManSimpleDemo()
{
    Bbl_Man_t * p;
    p = Bbl_ManStart( "hadder" );
    Bbl_ManCreateObject( p, BBL_OBJ_CI, 1, 0, NULL ); 
    Bbl_ManCreateObject( p, BBL_OBJ_CI, 2, 0, NULL ); 
    Bbl_ManCreateObject( p, BBL_OBJ_CI, 3, 0, NULL ); 
    Bbl_ManCreateObject( p, BBL_OBJ_CO, 4, 1, NULL ); 
    Bbl_ManCreateObject( p, BBL_OBJ_CO, 5, 1, NULL ); 
    Bbl_ManCreateObject( p, BBL_OBJ_NODE, 6, 3, "100 1\n010 1\n001 1\n111 1\n" ); _driver
    Bbl_ManCreateObject( p, BBL_OBJ_NODE, 7, 3, "-11 1\n1-1 1\n11- 1\n" );        _driver
    dd fanins of node 6
    Bbl_ManAddFanin( p, 6, 1 ); _driver <- a
    Bbl_ManAddFanin( p, 6, 2 ); _driver <- b
    Bbl_ManAddFanin( p, 6, 3 ); _driver <- cin
    dd fanins of node 7
    Bbl_ManAddFanin( p, 7, 1 ); _driver <- a
    Bbl_ManAddFanin( p, 7, 2 ); _driver <- b
    Bbl_ManAddFanin( p, 7, 3 ); _driver <- cin
    dd fanins of COs
    Bbl_ManAddFanin( p, 4, 6 );  <- s_driver
    Bbl_ManAddFanin( p, 5, 7 );  <- cout_driver
    anity check
    Bbl_ManCheck( p );
    Bbl_ManDumpBlif( p, "hadder.blif" );
    Bbl_ManDumpBinaryBlif( p, "hadder.bblif" );
    Bbl_ManStop( p );
}
void Bbl_ManSimpleDemo ( ) { Bbl_Man_t * p ; p = Bbl_ManStart ( " " ) ; Bbl_ManCreateObject ( p , BBL_OBJ_CI , 1 , 0 , NULL ) ; Bbl_ManCreateObject ( p , BBL_OBJ_CI , 2 , 0 , NULL ) ; Bbl_ManCreateObject ( p , BBL_OBJ_CI , 3 , 0 , NULL ) ; Bbl_ManCreateObject ( p , BBL_OBJ_CO , 4 , 1 , NULL ) ; Bbl_ManCreateObject ( p , BBL_OBJ_CO , 5 , 1 , NULL ) ; Bbl_ManCreateObject ( p , BBL_OBJ_NODE , 6 , 3 , " \n \n \n \n " ) ; Bbl_ManCreateObject ( p , BBL_OBJ_NODE , 7 , 3 , " \n \n \n " ) ; Bbl_ManAddFanin ( p , 6 , 1 ) ; Bbl_ManAddFanin ( p , 6 , 2 ) ; Bbl_ManAddFanin ( p , 6 , 3 ) ; Bbl_ManAddFanin ( p , 7 , 1 ) ; Bbl_ManAddFanin ( p , 7 , 2 ) ; Bbl_ManAddFanin ( p , 7 , 3 ) ; Bbl_ManAddFanin ( p , 4 , 6 ) ; Bbl_ManAddFanin ( p , 5 , 7 ) ; Bbl_ManCheck ( p ) ; Bbl_ManDumpBlif ( p , " " ) ; Bbl_ManDumpBinaryBlif ( p , " " ) ; Bbl_ManStop ( p ) ; }
Fnction
Synopsis    [This demo shows using the internal to construct a half-adder.]
Fnction Synopsis [ This demo shows using the internal to construct a half - adder . ]
/*
    # There are contents of a BLIF file representing a half-adder:
    .model hadder
    .inputs a     // ID = 1
    .inputs b     // ID = 2
    .inputs cin   // ID = 3
    .outputs s    // ID = 4
    .outputs cout // ID = 5
    .names a b cin s_driver   // ID = 6
    100 1
    010 1
    001 1
    111 1
    .names a b cin cout_driver // ID = 7
    -11 1
    1-1 1
    11- 1
    .names s_driver s
    1 1
    .names cout_driver cout
    1 1
    .end
*/ // start the data manager // create CIs // a // b // cin // create COs // s // cout // create internal nodes // s_driver // cout_driver // add fanins of node 6 // s_driver <- a // s_driver <- b // s_driver <- cin // add fanins of node 7 // cout_driver <- a // cout_driver <- b // cout_driver <- cin // add fanins of COs // s <- s_driver // cout <- cout_driver // sanity check // write BLIF file as a sanity check // write binary BLIF file // remove the manager //    Bbl_ManTestTruth( "100 1\n010 1\n001 1\n111 1\n", 3 ); //    Bbl_ManTestTruth( "-11 0\n1-1 0\n11- 0\n", 3 ); //    Bbl_ManTestTruth( "--- 1\n", 3 );