Partitioned "Eq" function (eq)

(Not to be confused with nmigen Value.eq which is listed at assign)

The basic principle here is that the basic (lowest, split) input data is compared (eq'd), then, depending on the partitions, those partial results are ANDed together, on the basis that these chains will tell if all bits in a particular partition are equal.

The end result is the appearance of having performed larger dynamic partitioned equality (==) operator comparisons, but actually those larger comparisons were constructed from smaller parts.

Examples:

  • p2p1p0 all zeros indicates that the partitions are all closed, turning our 4 input byte-level compares into a 32-bit compare. by ANDing all 4 byte-level compares we get a 32-bit result
  • p2p1p0 equal to 0b010 will split into two 16 bit compares. therefore, the first two byte-level compares are ANDed to give a hi half-word compare and likewise the lower.

Boolean truth table

Given the four byte-level comparisons eq0-eq3:

eq0 = a[0:7] == b[0:7]
eq1 = a[8:15] == b[8:15]
eq2 = a[16:23] == b[16:23]
eq3 = a[24:31] == b[24:31]

the truth table for the 4-bit outputs o0-o3 are as follows:

p2p1p0 o0 o1 o2 o3
0 0 0 &(eq0-3) &(eq0-3) &(eq0-3) &(eq0-3)
0 0 1 eq0 &(eq1-3) &(eq1-3) &(eq1-3)
0 1 0 &(eq0-1) &(eq0-1) &(eq2-3) &(eq2-3)
0 1 1 eq0 eq1 &(eq2-3) &(eq2-3)
1 0 0 &(eq0-2) &(eq0-2) &(eq0-2) eq3
1 0 1 eq0 &(eq1-2) &(eq1-2) eq3
1 1 0 &(eq0-1) &(eq0-1) eq2 eq3
1 1 1 eq0 eq1 eq2 eq3