一種基于通用型PCI接口的VHDL-CPLD設(shè)計(jì)
IF c_be=X"6"AND ad_high=X"50"AND state="s1"
本文引用地址:http://2s4d.com/article/255997.htmHTEN read <= i0 i; - -讀
write <= i1 i;
cs_map <= i0 i;
ELSIF c_be=X"7"AND ad_high= X"50"
AND state="s1" THEN
read <= i1 i; - -寫
write <= i0 i;
cs_map <= i0 i;
ELSIF state="s0" THEN
read <= i1 i;
write <= i1 i;
cs_map <= i1 i;
END IF;
END IF;
END PROCESS;
Addr_count:PROCESS (clk) - -操作地址的獲取與地址的遞增
BEGIN
IF falling_edge(clk)THEN
IF state="s1" THEN addr_map< =ad-low;
ELSIF state="s3" THEN addr_map< =addr-map+1;
END IF;
END IF;
END PROCESS;
- - 操作信號(hào)的產(chǎn)生
addr <= addr-map WHEN state="s3" or state="s4"
ELSE "ZZZZZZZZZZZZZ"
trdy <= i0 i WHEN state="s3" or state="s4" or state="s5"
ELSE i1 i;
devsel <= i0 iWHEN state="s3" or state="s4" or state="s5"
ELSE i1 i;
cs <= i0 iWHEN state="s3" or state="s4" ELSE i1 i;
r-w <=NOT clk WHEN write= i0 iAND (state=s3 or state="s4")ELSE i1 i;
state-change:PROCESS(clk,rst) - - 狀態(tài)機(jī)的變化
BEGIN
IF rst= i0 iTHEN state <= s0;
ELSIF falling-edge(clk)THEN
CASE state IS
WHEN s0 = >
IF frame= i1 iAND irdy= i1 iTHEN state <= s0;
ELSIF frame= i0 i AND irdy= i1 i THEN state <= s1;
END IF;
WHEN s1 = >
IF cs_map= i1 iOR (read= i1 iAND write = i1 i)
THEN state <= s0;
ELSIF irdy= i1 iAND read= i0 i THEN state <=s2;
ELSIF frame= i0 iAND irdy= i0 iAND write= i0 i
THEN state <= s3;
ELSIF frame= i1 iAND irdy= i0 iAND write= i0 i
THEN state <= s4;
END IF;
WHEN s2 = >
IF frame= i1 iAND irdy= i1 iTHEN state <= s0;
ELSIF frame= i0 iAND irdy= i0 iAND read= i0 i
THEN state <= s3;
ELSIF frame= i1 iAND irdy= i0 iAND read= i0 i
THEN state <= s4;
END IF;
WHEN s3 = >
IF frame= i1 iAND irdy= i1 iTHEN state <= s0;
ELSIF frame= i0 i AND irdy= i1 i THEN state <= s5;
ELSIF frame= i1 iAND irdy= i0 i THEN state <=s4;
ELSIF frame= i0 i AND irdy= i1 i THEN state <= s3;
END IF;
WHEN s4 = >
ELSIF frame= i1 iAND irdy= i0 iTHEN state <= s4;
END IF;
WHEN s5 = >
IF frame= i1 iAND irdy= i1 iTHEN state <= s0;
ELSIF frame= i0 i AND irdy= i0 iTHEN state <= s3;
ELSIF frame= i1 iAND irdy= i0 i THEN state <=s4;
ELSE state <= s5;
END IF;
WHEN OTHERS = >state <= s0;
END CASE;
END IF;
END PROCESS state_change;
END behave。
5 MaxPlusII的驗(yàn)證
設(shè)計(jì)CPLD時(shí),可使用MaxPlusII軟件來(lái)進(jìn)行邏輯綜合、功能模擬與定時(shí)分析。本例選用 Altera 的Max7000系列在系統(tǒng)可編程器件EPM7064SLC84-5。圖5所示是其讀寫訪問(wèn)的仿真波形圖。
評(píng)論