blob: 2ae42160e71afcde9e4cebd777e6697367a441b4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
-- SPDX-FileCopyrightText: 2023 Brian Woods
-- SPDX-License-Identifier: GPL-2.0-or-later
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity top is
port(
set: in std_logic;
set_val: in unsigned(7 downto 0);
cnt: out unsigned(7 downto 0);
en: in std_logic;
cnt_auto: out unsigned(7 downto 0);
clr: in std_logic;
clk: in std_logic
);
end entity;
architecture func of top is
component counter is
port(
set: in std_logic;
set_val: in unsigned(7 downto 0);
cnt: out unsigned(7 downto 0);
en: in std_logic;
clr: in std_logic;
clk: in std_logic
);
end component;
begin
-- controlled by the top signals
counter01: counter port map(
set => set,
set_val => set_val,
cnt => cnt,
en => en,
clr => clr,
clk => clk
);
-- just counts automatically
counter02: counter port map(
set => '0',
set_val => "00000000",
cnt => cnt_auto,
en => '1',
clr => clr,
clk => clk
);
end func;
|