This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
notes:asm:xorapi [2011/01/30 02:37] – jr018429 | notes:asm:xorapi [2011/05/13 13:35] (current) – [AND() constructor] jr018429 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======XOR class====== | ||
+ | |||
+ | The XOR class implements a functioning logical XOR gate for use with our CPU simulator. | ||
+ | |||
+ | =====XOR() constructor===== | ||
+ | |||
+ | <code c++> | ||
+ | XOR myXorGate; | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | XOR() | none | pointer/ | ||
+ | |||
+ | XOR() is the parameterless constructor that is responsible for creating a new instance of an XOR. | ||
+ | |||
+ | =====reset()===== | ||
+ | reset() will reset both inputs coming into the XOR to FALSE values. | ||
+ | |||
+ | <code c++> | ||
+ | myXorGate.reset(); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void reset() | ||
+ | |||
+ | =====set(bool)===== | ||
+ | set(bool) will take the parameter and set both inputs to that value. | ||
+ | |||
+ | <code c++> | ||
+ | myXorGate.set(true); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void set() | bool | none | | ||
+ | |||
+ | =====set(bool, | ||
+ | set(bool, bool) will take the parameter and set each input to a unique value. | ||
+ | |||
+ | <code c++> | ||
+ | bool a = true; | ||
+ | bool b = false; | ||
+ | |||
+ | ... | ||
+ | |||
+ | myXorGate.set(a, | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void set() | bool, bool | none | | ||
+ | |||
+ | =====setvalue()===== | ||
+ | get() will retrieve the output of the XOR. | ||
+ | |||
+ | <code c++> | ||
+ | bool output = myXorGate.get(); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | bool get(int) | ||