Table of Contents

NAND Class

The NAND class implements a functioning logical NAND gate for use with our CPU simulator.

NAND() Constructor

NAND myNandGate;
Function Parameter(s) Return value
NAND() none pointer/variable instantiation of the newly allocated NAND gate

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.

myNandGate.set(false);
Function Parameter(s) Return value
void set() bool none

set(bool, bool)

Takes two parameters and sets each input to a different parameter.

myNandGate.set(true, false);
Function Parameter(s) Return value
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 Parameter(s) Return Value
bool get() none bool value of the gate's output