• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
        • Base-api
          • Aignet-case
          • Aignet-init
          • Aignet-add-xor
          • Aignet-add-and
            • Ci-id->ionum
            • Literal
            • Gate-id->fanin1
            • Gate-id->fanin0
            • Aignet-set-nxst
            • Aignet-clear
            • Aignet-add-out
            • Regnum->nxst
            • Id->slot1
            • Id->phase
            • Num-regs
            • Num-ins
            • Num-fanins
            • Id->slot0
            • Regnum->id
            • Id->type
            • Id->regp
            • Outnum->fanin
            • Innum->id
            • Id-existsp
            • Aignet-add-reg
            • Aignet-add-in
            • Aignet-rollback
            • Num-outs
            • Num-nxsts
            • Num-gates
            • Fanin-litp
          • Aignet-construction
          • Representation
          • Aignet-copy-init
          • Aignet-simplify-marked-with-tracking
          • Aignet-cnf
          • Aignet-simplify-with-tracking
          • Aignet-complete-copy
          • Aignet-eval
          • Semantics
          • Aignet-transforms
          • Aignet-simplify-marked
          • Aignet-read-aiger
          • Aignet-write-aiger
          • Aignet-abc-interface
          • Utilities
        • Aig
        • Satlink
        • Truth
        • Ubdds
        • Bdd
        • Faig
        • Bed
        • 4v
      • Debugging
      • Projects
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Base-api

    Aignet-add-and

    (aignet-add-and f0 f1 aignet) adds an new AND gate node to the aignet with the given fanin literals.

    Note: this is a very low level function. It is often better to use routines like aignet-hash-and, aignet-hash-or, etc., which can do some simplifications to produce smaller aig networks.

    Logically this is just:

    (cons (gate-node (aignet-lit-fix f0 aignet)
                     (aignet-lit-fix f1 aignet))
          aignet)

    The aignet-lit-fixes ensure that well-formedness of the network is preserved unconditionally.

    In the execution we update the necessary arrays, counts, etc.

    Function: aignet-add-and^

    (defun aignet$a::aignet-add-and^ (f0 f1 aignet)
      (declare
           (xargs :guard (and (litp f0)
                              (litp f1)
                              (aignet$a::aignet-well-formedp aignet))))
      (declare (xargs :guard (and (aignet$a::id-existsp (lit->var f0)
                                                        aignet)
                                  (aignet$a::id-existsp (lit->var f1)
                                                        aignet)
                                  (< (aignet$a::num-fanins aignet)
                                     536870911))))
      (let ((__function__ 'aignet$a::aignet-add-and^))
        (declare (ignorable __function__))
        (cons (and-node (aignet-lit-fix f0 aignet)
                        (aignet-lit-fix f1 aignet))
              (node-list-fix aignet))))