-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathseed_counter.vhd
53 lines (45 loc) · 1.33 KB
/
seed_counter.vhd
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
----------------------------------------------------------------------------------
-- Company:
-- Engineer: Regis Galland
--
-- Create Date: 12/16/2019 02:35:55 PM
-- Design Name:
-- Module Name: pseudo_rnd_gen - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;
entity seed_counter is
Generic (threshold : STD_LOGIC_VECTOR(12 downto 0) := "0101101000101"); -- X"5A2C" >> 3
Port ( clk : in STD_LOGIC;
rst : in STD_LOGIC;
seed : out STD_LOGIC);
end seed_counter;
architecture Behavioral of seed_counter is
signal seed_counter : unsigned (12 downto 0);
begin
apu_clk_proc : process(clk)
begin
if rising_edge(clk) then
if rst = '1' then
seed_counter <= (others => '0');
else
seed_counter <= seed_counter + 1;
end if;
end if;
end process;
seed <= '1' when seed_counter < unsigned(threshold) else '0';
end Behavioral;