📄 poc.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
entity poc is
port (clk: in std_logic;
reset:in std_logic;
rw: in std_logic;
d: in std_logic_vector(7 downto 0);
cs: in std_logic;
rdy: in std_logic;
a: in std_logic_vector(2 downto 0);
pd: buffer std_logic_vector(7 downto 0);
tr: inout std_logic;
nirq: out std_logic);
end poc;
architecture behave of poc is
signal br: std_logic_vector(7 downto 0);
signal sr: std_logic_vector(7 downto 0);
type state_type is(q0,q1,q2);
signal state: state_type;
begin
process(clk,cs,rdy,reset)
begin
if cs='1' and reset='1' then
tr<='0';
sr<="10000001";
state<=q0;
elsif clk'event and clk='0' then
case state is
when q0=>
if a="000" then
br<=d;
sr<="00000001";
else
sr<=d;
end if;
if sr(7)='1' then
state<=q0;
else
state<=q1;
tr<='1';
end if;
when q1=>
if rw='1' then
pd<=br;
else
null;
end if;
if rdy='1' then
state<=q1;
else
state<=q2;
tr<='0';
end if;
when q2=>
if rdy='0' then
state<=q2;
else
state<=q0;
sr<="10000001";
end if;
end case;
end if;
end process;
nirq<='0' when state=q0 else '1';
end behave;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -