📄 store_controller.vhd
字号:
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY store_controller IS
PORT (ready : IN std_logic;
reset : IN std_logic;
clk : IN std_logic;
read_write : IN std_logic;
we,oe : OUT std_logic);
END store_controller;
ARCHITECTURE state_machine OF store_controller IS
TYPE state_type IS (idle,decision,read,write);
SIGNAL present_state,next_state : state_type;
BEGIN
state_transfer:PROCESS (reset,present_state,ready,read_write)
BEGIN
CASE present_state IS
WHEN idle => we <='0'; oe <= '0';
IF (ready ='1') THEN
next_state <= decision;
ELSE
next_state <= idle;
END IF;
WHEN decision => we <= '0'; oe <= '0';
IF (read_write ='1') THEN
next_state <= read;
ELSE
next_state <= write;
END IF;
WHEN read => we <= '0'; oe <= '1';
IF (ready ='1') THEN
next_state <= idle;
ELSE
next_state <= read;
END IF;
WHEN write => we <= '1'; oe <= '0';
IF (ready ='1') THEN
next_state <= idle;
ELSE
next_state <= write;
END IF;
END CASE;
IF (reset ='1') THEN
next_state <= idle;
END IF;
END PROCESS;
state_register:PROCESS (clk)
BEGIN
IF (clk'event AND clk ='1') THEN
present_state <= next_state;
END IF;
END PROCESS;
END state_machine;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -