This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
notes:asm:andapi [2011/01/30 00:50] – created wedge | notes:asm:andapi [2011/02/04 01:57] (current) – bh011695 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======AND class====== | ||
+ | |||
+ | The AND class implements a functioning logical AND gate for use with our CPU simulator. | ||
+ | |||
+ | =====AND() constructor===== | ||
+ | |||
+ | <code c++> | ||
+ | AND myAndGate; | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | AND() | none | pointer/ | ||
+ | |||
+ | AND() is the parameterless constructor that is responsible for creating a new instance of an AND. | ||
+ | |||
+ | =====reset()===== | ||
+ | reset() will reset both inputs coming into the AND to FALSE values. | ||
+ | |||
+ | <code c++> | ||
+ | myAndGate.reset(); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void reset() | ||
+ | |||
+ | =====set(bool)===== | ||
+ | set(bool) will take the parameter and set both inputs to that value. | ||
+ | |||
+ | <code c++> | ||
+ | myAndGate.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; | ||
+ | |||
+ | ... | ||
+ | |||
+ | myAndGate.set(a, | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | void set() | bool, bool | none | | ||
+ | |||
+ | =====getvalue()===== | ||
+ | get() will retrieve the output of the AND. | ||
+ | |||
+ | <code c++> | ||
+ | bool output = myAndGate.get(); | ||
+ | </ | ||
+ | |||
+ | ^ Function | ||
+ | | bool get(int) | ||