bravoegg
Member level 2
A*x = b, in which A is matrix, x and b are column vectors. Each element in A or x or b are all 1-bit width.
The * and + are all mod 2!!
A is like
so Ax=b could be:
b(1) = x(1) + x(2) + ... + x(n-2) // "+" is mod(2)
b(2) = x(1) + ... + ...
...
b(n-1)= x(1) + x(2) + ... + x(n-2) + x(n-1)
Actually the matrix A I'm working with is much bigger, A is of 192*192. Though it's big, in each row there's at most 12 1s and the left are all 0s.
it's very cumbersome to manually type the code. I try to use generate&for. But getting stucked.
1. the above two for loop is not synthesizable, how could it be modified?
2. matrix A is predetermined and does not change. Lots of A(i,j) are 0s and these A(i,j) * x(j) are constantly 0. Can I trust that the Vivado will automatically synthesize these terms?
////////////////////////////////////////////////////////
There're two problems with the above Ax=b arithmetic. One is that vertically, take x(1) for example, x(1) is driving a LOT of elements, a high fanout is detrimental; Two is that horizontally, take b(n-1) for example, b(n-1) is composed of many levels of addition, thus causing long critical path. But these two are irrelevant to my questions.
The * and + are all mod 2!!
A is like
Code:
1 1 0 0 0 0 ... 1 0
1 0 0 0 0 0 ... 0 0
.
.
.
1 1 1 1 0 0 ... 1 1
so Ax=b could be:
b(1) = x(1) + x(2) + ... + x(n-2) // "+" is mod(2)
b(2) = x(1) + ... + ...
...
b(n-1)= x(1) + x(2) + ... + x(n-2) + x(n-1)
Actually the matrix A I'm working with is much bigger, A is of 192*192. Though it's big, in each row there's at most 12 1s and the left are all 0s.
it's very cumbersome to manually type the code. I try to use generate&for. But getting stucked.
Code:
for(i=0;i<192;i=i+1)
for(j=0;j<192;j=j+1)
b(i) = b(i) + A(i,j) * x(j);
1. the above two for loop is not synthesizable, how could it be modified?
2. matrix A is predetermined and does not change. Lots of A(i,j) are 0s and these A(i,j) * x(j) are constantly 0. Can I trust that the Vivado will automatically synthesize these terms?
////////////////////////////////////////////////////////
There're two problems with the above Ax=b arithmetic. One is that vertically, take x(1) for example, x(1) is driving a LOT of elements, a high fanout is detrimental; Two is that horizontally, take b(n-1) for example, b(n-1) is composed of many levels of addition, thus causing long critical path. But these two are irrelevant to my questions.