我看了好几天这个状态机,总是不能达到我的要求100MHZ,放几天,要用状态机的时候在看看!
第一个程序:VHDL设计MOORE型有限状态机时速度问题的探讨
第二个程序:LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
ENTITY moo IS
PORT(clk:IN STD_LOGIC;
ready:IN STD_LOGIC;
we,oe:OUT STD_LOGIC;
read_write:IN STD_LOGIC
);
END moo;
ARCHITECTURE behavioul OF moo IS
TYPE state_type IS(idle,decision,write1,read1);
SIGNAL present_state,next_state:state_type;
BEGIN
state_cmd:PROCESS(clk,present_state,ready,read_write)
BEGIN
CASE present_state IS
WHEN idle=>oe<='0';we<='0';
IF ready='1'THEN
next_state<=decision;
ELSE
next_state<=idle;
END IF;
WHEN decision=>oe<='0';we<='0';
IF read_write='1'THEN
next_state<=read1;
ELSE
next_state<=write1;
END IF;
WHEN read1=>oe<='1';we<='0';
IF ready='1'THEN
next_state<=idle;
ELSE
next_state<=read1;
END IF;
WHEN write1=>oe<='0';we<='1';
IF ready='1'THEN
next_state<=idle;
ELSE
next_state<=write1;
END IF;
END CASE;
END PROCESS state_cmd;
state:PROCESS(clk)
BEGIN
IF clk'EVENT AND clk='1' THEN
present_state<=next_state;
END IF;
END PROCESS state;
END behavioul;
当我的周期是10NS的时候输出没有
tengjingshu_112148725 2009-4-14 09:29