Modulo-m binary counter
AssigneeInternational Business Machines Corporation
InventorsSteven R. Carlough, Adam B. Collura
Life of this patent
Estimating the term…
Abstract
An input value, where the input value is an amount which the current value of the counter is to be increased is received. The current value of the modulo binary counter and an offset value of the modulo binary counter are increased by the input value. Whether the current value of the counter is greater than or equal to the modulus value of the binary counter is determined. The current value of the counter is replaced with an updated offset value of the counter, where the updated offset value is the offset value of the counter increased by the input value. The updated offset value of the counter is returned.
Claims20
A method of implementing a modulo binary counter, the method comprising:
- receiving an input value, wherein the input value is an amount which a current value of the modulo binary counter stored in a first register is to be increased, wherein the current value of the modulo binary counter is greater than or equal to zero and less than a modulus value of the modulo binary counter;
- increasing the current value of the modulo binary counter and an offset value of the modulo binary counter stored in a second register by the input value, wherein the offset value of the modulo binary counter is equal to the sum of the current value stored in the first register and a constant;
- determining that the current value of the modulo binary counter is greater than or equal to the modulus value of the binary counter;
- replacing the current value of the modulo binary counter stored in the first register with an updated offset value of the modulo binary counter, wherein the updated offset value is the offset value of the modulo binary counter increased by the input value;
- and
- returning the updated offset value of the modulo binary counter stored in the first register.
A computer program product for implementing a modulo binary counter, the computer program product comprising:
- one or more computer readable storage media and program instructions stored on the one or more computer readable storage media, the program instructions comprising:
- program instructions to receive an input value, wherein the input value is an amount which a current value of the modulo binary counter stored in a first register is to be increased, wherein the current value of the modulo binary counter is greater than or equal to zero and less than a modulus value of the modulo binary counter;
- program instructions to increase the current value of the modulo binary counter and an offset value of the modulo binary counter stored in a second register by the input value, wherein the offset value of the modulo binary counter is equal to the sum of the current value stored in the first register and a constant;
- program instructions to determine that the current value of the modulo binary counter is greater than or equal to the modulus value of the binary counter;
- program instructions to replace the current value of the modulo binary counter stored in the first register with an updated offset value of the modulo binary counter, wherein the updated offset value is the offset value of the modulo binary counter increased by the input value;
- and
- program instructions to return the updated offset value of the modulo binary counter stored in the first register.
A computer system for implementing a modulo binary counter, the computer system comprising:
- one or more computer processors, one or more computer readable storage media, and program instructions stored on the computer readable storage media for execution by at least one of the one or more processors, the program instructions comprising:
- program instructions to receive an input value, wherein the input value is an amount which a current value of the modulo binary counter stored in a first register is to be increased, wherein the current value of the modulo binary counter is greater than or equal to zero and less than a modulus value of the modulo binary counter;
- program instructions to increase the current value of the modulo binary counter and an offset value of the modulo binary counter stored in a second register by the input value, wherein the offset value of the modulo binary counter is equal to the sum of the current value stored in the first register and a constant;
- program instructions to determine that the current value of the modulo binary counter is greater than or equal to the modulus value of the binary counter;
- program instructions to replace the current value of the modulo binary counter stored in the first register with an updated offset value of the modulo binary counter, wherein the updated offset value is the offset value of the modulo binary counter increased by the input value;
- and
- program instructions to return the updated offset value of the modulo binary counter stored in the first register.
Dependencies are inferred from the claim text.