简易通用型PCI接口的VHDL-CPLD设计
S
SIGNALaddr_map:STD_LOGIC_VECTOR(12downto0);
SIGNALread,write,cs-map:STD_LOGIC;
TYPEstate_typeIS(s0,s1,s2,s3,s4,s5);
SIGNALstate:state_type;
BEGIN
Identify:PROCESS(clk)--读、写、从设备的识别
BEGIN
IFrising_edge(clk)THEN
IFc_be=X"6"ANDad_high=X"50"ANDstate=s1
HTENread<='0';--读
write<='1';
cs_map<='0';
ELSIFc_be=X"7"ANDad_high=X"50"
ANDstate=s1THEN
read<='1';--写
write<='0';
cs_map<='0';
ELSIFstate=s0THEN
read<='1';
write<='1';
cs_map<='1';
ENDIF;
ENDIF;
ENDPROCESS;
Addr_count:PROCESS(clk)--操作地址的获取与地址的递增
BEGIN
IFfalling_edge(clk)THEN
IFstate=s1THENaddr_map<=ad-low;
ELSIFstate=s3THENaddr_map<=addr-map+1;
ENDIF;
ENDIF;
ENDPROCESS;
--操作信号的产生
addr<=addr-mapWHENstate=s3ORstate=s4
ELSE"ZZZZZZZZZZZZZ"
trdy<='0'WHENstate=s3ORstate=s4ORstate=s5
ELSE'1';
devsel<='0'WHENstate=s3ORstate=s4ORstate=s5
ELSE'1';
cs<='0'WHENstate=s3ORstate=s4ELSE'1';
r-w<=NOTclkWHENwrite='0'AND(state=s3ORstate=s4)ELSE'1';
state-change:PROCESS(clk,rst)--状态机的变化
BEGIN
IFrst='0'THENsta 《简易通用型PCI接口的VHDL-CPLD设计(第3页)》
本文链接地址:http://www.oyaya.net/fanwen/view/169506.html
SIGNALaddr_map:STD_LOGIC_VECTOR(12downto0);
SIGNALread,write,cs-map:STD_LOGIC;
TYPEstate_typeIS(s0,s1,s2,s3,s4,s5);
SIGNALstate:state_type;
BEGIN
Identify:PROCESS(clk)--读、写、从设备的识别
BEGIN
IFrising_edge(clk)THEN
IFc_be=X"6"ANDad_high=X"50"ANDstate=s1
HTENread<='0';--读
write<='1';
cs_map<='0';
ELSIFc_be=X"7"ANDad_high=X"50"
ANDstate=s1THEN
read<='1';--写
write<='0';
cs_map<='0';
ELSIFstate=s0THEN
read<='1';
write<='1';
cs_map<='1';
ENDIF;
ENDIF;
ENDPROCESS;
Addr_count:PROCESS(clk)--操作地址的获取与地址的递增
BEGIN
IFfalling_edge(clk)THEN
IFstate=s1THENaddr_map<=ad-low;
ELSIFstate=s3THENaddr_map<=addr-map+1;
ENDIF;
ENDIF;
ENDPROCESS;
--操作信号的产生
addr<=addr-mapWHENstate=s3ORstate=s4
ELSE"ZZZZZZZZZZZZZ"
trdy<='0'WHENstate=s3ORstate=s4ORstate=s5
ELSE'1';
devsel<='0'WHENstate=s3ORstate=s4ORstate=s5
ELSE'1';
cs<='0'WHENstate=s3ORstate=s4ELSE'1';
r-w<=NOTclkWHENwrite='0'AND(state=s3ORstate=s4)ELSE'1';
state-change:PROCESS(clk,rst)--状态机的变化
BEGIN
IFrst='0'THENsta 《简易通用型PCI接口的VHDL-CPLD设计(第3页)》