So with a few additions to my 4bit adder with look ahead carry I believe I can now detect over flow situations. I have not tested it 100% but I did do a few test and it worked every time
Check it..
OUT out[4],carry,OvF; //added OvF as an out pin
then added
Or(a=cout12,b=cout13,out=c1,out=carry);
Xor(a=out42,b=c1,out=OvF); for the over flow detection
Now just to add it to my ALU
8bit adder
Add4(a=a[0..3],b=b[0..3],c=c,out=out[0..3],carry=carry1,OvF=OvF1);//ignore overflow in first set
Add4(a=a[4..7],b=b[4..7],c=carry1,out=out[4..7],carry=carry,OvF=OvF);
16bit adder
Add8(a=a[0..7],b=b[0..7],c=false,out=out[0..7],carry=carry1,OvF=OvF1);//ignore overflow here
Add8(a=a[8..15],b=b[8..15],c=carry1,out=out[8..15],carry=carry,OvF=OvF);//out put here
No comments:
Post a Comment