This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:asm:fulladder [2011/03/11 18:55] – [getSum()] bh011695 | notes:asm:fulladder [2011/03/11 19:01] (current) – [set(bool, bool, bool)] bh011695 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Full_ADDER Class ====== | ||
+ | FULL_ADDER Class implements a working full adder circuit for use in the CPU Simulator | ||
+ | ===== FULL_ADDER() Constructor ===== | ||
+ | <code c++> FULL_ADDER myFullAdder; | ||
+ | |||
+ | ^ Function ^ Parameter(s) ^ Return Value | | ||
+ | | FULL_ADDER() | none | instantiation of newly allocated FULL_ADDER object | | ||
+ | |||
+ | FULL_ADDER() is the parameterless constructor that is responsible for creating a new instance of a FULL_ADDER circuit. | ||
+ | |||
+ | ===== set(bool, bool, bool) ===== | ||
+ | Takes 3 parameters and sets a, b, and carryI to those values. The sum is then achieved by sending a and b as inputs into an xor gate. The result of this first xor gate and the carry in are then used as input into a second xor gate. The sum is the result of the second xor gate. | ||
+ | |||
+ | Now the carry out is calculated. The carry out is achieved by first sending a and b as inputs to an xor gate. The result of the xor and the carry in are then sent, as inputs, to an and gate. a and b are also used as inputs to another and gate. The results of the two and gates are then used as inputs to an or gate, which outputs the carry out. | ||
+ | |||
+ | <code c++> myFullAdder.set(true, | ||
+ | |||
+ | ^ Function ^ Parameter(s) ^ Return Value | | ||
+ | |void set() | bool, bool, bool | none | | ||
+ | |||
+ | ===== getSum() ===== | ||
+ | Returns 1 of the two outputs of the full adder, the sum. | ||
+ | |||
+ | <code c++> myFullAdder.getSum(); | ||
+ | |||
+ | ^ Function ^ Parameter(s) ^ Return Value | | ||
+ | |bool getSum() | none | bool | | ||
+ | |||
+ | ===== getCarryOut ===== | ||
+ | Returns 1 of the two outputs of the full adder, the carry out. | ||
+ | <code c++> myFullAdder.getCarryOut() </ | ||
+ | |||
+ | ^ Function ^ Parameter(s) ^ Return Value | | ||
+ | |bool getCarryOut() | none | bool | | ||
+ | |||