• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
      • Ipasir
      • Aignet
        • Base-api
          • Aignet-case
          • Aignet-init
          • Aignet-add-xor
          • Aignet-add-and
          • Gate-id->fanin1
            • Gate-id->fanin0
            • Ci-id->ionum
            • Literal
            • 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
            • Num-gates
            • Aignet-rollback
            • Num-outs
            • Num-nxsts
            • 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
      • Projects
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Testing-utilities
      • Math
    • Base-api

    Gate-id->fanin1

    (gate-id->fanin1 id aignet) gets the 1st fanin literal of the AND gate node whose ID is id.

    Logically this is just

    (fanin 1 (lookup-id id aignet))

    The fanin function ensures that the literal returned is a valid fanin, i.e. its ID is less than the ID of the gate node, and is not a combinational output node.

    In the execution this is mostly just a stobj array lookup in the node array.

    Function: gate-id->fanin1

    (defun gate-id->fanin1 (id aignet)
           (declare (xargs :stobjs (aignet)))
           (declare (xargs :guard (natp id)))
           (declare (xargs :guard (and (id-existsp id aignet)
                                       (eql (id->type id aignet)
                                            (gate-type)))))
           (let ((__function__ 'gate-id->fanin1))
                (declare (ignorable __function__))
                (mbe :logic (non-exec (fanin 1 (lookup-id id aignet)))
                     :exec (snode->fanin^ (id->slot1 id aignet)))))