blob: 2e9fcf5d14aaa6c78c630d0e1e64a682636f3a6f (
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
|
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.pkg.all;
entity accum is
port (
clk : std_logic;
b_i : bus_rec_out_t;
res : out std_logic_vector(15 downto 0));
end accum;
architecture behav of accum is
signal acc : unsigned(15 downto 0);
begin
process (clk) is
begin
if rising_edge(clk) then
if b_i.rst = '1' then
acc <= (others => '0');
elsif b_i.stb = '1' then
acc <= acc + unsigned(b_i.dat);
end if;
end if;
end process;
res <= std_logic_vector(acc);
end behav;
|