w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
gray_cnt_gen.vhd
Go to the documentation of this file.
1-- $Id: gray_cnt_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: gray_cnt_gen - syn
7-- Description: Generic width Gray code counter
8--
9-- Dependencies: -
10-- Test bench: -
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;
22use work.genlib.all;
23
24entity gray_cnt_gen is -- gray code counter, generic vector
25 generic (
26 DWIDTH : positive := 4); -- data width
27 port (
28 CLK : in slbit; -- clock
29 RESET : in slbit := '0'; -- reset
30 CE : in slbit := '1'; -- count enable
31 DATA : out slv(DWIDTH-1 downto 0) -- data out
32 );
33end entity gray_cnt_gen;
34
35
36architecture syn of gray_cnt_gen is
37
38begin
39
40 assert DWIDTH>=4
41 report "assert(DWIDTH>=4): only 4 or more bit width supported"
42 severity failure;
43
44
45 GRAY_4: if DWIDTH=4 generate
46 begin
47 CNT : gray_cnt_4
48 port map (
49 CLK => CLK,
50 RESET => RESET,
51 CE => CE,
52 DATA => DATA
53 );
54 end generate GRAY_4;
55
56 GRAY_5: if DWIDTH=5 generate
57 begin
58 CNT : gray_cnt_5
59 port map (
60 CLK => CLK,
61 RESET => RESET,
62 CE => CE,
63 DATA => DATA
64 );
65 end generate GRAY_5;
66
67 GRAY_N: if DWIDTH>5 generate
68 begin
69 CNT : gray_cnt_n
70 generic map (
71 DWIDTH => DWIDTH)
72 port map (
73 CLK => CLK,
74 RESET => RESET,
75 CE => CE,
76 DATA => DATA
77 );
78 end generate GRAY_N;
79
80end syn;
81
in CE slbit := '1'
Definition: gray_cnt_4.vhd:33
out DATA slv4
Definition: gray_cnt_4.vhd:35
in CLK slbit
Definition: gray_cnt_4.vhd:31
in RESET slbit := '0'
Definition: gray_cnt_4.vhd:32
in CE slbit := '1'
Definition: gray_cnt_5.vhd:33
out DATA slv5
Definition: gray_cnt_5.vhd:35
in CLK slbit
Definition: gray_cnt_5.vhd:31
in RESET slbit := '0'
Definition: gray_cnt_5.vhd:32
in CE slbit := '1'
DWIDTH positive := 4
in CLK slbit
out DATA slv( DWIDTH- 1 downto 0)
in RESET slbit := '0'
DWIDTH positive := 8
Definition: gray_cnt_n.vhd:44
in CE slbit := '1'
Definition: gray_cnt_n.vhd:48
in CLK slbit
Definition: gray_cnt_n.vhd:46
out DATA slv( DWIDTH- 1 downto 0)
Definition: gray_cnt_n.vhd:50
in RESET slbit := '0'
Definition: gray_cnt_n.vhd:47
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector slv
Definition: slvtypes.vhd:31