Close

Should 4 be flipped...

A project log for miniMAC - Not an Ethernet Transceiver

custom(izable) circuit for sending some megabytes over differential pairs.

yann-guidon-ygdesYann Guidon / YGDES 03/23/2025 at 07:130 Comments

Turning the diagrams into code was easy but the first exhaustive tests have shown some.... behaviour that I suspected but didn't find at first.

The principle of the popcount is to flip the whole word when not enough bits are set.

0 => 8
1 => 7
2 => 6
3 => 5

OK but what about 4

Flipping the word when 4 bits are set will not change the number of set bits. So the only effect is to set the corresponding "flip" bit. There are a number of pros & cons about its activation.

Unfortunately it's more complex than that.

The code might have some bugs but already shows that

Apparently a better, precise popcount is required. I didn't know how to do it but it seems I have figured out a solution at last.

Discussions