w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
gray2bin_gen.vhd
Go to the documentation of this file.
1-- $Id: gray2bin_gen.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2007- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: gray2bin_gen - syn
7-- Description: Gray code to binary converter
8--
9-- Dependencies: -
10-- Test bench: tb/tb_gray_cnt_n
11-- Target Devices: generic
12-- Tool versions: xst 8.1-14.7; viv 2014.4-2015.4; ghdl 0.18-0.33
13-- Revision History:
14-- Date Rev Version Comment
15-- 2007-12-26 106 1.0 Initial version
16------------------------------------------------------------------------------
17
18library ieee;
19use ieee.std_logic_1164.all;
20
21use work.slvtypes.all;
22
23entity gray2bin_gen is -- gray->bin converter, generic vector
24 generic (
25 DWIDTH : positive := 4); -- data width
26 port (
27 DI : in slv(DWIDTH-1 downto 0); -- gray code input
28 DO : out slv(DWIDTH-1 downto 0) -- binary code output
29 );
30end entity gray2bin_gen;
31
32
33architecture syn of gray2bin_gen is
34
35begin
36
37 proc_comb: process (DI)
38
39 variable ido : slv(DWIDTH-1 downto 0);
40
41 begin
42
43 ido := (others=>'0');
44
45 ido(DWIDTH-1) := DI(DWIDTH-1);
46 for i in DWIDTH-2 downto 0 loop
47 ido(i) := ido(i+1) xor DI(i);
48 end loop;
49
50 DO <= ido;
51
52 end process proc_comb;
53
54end syn;
55
DWIDTH positive := 4
out DO slv( DWIDTH- 1 downto 0)
in DI slv( DWIDTH- 1 downto 0)
std_logic_vector slv
Definition: slvtypes.vhd:31