Question: 6-bit Adder/Subtractor With Full Adders Using full adders and any any other gates build a 6-bit adder/subtractor with the following ports. typedef logic signed [5:0]
6-bit Adder/Subtractor With Full Adders
Using full adders and any any other gates build a 6-bit adder/subtractor with the following ports.
typedef logic signed [5:0] i6_t; module add_sub_6(output i6_t result, input i6_t a, b, input logic add_sub );
The i6_t type is defined in the main test bench. It specifies a 6-bit signed number. When add_sub is 1, the add_sub_6 performs addition. It subtracts when add_sub is 0. Notice that the final carry is discarded. The typedef for i6_t is:
typedef logic signed [5:0] i6_t;
CODE:
// insert fa
module fa( output logic cout, s, input logic a, b, cin );
logic c1, c2, s1; ha adder1( .c(c1), .s(s1), .a(a), .b(b) ); ha adder2( .c(c2), .s(s), .a(s1), .b(cin) ); or g3( cout, c1, c2); endmodule
module add_sub_6(output i6_t result, input i6_t a, b, input logic add_sub );
// complete with fa and other gates
endmodule
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
