-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtop.vhd
53 lines (49 loc) · 1.16 KB
/
top.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
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library machX03;
use machX03.all;
entity top is
port (
o_hbIN, o_nSD : out std_logic_vector (2 downto 0)
);
end top;
architecture rtl of top is
-- constant clockFrequencyHz : integer := 12090000;
constant clockPeriod : integer := 20900;
signal clk : std_logic;
signal clkDiv : std_logic := '0';
component OSCH
generic (NOM_FREQ : string := "12.09");
port (
STDBY : in std_logic;
OSC : out std_logic;
SEDSTDBY : out std_logic);
end component;
begin
i_BLDCDrv : entity work.bldc_drv(rtl)
port map(
hbOUT => o_hbIN,
nSD => o_nSD,
clk => clkDiv
);
OSCHInst0 : OSCH
generic map(NOM_FREQ => "12.09")
port map(
STDBY => '0',
OSC => clk,
SEDSTDBY => open
);
process (clk)
variable count : integer range 0 to clockPeriod;
begin
if (clk'event and clk = '1') then
if (count < clockPeriod) then
count := count + 1;
else
clkDiv <= not clkDiv;
count := 0;
end if;
end if;
end process;
end rtl;