伙计分点少了
呵呵
不过还是帮你一下吧
源程序和仿真波形:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity m6 is
port(clk,rst:in std_logic;
q: out std_logic_vector(2 downto 0));
end m6;
architecture bhv of m6 is
type states is(st0,st1,st2,st3,st4,st5);
signal stx:states;
begin
process(clk)
begin
if rst='1' then stx<=st0;q<="000";
elsif clk'event and clk='1' then
case(stx) is
when st0=>q<="000";stx<=st1;
when st1=>q<="001";stx<=st2;
when st2=>q<="011";stx<=st3;
when st3=>q<="111";stx<=st4;
when st4=>q<="101";stx<=st5;
when st5=>q<="100";stx<=st0;
when others=> stx<=st0;
end case;
end if;
end process;
end bhv;
LIBRARY IEEE;
USE IEEE.STD_ LOGIC_1164. ALL;
ENTITY DFF1 IS
PORT (CLK,D : IN STD_ LOGIC;
Q:OUT STD_OGIC);
ENG;
ARCHITECTURE bhv' OF DFF1 IS
SIGNAL Q1 : .STD_ LOGIC;
BEGIN
PROCESS (CLK,Q1) BEGIN
IF CLK'EVENT AND CLK='1 '
THEN Q1<=D; END IF;
END PROCESS;
Q
到底是D触发器还是六进制同步计数器,说清楚