I have created the circuit in Vivado. The link for the codeCalculation that I useddid on pen and my test cases can be found herepaper:
x = 111111, y = 100000
y'+1 = 100000
x + y' + 1 = 011111 with Carry out = 1 and overflow = ex-or of 1 and 0 = 1
x = 000000, y = 000000
y'+1 = 000000
x + y' + 1 = 000000 with carry out = 0 and overflow = ex-or of 0 and 0 = 0
What mistake I might be doing https://1drv.ms/f/s!AmyCvVHlJ4uYhTaBH9AaCgKkaaOL?
These two test cases are at time 1000I think it has to do something with 2s complements because 2s complement of 0000000 and 2800 ns respectively100000 are the numbers themselves.
Calculation that I did on pen and paper:have created the circuit in vivado.
xMy =code 111111is this:
Full 1bit Adder:
module FullAdder( a,b,cin,s,cout y) ;
input wire a,b,cin ;
output wire s,cout ;
assign s = 100000cin^a^b;
y'+1assign cout = 100000(b&cin) | (a&cin) | (a&b) ;
xendmodule +
Code y'for +6 1bit =adder:
`timescale 0111111ns/ with1ps
module Carrysixbit_ripple_adder
(
input outwire[5:0] =x,y,
input 1wire andsel,
output wire overflow, =c_out,
output ex-orwire[5:0] ofsum
) 1;
wire andc1,c2,c3,c4,c5,c6 0;
FullAdder =f1 1( .a(x[0]) , .b(y[0]^sel) , .cin(sel) , .s(sum[0]) ,
.cout(c1) ) ;
xFullAdder =f2 000000( .a(x[1]) , y.b(y[1]^sel) =, 000000.cin(c1) , .s(sum[1]) ,
y'+1.cout(c1) =) 000000;
FullAdder f3 ( .a(x[2]) , .b(y[2]^sel) , .cin(c2) , .s(sum[2]) ,
x.cout(c1) +) y';
FullAdder +f4 1( =.a(x[3]) 000000, with.b(y[3]^sel) carry, out.cin(c3) =, 0.s(sum[3]) and, overflow
.cout(c1) =) ex-or;
FullAdder off5 0( and.a(x[4]) 0, =.b(y[4]^sel) 0, .cin(c4) , .s(sum[4]) ,
.cout(c1) ) ;
FullAdder f6 ( .a(x[5]) , .b(y[5]^sel) , .cin(c5) , .s(sum[5]) ,
.cout(c1) ) ;
What mistake I might be doing?
I think it has to do something with 2s complements because 2s complementValue of 0000000 and 100000 aresel for both the numbers themselvestest cases is 1.
What am I missing ?
Any help is highly appreciated.
Thanks.