P
prasunp
Guest
Hello:
I have the following code. I basically modified my adder to handle
Subtraction. Will I face any problems with this mod. I have rum some
basic imulations and it seems to be working
Thanks
module SUB(A, B, Cin, Sum, Cout);
parameter D_Width = 32;
input [D_Width-1:0] A;
input [D_Width-1:0] B;
input Cin;
output Sum, Cout;
reg [D_Width-1:0] Sum;
reg Cout;
always@(A or B)
begin
assign {Cout,Sum} = A+(~B)+Cin;
end
endmodule
I have the following code. I basically modified my adder to handle
Subtraction. Will I face any problems with this mod. I have rum some
basic imulations and it seems to be working
Thanks
module SUB(A, B, Cin, Sum, Cout);
parameter D_Width = 32;
input [D_Width-1:0] A;
input [D_Width-1:0] B;
input Cin;
output Sum, Cout;
reg [D_Width-1:0] Sum;
reg Cout;
always@(A or B)
begin
assign {Cout,Sum} = A+(~B)+Cin;
end
endmodule