12in1.vhd

来自「在公司做的TCM编解码程序」· VHDL 代码 · 共 48 行

VHD
48
字号
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity DIDQ is
Port (sys_clk : in std_logic;
      reset : in std_logic;
      digit_in : in std_logic_vector(11 downto 0);
      fs : out std_logic;
      digit_out : out std_logic);                   
end DIDQ;

architecture behave of DIDQ is


signal count : std_logic_vector (4 downto 0);
signal n : integer range 0 to 11;

begin

process(sys_clk,n)
variable digit : std_logic_vector(11 downto 0);
begin
if reset='1' then
   digit:=digit_in;
   count<="00000";
   n<=0;
elsif sys_clk'event and sys_clk='0' then
      
       count<=count+1;
       
         if n<=5 then
            fs<='1';
            n<=n+1;
         elsif n=11 then
            n<=0;
            fs<='0';
         else
            fs<='0';
            n<=n+1;
         end if;
        
       digit_out<=digit(n);
end if;    

end process;

end behave;

⌨️ 快捷键说明

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