Binary Data: The binary number system is simply another way to count.It is less complicated than the decimal system because it is composed of only 2 digits.The 2 binary digits are 1 and 0.The position of 1 or 0 in a binary number indicates its weights or value within the number,the weight of each successfully higher position in a binary number is an increasing power of two.
Gray Code: Gray code is an unweighted code,which means that there are no specific weights assigned to the bit positions.The gray code exibhits only a single bit change from one code number to next.Gray code is not an arithmetic code.
The “Reflected binary code”, also known as Gray code after Frank Gray. In a Gray code the adjacent numbers differ by one symbol. The original name reflected binary code is derived from the fact that the second half of the values are equivalent to the first half in reverse order, except for the highest bit, which is inverted.
Applications: Some sensors send information in Gray code. These must be converted to binary in order to do arithmetic operations. Gray codes are widely used to facilitate error correction in digital communications.
entity Binary_Gray is
port( B: in std_logic_vector(3 downto 0);
G: out std_logic_vector(3 downto 0));
architecture behavioral of Binary_gray is
G(2)<= B(3) xor B(2);
G(1)<= B(2) xor B(1);
G(0)<= B(1) xor B(0);