0

I have a question which asks to design a circuit to convert from binary to gray code, using a boolean expression.

Now I understand you have to use XOR to achieve this. And I understand that XOR means that only one or the other can be true, if both are true thats just nomral OR.

I also understanding how to convert between gray code and binary and vise versa through addition, with this video: Binary to Gray code video

I'm just having trouble understand how to do this using XOR. Below is the task I've been set and they've gave me some examples to start with, but I don't understand them.

If anyone could explain to me how these examples work I would be greatful.

Image of my task and some examples of boolean expressions using XOR

Carl Mummert
  • 81,604
  • Can you tell us what "gray code" means? – Thomas Andrews Feb 07 '16 at 14:10
  • Well i can link you this if that helps https://en.wikipedia.org/wiki/Gray_code –  Feb 07 '16 at 14:15
  • That doesn't excuse you from including it in your question. Help people help you. Otherwise, the more you make people google stuff to understand your question, the more you require them to click on links, the fewer people who will help. – Thomas Andrews Feb 07 '16 at 14:21
  • Well I would have thought that people who are anwering the question already know what the Gray code is. I can't explain it myself so I have to give links. I just want the question answered not this pointless bickering. –  Feb 07 '16 at 15:00
  • Gray code is a resequencing of a set of binary numbers, so that in the new sequence, progressing from one member of the sequence to the next, the difference between any two consecutive members is only in one bit position. See the following: $$\matrix{0000&0000\cr0001&0001\cr0010&0011\cr0011&0010\cr0100&0110\cr0101&0111 \cr0110&0101\cr0111&0100\cr1000&1100\cr1001&1101\cr1010&1111\cr1011&1110\cr1100&1010\cr1101&1011\cr1110&1001\cr1111&1000}$$ – Senex Ægypti Parvi Feb 07 '16 at 15:50
  • I edited Senex' comment. The array environment is not available in the comments, so I replaced it with a \matrix - a similar but slightly limited construct from the plainTeX era. Any TeX-snippet of more than 80 characters may also create problems. The system will then insert extraneous whitespace characters. You can see some in the edited comment. At least it's legible now :-) – Jyrki Lahtonen Feb 07 '16 at 18:43
  • See this thread for an explanation of a particularly simple Gray code. I also warmly recommend everything Dilip Sarwate has posted about these. For example this. – Jyrki Lahtonen Feb 07 '16 at 18:48
  • @Jyrki Lahtonen \ As always, Dr. Lahtonen, you bend over backwards to be helpful. Thank you for reworking my comment. I didn't know what the heck was wrong. – Senex Ægypti Parvi Feb 08 '16 at 00:09
  • Just a comment : I think it is not a "pointless bickering" just for one reason (Personaly, I know what Gray code is) had you written "gray" with a capital "G" : instead, understand that a confusion can occur "a gray code" = "some secret way of coding but which one ???" – Jean Marie Jan 25 '23 at 14:05

1 Answers1

1

Refer to the 4-bit example in the above comment.
Standard binary to Gray code:
$a\mid b\mid c\mid d\qquad\to\qquad p\mid q\mid r\mid s$
where
$p=(a)$
$q=(a\not\equiv b)$
$r=(b\not\equiv c)$
$s=(c\not\equiv d)$
$====================$
Gray code to Standard binary:
$p\mid q\mid r\mid s\qquad\to\qquad a\mid b\mid c\mid d$
where
$a=(p)$
$b=(p\not\equiv q)$
$c=(p\not\equiv q\not\equiv r)$
$d=(p\not\equiv q\not\equiv r\not\equiv s)$
The XOR $\not\equiv$ operation is associative, so the order in which these multiple XORs are performed is immaterial.