4 ms·
I have used LFSR counter as a program counter in my relay CPU. Instead of building a 12bit half adder that increments +1 that would require 12 relays I got away
by artemonster 3y ago
I have used LFSR counter as a program counter in my relay CPU. Instead of building a 12bit half adder that increments +1 that would require 12 relays I got away with only 3 XORs and 3 relays. When assembling, the linker just scrambles program memory according to LFSR counting pattern and I get +1 counting behaviour :) This technique is used for some very tiny hard-coded CPUs (where program memory is not even ROM, but directly decoded datapath control, like decoded microops in real CPUs) that really need to save on area.
- JoeAltmaier 3y agoHow about Grey code? It's a one-bit change to 'increment'. Wonder if that would be about as simple. FYI conversion between normal binary and grey code is to simply XOR successive pairs of bits.
- artemonster 3y agogrey code is heavy on combinational logic to implement, its goal is not to reduce logic but force counting behaviour in such a way that only 1 bit is changing between transitions, as opposed in normal binary (i.e. 4b0111+1 would cause 4 bit changes). this is useful when crossing clock domains or to add extra builtin error detection capabilities
- JoeAltmaier 3y agoUsed to use it for contact-switches. You turn a knob, say four brushes slide across copper contacts to encode knob position. If you coded position in binary you'd be sparking several bit-changes which for some instants would jump all over the number range, e.g. from three (011) to four (100) could instantaneously go to seven (111) or two (010) etc. Grey code would at most oscillate between the two values e.g. from 010 (three in Grey Code) to 110 (four in Grey Code).
- kevin_thibedeau 3y agoGray code can be implemented with an ordinary binary counter and an XOR with a right-shifted count. It isn't particularly "heavy".
- artemonster 3y agoSorry, after doing extremely low area designs every extra useless gate is „heavy“ :)
- oasisaimlessly 3y agoThe thing you're missing is that an LFSR counter can be 20% of the gates of a binary counter.
- meindnoch 3y agoThe original comment was precisely about avoiding an ordinary binary counter.
- mzs 3y agoNintendo's CIC did a similar ting for the same reason, a polynomial counter though: https://forums.nesdev.org/viewtopic.php?p=55288#p55288 https://forums.nesdev.org/viewtopic.php?p=55288#p55288