Full Adder
A full adder. Takes three inputs, i_a, i_b, and i_carry, and adds them together to generate a sum output, o_sum,
and a carry bit output, o_carry.
Parameters
None
Ports
i_ainput ai_binput bi_carryinput carryo_sumoutput sumo_carryoutput carry
Source Code
full_adder.sv
1`ifndef LIBSV_MATH_FULL_ADDER
2`define LIBSV_MATH_FULL_ADDER
3
4module full_adder (
5 input logic i_a,
6 input logic i_b,
7 input logic i_carry,
8 output logic o_sum,
9 output logic o_carry
10);
11
12 assign o_sum = i_a ^ i_b ^ i_carry;
13 assign o_carry = ((i_a | i_b) & i_carry) | (i_a & i_b);
14
15endmodule
16
17`endif /* LIBSV_MATH_FULL_ADDER */