1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00
myhdl/example/manual/Inc.vhd
Jan Decaluwe 45a769d82d use modbv
--HG--
branch : 0.8-dev
2012-12-21 15:06:18 +01:00

49 lines
885 B
VHDL

-- File: Inc.vhd
-- Generated by MyHDL 0.8dev
-- Date: Fri Dec 21 15:02:38 2012
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use std.textio.all;
use work.pck_myhdl_08.all;
entity Inc is
port (
count: inout unsigned(7 downto 0);
enable: in std_logic;
clock: in std_logic;
reset: in std_logic
);
end entity Inc;
-- Incrementer with enable.
--
-- count -- output
-- enable -- control input, increment when 1
-- clock -- clock input
-- reset -- asynchronous reset input
-- n -- counter max value
architecture MyHDL of Inc is
begin
INC_INCLOGIC: process (clock, reset) is
begin
if (reset = '0') then
count <= (others => '0');
elsif rising_edge(clock) then
if bool(enable) then
count <= (count + 1);
end if;
end if;
end process INC_INCLOGIC;
end architecture MyHDL;