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

📄 前.txt

📁 时钟程序设计
💻 TXT
字号:
entity shizhong is 
  port(clk: in bit;
       f,g,h,j:out bit;
       y:buffer bit_vector(7 downto 0));
end shizhong;
architecture zhong of shizhong is
   signal b,d:integer range 0 to 9;
   signal c,e:integer range 0 to 5;
 begin
   x1:process(clk)
      variable a:integer range 0 to 1000;
     begin
         if clk'event and clk'last_value='0' and clk='1' then
			if a<1000 then a:=a+1;
			else a:=0;
			    if b<9 then b<=b+1;
			    else b<=0;
                               if c<5 then c<=c+1;
			       else c<=0;
                                  if d<9 then d<=d+1;
			          else d<=0;
                                     if e<5 then e<=e+1;
			             else e<=0;
                                     end if;
                                  end if;
                               end if;
                            end if;
                       end if;
          end if;
       end process;
   x2:process(b,c,d,e)
       begin
	        if    b=0 or c=0 or d=0 or e=0 then y<="11111101" ;
                elsif b=1 or c=1 or d=1 or e=1 then y<="01100001" ;
                elsif b=2 or c=2 or d=2 or e=2 then y<="11011011" ;
                elsif b=3 or c=3 or d=3 or e=3 then y<="11110011" ;
                elsif b=4 or c=4 or d=4 or e=4 then y<="01100111" ;
                elsif b=5 or c=5 or d=5 or e=5 then y<="10110111" ;
                elsif b=6 or d=6 then y<="10111111" ;
                elsif b=7 or d=7 then y<="11100001" ;
                elsif b=8 or d=8 then y<="11111111" ;
                elsif b=9 or d=9 then y<="11110111" ;
                end if;
       end process;
    x3:process(b)
       begin
	    if b=0    then f<='0';
            elsif b=1 then f<='0';
            elsif b=2 then f<='0';
            elsif b=3 then f<='0';
            elsif b=4 then f<='0';
            elsif b=5 then f<='0';
            elsif b=6 then f<='0';
            elsif b=7 then f<='0';
            elsif b=8 then f<='0';
            elsif b=9 then f<='0';
            end if;
     end process;
    x4:process(c)
       begin
	    if c=0     then g<='0';
            elsif c=1 then g<='0';
            elsif c=2 then g<='0';
            elsif c=3 then g<='0';
            elsif c=4 then g<='0';
            elsif c=5 then g<='0';
            end if;
     end process;
     x5:process(d)
       begin
	    if d=0    then h<='0';
            elsif d=1 then h<='0';
            elsif d=2 then h<='0';
            elsif d=3 then h<='0';
            elsif d=4 then h<='0';
            elsif d=5 then h<='0';
            elsif d=6 then h<='0';
            elsif d=7 then h<='0';
            elsif d=8 then h<='0';
            elsif d=9 then h<='0';
            end if;
     end process;
    x6:process(e)
        begin
	    if e=0    then j<='0';
            elsif e=1 then j<='0';
            elsif e=2 then j<='0';
            elsif e=3 then j<='0';
            elsif e=4 then j<='0';
            elsif e=5 then j<='0';
            end if;
    end process;
end zhong;

⌨️ 快捷键说明

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