help with a sequence using gate?

Jun 27, 2013 at 1:52pm

help with a sequence using gate?

Hi,

I would like to rotate 0s and 1s like so (counting from 0 to 15)

e.g.

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
etc.

However, my code messes up on the last digit. Im also using 2 gates and think its a bit messy. Would be very grateful if anyone has any ideas how to fix the last digit (when it gets to 15) and also if there are any cleaner ways of doing it.

<code>

– Pasted Max Patch, click to expand. –

</code>

Cheers

#254315
Jun 27, 2013 at 2:31pm

No worries I figured how to do it with ifs and pack,

cheers

#254319
Jun 27, 2013 at 3:12pm

this may also work with what you wanted.

<code>

– Pasted Max Patch, click to expand. –

</code>

#254323
Jun 27, 2013 at 3:41pm

zl.rot pretty much does this.

<code>

– Pasted Max Patch, click to expand. –

</code>

#254324

You must be logged in to reply to this topic.