Close

Popcount

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/22/2025 at 01:540 Comments

So I made the circuit using CircuiJS, click here !

The OR-combination of d0-d1 seems to work well enough, parity works...

So this actually works as a 15-bit popcount, d0 would act like another parity-affecting bit after all, the popcount has a little bias but it's still a great system.

d0d1d2-d15totalinvertresult
000-70-719-16
008-148-1408-14
010-61-719-15
017-148-1508-15
100-61-719-15
107-148-1508-15
110-62-818-14
117-149-1609-16

So this is proven : despite the compression with OR, NO case results in less than 8 set bits and at least one half of the bits are set on the data word.

The worst cases now are 8 consecutive 0 bits, or 9 cases, or 18 cases when considering the inversion.

0000000011111111
1000000001111111
1100000000111111
1110000000011111
1111000000001111
1111100000000111
1111110000000011
1111111000000001
1111111100000000

So when possible, this should be broken up, somehow...

Parity is even so it should not be contiguous because this increases the run length in the last case.

But at least we have a first estimate of the maximum run length.

For one word.

Because two words could be combined to clear more than 16 bits in a row:

data packet1 : 1111111100000000
parity packet1 : 0
header packet2 : 00
flip packet2 : 0
data packet2 : 0000000011111111

The worst case is 20 consecutive bits !

and there is 50% chances the sequence is stuck to level -1 or +1.

A double or triple parity could solve this...

OR drop the parity and implement a double, half-size popcount.

Discussions