RoaLogic / Hamming-ECC

Hamming ECC Encoder and Decoder to protect memories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

if (2**$clog2(cw_idx-1) != cw_idx) can impl. the funciton dont fill into 1,2,4,8

cookwchen opened this issue · comments

commented

cw_idx
1 2**$clog2(0) 1
2 2**$clog2(1) 1 (err)
3 2**$clog2(2) 2
4 2**$clog2(3) 4 (ok)
So if cw_idx - 1 < 2 can't met.
Can use a condition:
define p_idx = 1
if (cw_idx == p_idx) p_idx = 2*p_idx;
else store_dbits_in_codeword[cw_idx] = d[bit_idx++];

Fixed