overflow fix
This commit is contained in:
@@ -2,8 +2,7 @@ module subtraction (
|
||||
input [3:0] A, B,
|
||||
input BorrowIN,
|
||||
output [3:0] Y,
|
||||
output BorrowOut,
|
||||
output overflow
|
||||
output BorrowOUT //Overflow signal'ini yani negatif gonderecek
|
||||
);
|
||||
|
||||
wire [3:0] tempB;
|
||||
@@ -12,16 +11,6 @@ wire [3:0] tempB;
|
||||
fullsubtraction f0 (.A(A[0]), .B(B[0]), .BorrowIN(BorrowIN), .Difference(Y[0]), .BorrowOut(tempB[0]));
|
||||
fullsubtraction f1 (.A(A[1]), .B(B[1]), .BorrowIN(tempB[0]), .Difference(Y[1]), .BorrowOut(tempB[1]));
|
||||
fullsubtraction f2 (.A(A[2]), .B(B[2]), .BorrowIN(tempB[1]), .Difference(Y[2]), .BorrowOut(tempB[2]));
|
||||
fullsubtraction f3 (.A(A[3]), .B(B[3]), .BorrowIN(tempB[2]), .Difference(Y[3]), .BorrowOut(BorrowOut));
|
||||
|
||||
// Overflow detection logic as provided
|
||||
overflowDetect od1 (
|
||||
.opCode(2'b10),
|
||||
.A(A),
|
||||
.B(B),
|
||||
.Y(Y),
|
||||
.CarryOUT(BorrowOut),
|
||||
.overflowDetect(overflow)
|
||||
);
|
||||
fullsubtraction f3 (.A(A[3]), .B(B[3]), .BorrowIN(tempB[2]), .Difference(Y[3]), .BorrowOut(BorrowOUT));
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user