Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The name of the file containing this code is OneBitFullAdder.v
- // ***********************************************************
- // One-Bit Full Adder:
- // This adder takes three 1-bit numbers (a, b, and cin) and produces a
- // sum (sum) and carry-out (cout)
- // ***********************************************************
- //Marks the beginning of a new module, and it's inputs and outputs.
- module OneBitFullAdder(a, b, cin, sum, cout);
- //Sets the inputs of the module.
- input a, b, cin;
- //Set the outputs of the module.
- output sum, cout;
- //Performs operations on the inputs, assigning them to the outputs. The operations are that of your standard full adder.
- assign sum = a ^ b ^ cin;
- assign cout = (a & b) | (a & cin) | (b & cin);
- //Marks the end of the module.
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment