SpinalHDL
1 / 1
Description
Hamming Distance Matrix
Design a hardware module for the Hamming Distance Matrix problem.
Given a stream of unsigned 32-bit vectors, use the first 8 vectors and output the pairwise Hamming distance matrix for an 8 by 8 grid.
If fewer than 8 vectors are provided, treat the missing entries as zero. If more than 8 vectors are provided, ignore the extras.
Hardware I/O Encoding
vectorsis a one-dimensional stream of unsigned 32-bit integers- the output is a two-dimensional stream of unsigned 6-bit integers
- output row
i, columnjis the number of differing bit positions between vectoriand vectorj - rows and columns both run from
0to7
Example
- input
vectors = [10, 12, 3] - the top-left
3 x 3block of the output is[0, 2, 2],[2, 0, 4],[2, 4, 0]
The remaining rows and columns use 0 for the missing vectors.
Input
vectors
Stream of 32-bit Unsigned Integer (up to 64 elements)Input bit vectors. Only the first 8 are used; missing positions are treated as 0.
Output
2D Array of 6-bit Unsigned Integer
An 8 by 8 matrix of pairwise Hamming distances, emitted row by row.