-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInit.vhd
More file actions
95 lines (68 loc) · 1.55 KB
/
Init.vhd
File metadata and controls
95 lines (68 loc) · 1.55 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity init is
port(
clk :in std_logic;
rst :in std_logic;
init_start :in std_logic;
set :out std_logic;
clk_12 :out std_logic;
data :out std_logic
);
end entity init;
architecture arc_init of init is
-- siganls for init process
signal f6 : std_logic_vector(10 downto 0);
signal counter : integer;
-- signals for clk 12K process
signal count_clk : std_logic_vector(11 downto 0);
signal clk_12_s : std_logic;
begin
--clk process
clk_12_s <= count_clk(11);
-- process count for inner clk
process(rst, clk)
begin
if (rst = '0') then
count_clk <= (others=> '0');
elsif falling_edge(clk) then
count_clk <= count_clk + 1;
end if;
end process;
--process clk12 for out clk
process(rst, clk)
begin
if(rst = '0') then
clk_12 <= '1';
elsif falling_edge(clk) then
clk_12 <= 'Z';
if(init_start = '1') then
clk_12 <= count_clk(11);
end if;
end if;
end process;
--process init f6
process(rst, clk_12_s)
begin
if(rst = '0') then
f6 <= "00110111101";
data <= '1';
set <= '0';
counter <= 0;
elsif falling_edge(clk_12_s) then
data <= '1';
set <= '0';
if (init_start = '1') then
data <= f6(10);
f6 <= f6(9 downto 0) & f6(10);
counter <= counter + 1;
end if;
if(counter = 10) then
set <= '1';
counter <= 0;
end if;
end if;
end process;
end architecture arc_init;