0

# Most and least significant bit indexing

Hi,

Would you consider adding most and least significant bit indexing as native IQAN functions? Presumably it could be efficiently implemented using either instructions native to the controller, or in any case using de Bruijn.

Example: lsb_example.idax

Customer support service by UserEcho

Could you elaborate on what you are trying to do with the function group?

Is it about finding the positions of the most significant set bit and the least significant set bit?

And why?

I realize the original example was not very good. I have attached another one that hopefully makes more sense.

Yes, I am trying to find the index/position of the most or least significant bit that is set.

The problem is as follows:

Given an arbitrary number of inputs and an arbitrary number of outputs, make it possible to route any input to any output. If multiple inputs routed to the same output are non-zero, force the output to zero.In short, to achieve this with a scalable implementation, my solution is to map inputs to both array indexes (in an array, ARC) and bit indexes (in a bit field, IMAC), in parallel. By bit twiddling it is fairly straight forward to detect if multiple mutually exclusive inputs (bits) are active (set) simultaneously. The disadvantage (besides being limited to 32 inputs; one per IMAC bit) is that without most or least significant bit indexing as native functions it is relatively costly to determine the index of the set bit in order to lookup the Real input value in the array.

For this reason, I am simply asking/proposing if you would consider adding most and/or least significant bit indexing as native operations/functions in IQAN, as it would be nice to have. However, I do realize that the use/demand for these operations is likely very limited.

If you have any alternative approaches to solve the problem I am all ears :)

Thanks Gustav.

InputOutputRouting.idax

(This application contains two approaches, one I suppose straight forward conventional approach, and one alternative approach with bit twiddling. The comments inside hopefully clarifies what the application does.)

(Just for reference, here is the external library that attempts bit indexing using de Bruijn sequences, LSB fails if the MSB is set. BitIndexing.idex.)