blob: 91490ac6bc45fa861e845e7e994fccb81273cf57 (
plain)
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
52
53
54
55
56
57
58
|
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity externalerr01_sub is
port (clk : std_logic;
rst : std_logic;
a : std_logic_vector(7 downto 0);
o : out std_logic_vector(7 downto 0));
end externalerr01_sub;
architecture behav of externalerr01_sub is
signal accum : std_logic_vector(7 downto 0);
begin
process (clk) is
begin
if rising_edge(clk) then
if rst = '1' then
accum <= (others => '0');
else
accum <= std_logic_vector(unsigned(accum) + unsigned(a));
end if;
end if;
end process;
process (clk) is
begin
if rising_edge(clk) then
if rst = '1' then
o <= (others => '0');
else
o <= accum;
end if;
end if;
end process;
end behav;
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity externalerr01 is
port (clk : std_logic;
rst : std_logic;
a : std_logic_vector(7 downto 0);
accum : out std_logic_vector(7 downto 0);
o : out std_logic_vector(7 downto 0));
end externalerr01;
architecture behav of externalerr01 is
begin
dut : entity work.externalerr01_sub
port map (clk => clk,
rst => rst,
a => a,
o => o);
accum <= << signal .externalerr01.dut.accum : bit_vector(7 downto 0) >>;
end behav;
|