APPLYBDDNODEITE(3)

πŸ“¦ version 5.1.1-unstable-2025-02, in nixos 26.05, nixpkgs unstable

πŸ’… applybddnodeite β€” the IF-THEN-ELSE baddie

okay so this is a page from BDD FUNCTIONS, specifically the applybddnodeite(3) one, and bestie it is so much less scary than it looks. it's literally just "if this then that else the other thing" but for BDD nodes. we love a logical queen. ✨


🌸 ORIGIN 🌸

this software belongs to the ALLIANCE CAD SYSTEM, developed by the ASIM team at the LIP6 laboratory of UniversitΓ© Pierre et Marie Curie, in Paris, France. πŸ‡«πŸ‡·πŸŽ€

like, they're in Paris, the whole thing is giving main character energy fr fr.


✨ SYNOPSIS ✨

#include "bdd101.h"
bddnode βˆ—applybddnodeite( BddSystem, BddIf, BddThen, BddElse )
  bddnode   βˆ—BddSystem;
  bddnode   βˆ—BddIf;
  bddnode   βˆ—BddThen;
  bddnode   βˆ—BddElse;

πŸŽ€ PARAMETERS πŸŽ€

  • BddSystem β€” the bdd system. that's the whole universe this operation lives in.
  • BddIf β€” the IF bdd node. the vibe check, the condition, the "okay but *if*…"
  • BddThen β€” the THEN bdd node. what we do when the IF says yes.
  • BddElse β€” the ELSE bdd node. the backup plan, the "nvm we ball anyway" node.

πŸ¦‹ DESCRIPTION πŸ¦‹

so applybddnodeite computes this exact logical function:

(BddIf AND BddThen) OR ((NOT BddIf) AND BddElse)

in the bdd system BddSystem. it's giving classic mux energy, it's giving "choose your fighter", it's the whole IF-THEN-ELSE moment.

and here's the cute part: if a null pointer is given, the default bdd system is used. so you can literally just pass (bddsystem βˆ—)0 and the function will handle it. no cap, that's a slay. 🫢


πŸ’– RETURN VALUE πŸ’–

applybddnodeite returns a pointer to the resulting bdd node, with its number of external reference incremented. so yeah, she comes with a ref count bump already attached. iconic behavior honestly. πŸ‘‘


πŸ”₯ EXAMPLE πŸ”₯

okay so here's the whole thing, verbatim, because we do not play with code around here:

#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 );

see how it sets up i0, i1, i2 as inputs, then feeds them straight into applybddnodeite as the if / then / else trio? that comment at the bottom literally spells out the resulting expression: ((i0 and i1) or ((not i0) and i2). chef's kiss. 🧚 and then it cleans up after itself with freeablexpr, destroybddsystem and destroybddcircuit β€” we love a tidy bestie. πŸ’…


🌈 SEE ALSO 🌈


πŸ’€ BUG REPORT πŸ’€

This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools.

bestie they are literally asking for your feedback. if something's weird, tell them. be the change etc. πŸ™ˆ

⭐ and that's the whole page!! brought to you by ASIM/LIP6, dated October 1, 1997 β€” yes she's vintage, yes she still serves. mwah. πŸŽ€πŸ’œ

πŸ“¦ where this page comes from