Files
PCXT_MiSTer/rtl/uart/gh_gray2binary.vhd
Aitor Gómez 2b5681324b Beta 0.5
* Added UART module from ao486 project (COM1 assigned to USER I/O pins)
* Automatic loading of the BIOS ROM from /games/PCXT directory
* BIOS ROM hot swapping from the OSD menu
* Updated the code to the latest version of the SDRAM module of KFPC-XT, but not yet implemented in the core... needs to be revised and improved, it does not work properly.
2022-06-03 16:11:01 +02:00

46 lines
1.0 KiB
VHDL

-----------------------------------------------------------------------------
-- Filename: gh_gray2binary.vhd
--
-- Description:
-- a gray code to binary converter
--
-- Copyright (c) 2006 by George Huber
-- an OpenCores.org Project
-- free to use, but see documentation for conditions
--
-- Revision History:
-- Revision Date Author Comment
-- -------- ---------- -------- -----------
-- 1.0 12/26/06 G Huber Initial revision
--
-----------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY gh_gray2binary IS
GENERIC (size: INTEGER := 8);
PORT(
G : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0); -- gray code in
B : out STD_LOGIC_VECTOR(size-1 DOWNTO 0) -- binary value out
);
END entity;
ARCHITECTURE a OF gh_gray2binary IS
signal iB : STD_LOGIC_VECTOR(size-1 DOWNTO 0);
BEGIN
B <= iB;
process (G,iB) is
begin
for j in 0 to size-2 loop
iB(j) <= G(j) xor iB(j+1);
end loop;
iB(size-1) <= G(size-1);
end process;
END a;