User Tools

Site Tools


notes:asm:fulladder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:asm:fulladder [2011/02/19 18:58] bh011695notes: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; </code>
 +
 +^ 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, true, true); </code>
 +
 +^ 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(); </code>
 +
 +^ 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() </code>
 +
 +^ Function ^ Parameter(s) ^ Return Value |
 +|bool getCarryOut() | none | bool |
 +