module yunsuan1(input clk,rst_n,output reg [7:0]a,b,b1,b2,b3,c,d,count);
always @(posedge clk)begin count=count+1;if(count==10) a=-25;if(count==11) a=-26;if(count==12) a=25;if(count==13) a=2;b=~a+1;b1=b>>1;b2=~b1+1;if(a[0])b3=~b1;else b3=~b1+1;end endmodule可以看出负数补码分为奇数和偶数表示:-25和-26的补码都为-13.