What is Gray code?
These codes are usually used in digital communication or encrypting purpose.
How to Convert Gray Code to Binary Code ?
we can convert Gray code to binary using following expression
b2 = b3 ⊕ g2
b1 = b2 ⊕ g1
b0 = b1 ⊕ g0
Block schematic for conversion :
Truth table :
Program:
--VHDL code to convert Gray code to binary --
--Library declaration--
library ieee;
--Entity named GrayToBin declaration--
entity GrayToBin is
port(
--g is the Graycode input
g:in bit_vector(3 downto 0);
--b is the binary output
b:out bit_vector(3 downto 0)
);
end GrayToBin;
--Architecture of GrayToBinn
architecture dataflow of GrayToBin is
begin
--Assigning value to output using
--Expression
b(3)<=g(3);
b(2)<=g(3) xor g(2);
b(1)<=g(3) xor g(2) xor g(1);
b(0)<=g(3) xor g(2) xor g(1) xor g(0);
end dataflow;
Output :
If you have any doubt on the above code or you need further assistance please comment below :)
Binary Options listed on Nadex binary option broker comparison. Easy to understand binaries with a range of strike prices and expiry dates. more info here
ReplyDelete