hallovipin
Member level 1
Hi friends
module (operand_1, operand_2, sum );
input [7:0] operand_1, operand_2;
output reg [8:0] sum;
reg [8:0] difference;
initial begin
difference=0;
sum=0;
end
always @(posedge clk) begin
difference = operand_1-operand_2;
sum = sum + difference;
end
Now the question is if difference is -ve (2-3) at some point what will happen to sum. whether sum will recognize it and decrease or it will not treat difference as 2's complement and will simply increase
module (operand_1, operand_2, sum );
input [7:0] operand_1, operand_2;
output reg [8:0] sum;
reg [8:0] difference;
initial begin
difference=0;
sum=0;
end
always @(posedge clk) begin
difference = operand_1-operand_2;
sum = sum + difference;
end
Now the question is if difference is -ve (2-3) at some point what will happen to sum. whether sum will recognize it and decrease or it will not treat difference as 2's complement and will simply increase