⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stime.vhd

📁 乐曲发生的程序设计,正确,是我们老师给我们的,大家看看吧
💻 VHD
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

--  Uncomment the following lines to use the declarations that are
--  provided for instantiating Xilinx primitive components.
--library UNISIM;
--use UNISIM.VComponents.all;

entity stime is
    Port ( clk : in std_logic;
		   hlclk : in std_logic_vector(0 to 1);
		  lsclk : in std_logic_vector(0 to 1);
           tout : out std_logic;
		  mout:out std_logic);
end stime;

architecture Behavioral of stime is

signal temp:std_logic_vector(24 downto 0);

begin

process(clk,hlclk)
begin
     if clk'event and clk='1' then
		temp<=temp+1 ;
    end if;
       case hlclk is
	  when "00"=> mout<=temp(4);
	  when "01"=> mout<=temp(3);
	  when "10"=> mout<=temp(2);
	  when "11"=> mout<=temp(1);
	  when others => null;
	  end case;
	  case  lsclk is
	  when "00"=> tout<=clk;
	  when "01"=> tout<=temp(2);
	  when "10"=> tout<=temp(1);
	  when "11"=> tout<=temp(0);
	  when others => null;
	  end case;
	  -- tout<=temp(1);
	 --  mout<=temp(2);
end process;

end Behavioral;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -