N
nfirtaps
Guest
Can you do signend arithmetic with integer type. I am negating it here
and seem to be getting strange results.
subtype POINTER is integer range 0 to 16383;
subtype BYTECOUNT is integer range 0 to 16383;
signal readpointer : POINTER;
signal writepointer : POINTER;
signal diffpointer : BYTECOUNT;
.....
if (writepointer >= readpointer) then
diffpointer <= writepointer - readpointer;
else
diffpointer <= (16383-readpointer)+writepointer;
end if;
and seem to be getting strange results.
subtype POINTER is integer range 0 to 16383;
subtype BYTECOUNT is integer range 0 to 16383;
signal readpointer : POINTER;
signal writepointer : POINTER;
signal diffpointer : BYTECOUNT;
.....
if (writepointer >= readpointer) then
diffpointer <= writepointer - readpointer;
else
diffpointer <= (16383-readpointer)+writepointer;
end if;