Post History
module full_adder #(parameter WIDTH = 4) (input logic [WIDTH - 1: 0] a, b, input logic carry_in, output logic carry_out, output logic [WIDTH - 1: ...
Answer
#3: Post edited
- ```
- module full_adder
- #(parameter WIDTH = 4)
- (input logic [WIDTH - 1: 0] a,
- b,
- input logic carry_in,
- output logic carry_out,
- output logic [WIDTH - 1: 0] sum);
- assign {carry_out, sum} = a + b + carry_in;
- endmodule
- ```
The above design is fully parameterised. Full adders of any positive integral widths can be obtained by changing the value of the `WIDTH` parameter.
- ```
- module full_adder
- #(parameter WIDTH = 4)
- (input logic [WIDTH - 1: 0] a,
- b,
- input logic carry_in,
- output logic carry_out,
- output logic [WIDTH - 1: 0] sum);
- assign {carry_out, sum} = a + b + carry_in;
- endmodule
- ```
- The above design is parameterised, so full adders of any positive integral widths can be obtained by changing the value of the `WIDTH` parameter.
#2: Post edited
- ```
- module full_adder
- #(parameter WIDTH = 4)
- (input logic [WIDTH - 1: 0] a,
- b,
- input logic carry_in,
- output logic carry_out,
- output logic [WIDTH - 1: 0] sum);
assign {carry_out, sum} = a + b;- endmodule
- ```
- The above design is fully parameterised. Full adders of any positive integral widths can be obtained by changing the value of the `WIDTH` parameter.
- ```
- module full_adder
- #(parameter WIDTH = 4)
- (input logic [WIDTH - 1: 0] a,
- b,
- input logic carry_in,
- output logic carry_out,
- output logic [WIDTH - 1: 0] sum);
- assign {carry_out, sum} = a + b + carry_in;
- endmodule
- ```
- The above design is fully parameterised. Full adders of any positive integral widths can be obtained by changing the value of the `WIDTH` parameter.
#1: Initial revision
``` module full_adder #(parameter WIDTH = 4) (input logic [WIDTH - 1: 0] a, b, input logic carry_in, output logic carry_out, output logic [WIDTH - 1: 0] sum); assign {carry_out, sum} = a + b; endmodule ``` The above design is fully parameterised. Full adders of any positive integral widths can be obtained by changing the value of the `WIDTH` parameter.