← ProblemsCircuits / Combinational Logic / Basic Gates
Even longer vectors
36%vectorsbasicsThe same neighbour-relationship circuit as before, scaled up to a 100-bit input in[99:0]:
out_both[98:0]— bit i is 1 whenin[i]andin[i+1]are both 1 (bit 99 has no higher neighbour).out_any[99:1]— bit i is 1 whenin[i]orin[i-1]is 1 (bit 0 has no lower neighbour; the output is declared with range[99:1]).out_different[99:0]— bit i is 1 whenin[i]differs from its higher neighbour, treating the vector as circular (bit 99's higher neighbour is bit 0).
At this size, writing 100 single-bit assignments is hopeless — use part-selects, so each output stays a one-line bitwise expression.