This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:asm:nandapi [2011/02/04 02:01] – bh011695 | notes:asm:nandapi [2011/02/04 02:02] (current) – bh011695 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== NAND Class ====== | ||
+ | |||
+ | The NAND class implements a functioning logical NAND gate for use with our CPU simulator. | ||
+ | |||
+ | ===== NAND() Constructor ===== | ||
+ | <code c++> | ||
+ | NAND myNandGate; | ||
+ | </ | ||
+ | |||
+ | |||
+ | ^ Function | ||
+ | | NAND() | ||
+ | |||
+ | NAND() is the parameterless constructor that is responsible for creating a new instance of an NAND. | ||
+ | |||
+ | ===== set(bool) ===== | ||
+ | Takes a single parameter and sets both inputs to that parameter. | ||
+ | |||
+ | <code c++> | ||
+ | myNandGate.set(false); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void set() | bool | none | | ||
+ | |||
+ | ===== set(bool, bool) ===== | ||
+ | Takes two parameters and sets each input to a different parameter. | ||
+ | |||
+ | <code c++> | ||
+ | myNandGate.set(true, | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void set() | bool, bool | none | | ||
+ | |||
+ | ===== get() ===== | ||
+ | Retrieves the output of the NAND. The two input values are sent, as parameters, to myAndGate.set(). The return value of this is then sent to myNotGate.set(). This negated value is then returned by myNand.get(). | ||
+ | |||
+ | ^ Function | ||
+ | | bool get() | none | bool value of the gate's output | | ||
+ | |||