📄 picunit.vhd
字号:
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 12:42:28 02/23/09
-- Design Name:
-- Module Name: PICunit - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity PICunit is
Port ( PIC_clk : in std_logic;
Key_num : in std_logic_vector(2 downto 0);
Set : in std_logic;
Clear : in std_logic;
Door: in std_logic;
Start : in std_logic;
COUNT : in std_logic_vector(3 downto 0);
Counter_EN : out std_logic;
Counter_Reset : out std_logic;
LED : out std_logic_vector(2 downto 0)
);
end PICunit;
architecture Behavioral of PICunit is
signal EN : std_logic := '0'; --DFF of counter_EN
signal temp_LED: std_logic_vector(2 downto 0);
--signal temp_start: std_logic := '1';
begin
process (PIC_clk,Clear,Set,Key_num,Door,Start,EN,temp_LED) --TC
begin
if PIC_clk ='1' and PIC_clk' event then -- event case by key-in
if Clear ='0' or COUNT = x"F"then
EN <= '0'; --disable Counter
Counter_Reset <= '1'; --Reset Counter (ie: 0) --or TC = '1' Clear or init when 1) Clear button OR 2)End of countdown
temp_LED <= "111"; --clear Power LED
else
Counter_Reset <= '0'; --Restore the Counter
if Set = '0' then --Set power when 1)Set key push
case Key_num is
when "001" => temp_LED <= "110"; --low
when "010" => temp_LED <= "101"; --mid
when "100" => temp_LED <= "011"; --high
when others => temp_LED <=temp_LED; --error
end case;
end if;
if Start = '0' and Door = '1' then --Start oven when 1)Start button push AND 2) Door close
EN <= not EN;
end if;
end if;
end if;
--Asyaning
if Door = '0' then --door open
EN <= '0';
end if;
Counter_EN <= EN;
LED<=temp_LED;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -