oh , you can use cover for this
library
ieee;
use
ieee.std_logic_1164.all,
ieee.numeric_std.all,
work.all;
entity CountersTop is
generic(
DATA_WIDTH : positive := 64; -- counter width
N : positive := 4 -- number of slices
);
port(
r, clk, cu_in : IN std_logic;
o : OUT unsigned(DATA_WIDTH - 1 downto 0);
cu_out : OUT std_logic
);
end CountersTop;
architecture rtl of CountersTop is
signal internal_cu : std_logic_vector(N - 1 downto 0);
constant slice : positive := DATA_WIDTH / N;
begin
cntrs :
for i in 0 to N - 1 generate
first : if i = 0 generate
cnt1:
entity counter(v1)
generic map(
DATA_WIDTH => slice
)
port map(
aclr => r,
clk => clk,
sat_in => cu_in,
o => o((I + 1) * slice - 1 downto I * slice),
sat_out => internal_cu(i)
);
end generate first;
follow : if i > 0 generate
cntX:
entity counter(v1)
generic map(
DATA_WIDTH => slice
)
port map(
aclr => r,
clk => clk,
sat_in => internal_cu(i-1),
o => o((I + 1) * slice - 1 downto I * slice),
sat_out => internal_cu(i)
);
end generate follow;
end generate cntrs;
cu_out <= internal_cu(N - 1);
end rtl;
find your DATA_WIDTH and N that conforms you