Draft preview. Lessons are being written and reviewed.

Verilog practice / Problem 8

EasyCombinational

Binary to Gray code

Convert the 4-bit binary number b to Gray code g. In Gray code, neighbouring numbers differ in exactly one bit. The top bit stays the same, and each lower bit is the XOR of that binary bit and the one above it.

Ports

NameDirectionBits
binput4
goutput4

How it's checked

The test tries the input combinations and checks every output for each one.

Stuck? Read the lesson Gray code pointers.

bin2gray.vCtrl + Enter runs