The module takes a (large) integer number N
as an input and computes the
Collatz sequence until it reaches 1. When it does, it allows reading back
two numbers:
The latter number is an indicator for good candidates for computing path
records. The non-zero upper bits indicate that the highest iterator value
Mx(N)
is in the range of the previous path records and should be recomputed in
the full offline. (Holding on to the entire 144 bits of Mx(N)
number would be
more obvious, but this almost doubles the footprint of the design, hence, this
optimisation).
The module can be in 2 states: IO and COMPUTE. After reset, the chip will be in IO mode. Since the input is intended to be much larger than the available pins, the input number is uploaded one byte at a time, increasing the address of where in the internal 144-bit-wide register that byte should be stored.
Same for reading the output, except that the output numbers are limited to 16-bits each, so it takes much fewer operations to read them.
The full loop of computations works like this:
start compute
pin to high. The chip will start computations and will
pull compute busy indicator
pin to highcompute busy indicator
pin until it gets low againWriting input:
write enable
pin to lowinput0-7
address0-4
write enable
pin to highReading output:
orbit/max select
pin to lowaddress0-4
to 0output0-7
address0-4
to 1output0-7
orbit/max select
pin to highMx(N)
bits# | Input | Output | Bidirectional |
---|---|---|---|
0 | input0 | output0 | address0 |
1 | input1 | output1 | address1 |
2 | input2 | output2 | address2 |
3 | input3 | output3 | address3 |
4 | input4 | output4 | address4 |
5 | input5 | output5 | orbit/max select |
6 | input6 | output6 | start compute |
7 | input7 | output7 | write enable or compute busy indicator |