initial commit

This commit is contained in:
2025-01-23 06:58:05 +03:00
parent 8579de5ebc
commit 8f854d046b
193 changed files with 42478 additions and 2 deletions

View File

@ -0,0 +1,29 @@
module overflowDetect (
input [1:0] opCode,
input [3:0] A, B,
input [3:0] Y,
input CarryOUT,
output overflowDetect
);
wire opC;
wire sign1, sign2, sign3, sign4;
wire addOverflow, subOverflow;
wire detect1, detect2;
or o1 (opC, opCode[0], opCode[1]); //check add or sub
xnor xno1 (sign1, A[3], B[3]); // A B same sign
xor xo2 (sign3, A[3], B[3]); // A and B opposite sign
xor xo1 (sign2, Y[3], A[3]); // A and Sum opposite sign
and a01 (addOverflow, sign1, opCode[0]); // A B same for add
and a02 (subOverflow, sign3, opCode[1]); // A B diff for sub
or o2 (detect1, addOverflow, subOverflow);
and a03(detect2, detect1, sign2);
and a04(overflowDetect, opC, detect2);
endmodule