使用公式解码汉明码(7,4)

时间:2019-05-24 12:16:31

标签: c parity hamming-code

此刻,我正试图提出一个解码Hamming(7,4)的公式。 到目前为止,没有一个给我一致的正确解决方案。

我在Google上搜索了很多,但是找不到正确的信息。我的实现使用的校验和数据位的位置与正常情况不同,但是我不想更改它。

奇偶校验位:

enter image description here

我的字节看起来像这样;

 MSB - > 0 D3 D2 D1 D0 P2 P1 P0 < - LSB

我尝试检查圆的奇偶性,并添加1和0以获得二进制数。

p0 wrong would give 0b001 = 1, so that's correct
p1 wrong would give 0b010 = 2, so that's correct
p2 wrong would give 0b100 = 4, there goes my theory

也在网上找到了这个公式;

bit1 = x4 + x5 + x6 + x7 
bit2 = x2 + x3 + x6 + x7 
bit3 = x1 + x3 + x5 + x7 

wrong bit = 4b1+2b2+b3 

这也不起作用

目前我还没有代码,因为我首先需要弄清楚这个问题的逻辑/公式。

我的实际结果不一致,我试图提出一个公式,为我提供正确的解决方案。最好使用位操作,就像我尝试使用圆的偶/奇结果一样。

0 个答案:

没有答案