-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSirene.vhd.bak
48 lines (43 loc) · 903 Bytes
/
Sirene.vhd.bak
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
library IEEE;
use ieee.std_logic_1164.all;
use work.all;
entity Sirene is
generic(
max : in integer;
max2 : in integer);
port(
clk : in std_logic;
selec : in std_logic;
buzzer : out std_logic);
end Sirene;
architecture structural of Sirene is
begin
process(clk)
variable temp : integer := 0;
begin
if rising_edge(clk) then
if selec = 0 then
if temp <= (max/2) then
temp := temp + 1;
buzzer <= '1';
elsif temp > (max/2) and temp < max then
buzzer <= '0';
temp := temp + 1;
elsif temp = max then
temp := 0;
buzzer <= '0';
end if;
elsif selec = 1 then
if temp <= (max2/2) then
temp := temp + 1;
buzzer <= '1';
elsif temp > (max2/2) and temp < max2 then
buzzer <= '0';
temp := temp + 1;
elsif temp = max2 then
temp := 0;
buzzer <= '0';
end if;
end if;
end process;
end structural;