-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlant_Type_Setting.vhd
54 lines (49 loc) · 1.59 KB
/
Plant_Type_Setting.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
54
--***************************************************************************
--
-- Filename: Plant_Type_Setting.vhd
--
-- Description: Sets the type of plant according to its
-- preferred soil moisture levels so watering
-- suggestion can adjust according to type:
--
-- - Dry (SW0 = 1)
-- Plant prefers dry soil
-- Ex: succulents
-- - Avg.(SW1 = 1)
-- Plant prefers moderately moist soil
-- Ex: everything else
-- - Moist (SW2 = 1)
-- Plant prefers moist soil
-- Ex: ferns
--
-- The selected setting is displayed in the 7-segment display.
--
--
-- Author: Josie Lyon
-- Date: April 23, 2021
--
--***************************************************************************
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.Seven_Seg_Conversion.all;
entity Plant_Type_Setting_SW is
port ( clk : in std_logic;
SW : in std_logic_vector(2 downto 0);
PlantType : out std_logic_vector(2 downto 0));
end entity;
architecture SET_BEHAV of Plant_Type_Setting_SW is
begin
-- Process switch configuration and generate associated 7-segment display output values
SW_Input : process(SW, clk)
begin
if (clk'event and clk = '1') then
case SW is
when "001" => PlantType <= "001";
when "010" => PlantType <= "010";
when "100" => PlantType <= "100";
when others => PlantType <= "000";
end case;
end if;
end process;
end architecture;