OpenCores
URL https://opencores.org/ocsvn/uart_fpga_slow_control_migrated/uart_fpga_slow_control_migrated/trunk

Subversion Repositories uart_fpga_slow_control_migrated

[/] [uart_fpga_slow_control/] [trunk/] [code/] [library/] [gh_gray2binary.vhd] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 aborga
-----------------------------------------------------------------------------
2
--      Filename:       gh_gray2binary.vhd
3
--
4
--      Description:
5
--              a gray code to binary converter
6
--
7
--      Copyright (c) 2006 by George Huber 
8
--              an OpenCores.org Project
9
--              free to use, but see documentation for conditions 
10
--
11
--      Revision        History:
12
--      Revision        Date            Author          Comment
13
--      --------        ----------      --------        -----------
14
--      1.0             12/26/06        G Huber         Initial revision
15
--
16
-----------------------------------------------------------------------------
17
LIBRARY ieee;
18
USE ieee.std_logic_1164.all;
19
 
20
ENTITY gh_gray2binary IS
21
        GENERIC (size: INTEGER := 8);
22
        PORT(
23
                G   : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0);      -- gray code in
24
                B   : out STD_LOGIC_VECTOR(size-1 DOWNTO 0) -- binary value out
25
                );
26
END entity;
27
 
28
ARCHITECTURE a OF gh_gray2binary IS
29
 
30
        signal iB  : STD_LOGIC_VECTOR(size-1 DOWNTO 0);
31
 
32
BEGIN
33
 
34
        B <= iB;
35
 
36
process (G,iB) is
37
begin
38
        for j in 0 to size-2 loop
39
                iB(j) <= G(j) xor iB(j+1);
40
        end loop;
41
        iB(size-1) <= G(size-1);
42
end process;
43
 
44
END a;
45
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.