Prev Problem
Next Problem

17. Binary to Gray Code Converter

Design a Binary to Gray Code Converter that converts a 4-bit binary input into its 4-bit Gray code equivalent.

Requirements

  • Module name: bin2gray4
  • Inputs:
    • bin_in[3:0]
  • Outputs:
    • gray_out[3:0]

Expected behavior (full truth table)

bingraybingraybingraybingray
00000000010001101000110011001010
00010001010101111001110111011011
00100011011001011010111111101001
00110010011101001011111011111000

 

Note - Binary to Gray conversion

The most significant bit (MSB) of the Gray code is the same as the MSB of the binary input. Each subsequent bit of the Gray code is obtained by XORing the current bit of the binary input with the previous bit.

Need Help? Refer to the Quick Guide below