RSS

基于FPGA的PCI总线接口设计

来源:网络 作者:不详 时间:2007-01-11 Tag: 点击:


--- type pci_state is (Idle, Ready, DevTrdyHi, DevLoTrdyHi, DevTrdyLo, OprOver);
signal c_state :pci_state;
---Idle为空闲状态;Ready为准备状态;DevTrdyHi表示DEVSEL#和TRDY#均为高电平状态;DevLoTrdyHi表示DEVSEL#为低电平且TRDY#为高电平状态;DevTrdyLo表示DEVSEL#和TRDY#均为低电平状态;OprOverr表示操作结束状态。
程序如下。
process(pci_rst,pci_clk)
begin
if pci_rst = '0' then
c_state <= Idle;
elsif pci_clk'event and pci_clk='1' then
case c_state is
when Idle=>
if pci_frame_l='1' and pci_irdy_l='1' then
c_state <= Idle;
elsif pci_frame_l='0' then
c_state <= Ready;
else
c_state <= c_state;
end if;
when Ready=>
if pci_frame_l='1' and pci_irdy_l='1' then
c_state <= OprOver;
else
c_state <= DevTrdyHi;
end if;
when DevTrdyHi=>
if pci_frame_l='1' and pci_irdy_l='1' then
c_state <= OprOver;
else
c_state <= DevLoTrdyHi;
end if;
when DevLoTrdyHi=>
if pci_frame_l='1' and pci_irdy_l='1' then
c_state <= OprOver;
else
c_state <= DevTrdyLo;
end if;
when DevTrdyLo=>
if pci_frame_l='1' and pci_irdy_l='1' then
c_state <= OprOver;
elsif pci_frame_l='1' and pci_irdy_l='0' and trdy_l='0' then
c_state <= OprOver;
else
c_state <= c_state;
end if;
when OprOver=>
c_state <= Idle;
when others=>
c_state <= Idle;
end case;
end if;
end process;
---下一步应列出每个状态所对应的并发事件,写出相关的进程。进程语句是一个并行语句,它定义进程被激活时将要执行的特定行为。例如,在Ready状态时,就要判断从主设备方发来的地址信息是否与从设备地址相同,因此要写出地址比较进程。
--- address_compare:process(pci_rst,pci_clk),主要内容是对地址译码,判断地址是否在从设备空间,如果在此空间则可做下一步动作,否则不做其他动作。
---从以上分析过程可以得到整个设计思路如下:在时钟的上升沿采样FRAME#、地址和命令,如果FRAME#有效则译码地址和命令,如果总线命令为011x,并且总线上的地址在目标地址范围内,表明这是对本设备的存储器操作;或者总线命令为101x,且IDSEL信号有效,表明这是对本设备配置空间的操作。在这两种情况下,根据总线命令的最后一位确定是读操作还是写操作,有效DEVSEL#和TRDY#信号,开始数据传输;并在传输过程中采样FRAME#和IRDY#信号,确认最后一个数据周期,无效DEVSEL#和TRDY#信号,结束数据传输。
--- 通过以上设计,在MAX+PLUSII环境下的其中一组模拟结果如图2所示。

结束语
本文给出了在PCI总线上利用FPGA技术设计PCI总线接口的设计方案。利用这项技术可以将自己的的算法技术和一些软件做成硬件,固化到卡上,这样既提高了运行速度,也可以保护知识产权。


1.部分资源来自网络,经ET电子归类整理,旨在服务电子爱好者并无商业目的,不保证正确性与完整性.
2.如果您觉得本站资源对您有用,请告知您的好友,用搜索引擎搜"ET电子"即可.


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
教程下载