G
gene
Guest
Following is a really short snippet. The idea is to stop counting
when the variable ,'bob', saturates at 0xFF. I thought using "~0"
would automatically size to whatever size 'bob' is - but that doesn't
seem to be the case. It would be slick if this worked, because the
condition will never have to be modified regardless of the size of
bob.
Any idea why it doesn't? How about an alternate?
reg [7:0] bob;
always @(posedge clock)
begin
if (bob < ~0)
bob <= bob + 1;
end
when the variable ,'bob', saturates at 0xFF. I thought using "~0"
would automatically size to whatever size 'bob' is - but that doesn't
seem to be the case. It would be slick if this worked, because the
condition will never have to be modified regardless of the size of
bob.
Any idea why it doesn't? How about an alternate?
reg [7:0] bob;
always @(posedge clock)
begin
if (bob < ~0)
bob <= bob + 1;
end