iMackshun

OneBitFullAdder.v

Feb 12th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. // The name of the file containing this code is OneBitFullAdder.v
  2. // ***********************************************************
  3. // One-Bit Full Adder:
  4. // This adder takes three 1-bit numbers (a, b, and cin) and produces a
  5. // sum (sum) and carry-out (cout)
  6. // ***********************************************************
  7. //Marks the beginning of a new module, and it's inputs and outputs.
  8. module OneBitFullAdder(a, b, cin, sum, cout);
  9. //Sets the inputs of the module.
  10. input a, b, cin;
  11. //Set the outputs of the module.
  12. output sum, cout;
  13. //Performs operations on the inputs, assigning them to the outputs. The operations are that of your standard full adder.
  14. assign sum = a ^ b ^ cin;
  15. assign cout = (a & b) | (a & cin) | (b & cin);
  16. //Marks the end of the module.
  17. endmodule
Advertisement
Add Comment
Please, Sign In to add comment