// ********************************************************************** // BitAdder.h // // Implementation of a one bit adder. The adder supports both a half // adder and a full adder. // // ********************************************************************** // CS251 - Computer Organization // Spring 1997 // Dickinson College // Grant Braught // // ********************************************************************** #ifndef BITADDER #define BITADDER #include "Logic.h" // ********************* // AddResult structure // ********************* // // This structure is used to hold and return the results of addition // operations. struct AddResult { Bool Sum; // Result of the addition. Bool Carry; // Value of the carry out from the addition. }; // ********************* // Adder Functions // ********************* // // These are the functions that perform the full and half addition. void BitAdder(Bool X, Bool Y, AddResult& Result); // Half Adder - Performs 1 bit addition on X & Y and puts // the result into the Result parameter. void BitAdder(Bool X, Bool Y, Bool CarryIn, AddResult& Result); // Full Adder - Performs 1 bit addition on X, Y & CarryIn and // puts the result into the Result parameter. #endif