All problems
SECDED Double Error Detection
Problem
Decode an 8-bit SECDED word holding one Hamming (7,4) codeword plus an even overall parity bit. Return the four data bits when there is no error or a correctable single-bit error, including an error confined to the overall parity bit, and return an empty list when a double-bit error is detected. Positions 1 through 7 hold p1, p2, d1, p4, d2, d3, d4 and index 7 holds the overall parity bit.
Hint
Combine the syndrome with the overall parity check: bad parity with a zero syndrome means only the parity bit flipped.
Test cases
case 1
in: [[0,1,1,0,0,1,1,0]]
expected: [1,0,1,1]
case 2
in: [[0,1,1,0,1,1,1,0]]
expected: [1,0,1,1]
case 3
in: [[0,1,0,0,1,1,1,0]]
expected: []
case 4
in: [[0,1,1,0,0,1,1,1]]
expected: [1,0,1,1]
case 5
in: [[0,0,0,0,0,0,0,0]]
expected: [0,0,0,0]
Starter codePython
def secded_decode(received):
# Your code here
pass5 test cases · run your code against them in the editor