LatticeSemiconductor
Member level 2
- Joined
- Aug 31, 2013
- Messages
- 45
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 589
Hi, i am trying to increment a value ^^
What i want to do is reducing the number how often it increments linearly. For example, in the first round, it increments every clock cycle, in the second round increments three times every 4 clock cycles, then once every 2nd, then once every 4th clock cycle. The problem is, the steps i want to use is 255, like so:
R1 : increments 255 clock cycles every 255 clock cycles
R2 : increments 254 clock cycles every 255 clock cycles
.
.
.
R51 : increments 4 clock cycles every 5 clock cycles
...
R85 : increments 2 clock cycles every 3 clock cycles
...
R170 : increments 1 clock cycles every 3 clock cycles
...
R254 : increments 1 clock cycle every 255 clock cycles
R255 : increments 0 clock cycles
The solution i came up with was using a shift register of 255 bits to implement this (as a flag to increment).
I wonder if there is a smarter way to do such ???
What i want to do is reducing the number how often it increments linearly. For example, in the first round, it increments every clock cycle, in the second round increments three times every 4 clock cycles, then once every 2nd, then once every 4th clock cycle. The problem is, the steps i want to use is 255, like so:
R1 : increments 255 clock cycles every 255 clock cycles
R2 : increments 254 clock cycles every 255 clock cycles
.
.
.
R51 : increments 4 clock cycles every 5 clock cycles
...
R85 : increments 2 clock cycles every 3 clock cycles
...
R170 : increments 1 clock cycles every 3 clock cycles
...
R254 : increments 1 clock cycle every 255 clock cycles
R255 : increments 0 clock cycles
The solution i came up with was using a shift register of 255 bits to implement this (as a flag to increment).
I wonder if there is a smarter way to do such ???
Last edited: