2I/P- 5BIT WIDE SUBTRACTOR
module sub_5b (bor,diff,A,B);
input [4:0] A,B;
output [4:0]diff;
output bor;
wire[4:0]b1,b2;
not n1 (b1[0],B[0]);//(1scomp)
not n2 (b1[1],B[1]);//(1scomp)
not n3 (b1[2],B[2]);//(1scomp)
not n4 (b1[3],B[3]);//(1scomp)
not n5 (b1[4],B[4]);//(1scomp)
add2_5b ad1 (unused,b2,5'b00001,b1); //(1scomp+1)
add2_5b ad2 (bor,diff,A,b2); //((2scomp of B) + A)endmodule
logic:- 1st do 1s comp and perform 2s comp for B and add with A.
sub modules :- 5 i/p adder module
No comments:
Post a Comment