diff options
author | Tristan Gingold | 2015-01-10 16:06:11 +0100 |
---|---|---|
committer | Tristan Gingold | 2015-01-10 16:06:11 +0100 |
commit | dcf9335a06eb78c5d977945f713f326e6288ae9a (patch) | |
tree | 2c48f920de286c8fa2a248f698220971f607f4d1 /testsuite/gna/bug23165/mwe_working/counter.vhd | |
parent | cac81bb961266d824a9f2fafb100cc09f2422214 (diff) | |
download | ghdl-dcf9335a06eb78c5d977945f713f326e6288ae9a.tar.gz ghdl-dcf9335a06eb78c5d977945f713f326e6288ae9a.tar.bz2 ghdl-dcf9335a06eb78c5d977945f713f326e6288ae9a.zip |
File bug23165.
Diffstat (limited to 'testsuite/gna/bug23165/mwe_working/counter.vhd')
-rw-r--r-- | testsuite/gna/bug23165/mwe_working/counter.vhd | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/gna/bug23165/mwe_working/counter.vhd b/testsuite/gna/bug23165/mwe_working/counter.vhd new file mode 100644 index 0000000..9982f1d --- /dev/null +++ b/testsuite/gna/bug23165/mwe_working/counter.vhd @@ -0,0 +1,33 @@ +-- counter +-- clk: clock input +-- en: enable input +-- rst: reset input +-- dir: direction pin (1 = up, 0 = down) +-- q: output + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity counter is + generic ( + width : positive := 16 + ); + + port ( + clk : in std_logic; + q : out std_logic_vector(width-1 downto 0) + ); +end counter; + +architecture behav of counter is +signal cnt : unsigned(width-1 downto 0) := to_unsigned(0, width); +begin + process + begin + wait until rising_edge(clk); + cnt <= cnt + to_unsigned(1, cnt'length); + end process; + q <= std_logic_vector(cnt); +end behav; + |