Binary Codes & Error Detection



Shared context
Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected.
Answer & solution
Answer: R₁=I₁; R₂=(I₂∧¬I₃)∨I₄; R₃=I₃∧¬I₂. (no official key was published)
1. R₃ must be one only for valid digits 4 and 5. Their I₃=1 and I₂=0, so R₃=I₃ AND NOT I₂. Illegal inputs are don’t-care, permitting this simple expression.
2. R₂ is one for 2,3,8,9. The term I₂ AND NOT I₃ covers 2,3; I₄ covers 8,9 among valid BCD digits. Therefore R₂=(I₂ AND NOT I₃) OR I₄.
3. Complete netlist: N₂=NOT(I₂); N₃=NOT(I₃); G₂=AND(I₂,N₃); G₃=AND(I₃,N₂); R₂=OR(G₂,I₄); R₃=G₃; R₁ is a wire from I₁. This explicitly identifies every gate input and output and uses exactly the allowed 2 NOT, 2 AND, 1 OR gates.
4. Checking d=6,7 gives I₃=I₂=1, so R₃=R₂=0 and only parity R₁ remains. Checking d=8,9 gives I₄=1 and I₃=I₂=0, so output is 010 or 011. These are the nontrivial modulo reductions.
5. R₃ is the weight-four bit, not R₄. If four output positions are drawn, tie R₄ to zero.