Closed drandreas closed 5 years ago
Such a great catch.
The new compress; how does this bitshift work?
I don't know vhdl...
if(~corr_i_accum[13])
corr_i_out <= {corr_i_accum[13],
corr_i_accum[12] | corr_i_accum[11] | corr_i_accum[10],
corr_i_accum[12] | corr_i_accum[11] | corr_i_accum[9],
corr_i_accum[8:4]};
corr_i_accum
is an array of bits, so corr_i_accum[13]
is the MSB bit, in our case the sign.
The if
is to handle positive and negative numbers separately (recall max(int) 0b01111...
, -1 0b1111...
and min(int) 0b10000...
).
The assignment is corr_i_out <=
just remapping bits within a single statement using {
and }
.
corr_i_out[8] <= corr_i_accum[13]
corr_i_out[7] <= corr_i_accum[12] | corr_i_accum[11]...
...
corr_i_out[1] <= corr_i_accum[5]
corr_i_out[0] <= corr_i_accum[4]
Note: 8:4
is simply a range so we don't need to assign each of the 5 bits 8 to 4 separately.
Great,
12 or 11 or 10 into one bit.
12 or 11 or 9 into next bit
[8:4] is range. 4,5,6,7,8 (5bits)
I missunderstood the OR part. Now I get it. Thanks for explaining!
The initial code assumed phase shift modulation only. Lately, xcorrelation is also used for load modulation. But the initial the assumption that 11 bits are enough isn't true for load modulation.
This change extends the registers by 2 bits and compresses the upper bits to preserve the sensitivity on the lower end.