采用CPLD器件XC95288XL-7TQ144I芯片实现Flash读取控制设计

可编程逻辑

1334人已加入

描述

1 概述

本设计已实用于国家863计划“可扩展到T比特的高性能IPv4/v6路由器基础平台及实验系统”项目中。其主要功能是对主控部分的FPGA读取Flash进行控制。

在本项目中,主控部分的FPGA在重启时需要从Flash中下载初始化程序。当下载完成后,FPGA仍会根据需要从Flash相应地址读取数据。这就要求在FPGA和Flash之间有一块控制逻辑来控制对Flash的读取。本设计就是完成的对这块控制逻辑的具体实现。

本文用VHDL语言在CPLD内部编程将其实现。本文第2节给出用VHDL语言在CPLD内部编程实现Flash读取的过程,第3节对全文进行概括总结。

2 实现

2.1 器件的选择

我们选用Xilinx公司XC9500XL 3.3V ISP 系列XC95288XL-7TQ144I芯片。XC95288xl是一个3.3V的低电压、高效的CPLD,在通信和计算机系统中的有广泛的应用。它包含16个54V18个功能块,提供了6400个可用的门电路,这些门电路的传播延时为6ns.

对于Flash,项目中选择了Intel公司的Intel StrataFlash系列的256-Mbit J3型Flash.其数据宽度可分别支持8位或者16位。

2.2 实现中的问题及解决方法

项目中选用的Flash的输出为16位,而向FPGA输出的数据为32位,因此产了数据宽度不匹配的问题,解决的方法有两种:

第一 使用两块相同的Flash,分别将其输出的数据送入FPGA接口的高16位和低16位;其缺点是需要增加一块Flash,从而成本增加。

第二 采用降低读取速度的方法,把从一块Flash中连续两次读取的16位数据拼接起来,组成一组32位的数据后送入FPGA接口。

出于对成本和复杂度的考虑,在此设计中我们采取了第二种方法加以实现。

2.3 基本设计模块图

cpld

2.4 用VHDL进行实现(注:实体部分定义可分别参见模块图中的划分)

Flash control 1

process(reset,gclk)

begin

if reset =‘0’ then

count_reset 《=‘0’;

elsif gclk‘event and gclk =’1‘ then

count_reset 《= not(count(4) and count(3) and count(2));

end if;

end process;

process(count_reset,gclk)

begin

if count_reset =’0‘ then

count 《=(others =》’0‘);

elsif gclk’event and gclk =‘1’ then

count 《=count +1;

end if;

end process;

process(count_reset,reset,enable)

begin

if reset =‘0’ then

F_CS 《=‘1’;

F_OE 《=‘1’;

F_WE 《=‘1’;

elsif count_reset =‘0’ then

F_CS 《= ‘1’;

F_OE 《= ‘1’;

F_WE 《= ‘1’;

elsif enable‘event and enable =’1‘ then

F_Abus 《= C_Abus;

F_CS 《= ’0‘;

F_OE 《= ’0‘;

F_WE 《= ’1‘;

C_Dbus 《= F_Dbus;

end if;

end process;

Flash control 2

d_count_rst 《= not(d_count(1) and (not d_count(0)) and empty);

sig_WD 《= not(d_count(1) and (not d_count(0)));

WR_DATA 《= sig_WD;

process(gclk,d_count)

begin

if reset =’0‘ then

d_count 《= ’1‘;

elsif F_CS = ’1‘ then

d_count1 《= not d_count1 ;

if gclk’event and gclk =‘1’ then

d_count2 《= d_count1;

d_count 《= d_count2;

end if;

end if;

end process;

process(reset,d_count,C_Dbus)

begin

if reset = ‘0’ then

data_adder 《= (others =》‘0’);

elsif d_count‘event and d_count = ’0‘ then

data_adder(31 downto 16) 《= C_Dbus;

elsif d_count’event and d_count = ‘1’ then

data_adder(15 downto 0) 《= C_Dbus;

end if;

end process;

enable 《= enable1 and enable2;

process(reset,d_count,F_CS)

begin

if reset = ‘0’ or F_CS = ‘0’ then

enable1 《= ‘1’;

enable2 《= ‘1’;

elsif d_count‘event then

if gclk’event and gclk =‘1’ then

enable1 《= ‘0’;

enable2 《= not enable1;

end if;

end if;

end process;

process(reset,F_CS)

begin

if reset = ‘0’ then

address《= X“400000”;

elsif F_CS = ‘1’ then

C_Abus 《= address;

address 《= adderss +1;

end if;

end process;

process(reset,F_CS)

begin

if reset = ‘0’ then

address《= X“400000”;

data_adder 《=(others =》‘0’);

elsif F_CS = ‘1’;

address 《= adderss +1;

end if;

end process;

process(d_count2,F_CS)

begin

if F_CS = ‘0’ then

enable1 《= ‘1’;

enable 《= ‘1’;

elsif d_count2 = “00” or d_count2 = “01” then

enable 《= ‘0’;

end if;

end process;

process(gclk,sig_WD)

begin

if sig_WD = ‘1’ then

Pulse_RW 《=‘1’;

elsif gclk‘event and gclk =’1‘ then

W_D1 《= sig_WD;

W_D2 《= W_D1;

if empty =’0‘ then

data_adder1 《= data_adder;

Pulse_RW 《= (W_D1 or (not W_D2));

end if;

end if;

end process;

(注:此程序在Xilinx公司的ISE6.2i环境下用VHDL编程实现,其仿真波形见下图)

cpld

3 结束语

在实际应用中,以此CPLD对Flash的读取进行控制。仿真结果及最后的实际调试都表明该设计符合项目的要求。在程序中通过对读取的记数控制,本设计可以在不增加Flash片数的情况下支持16/32/64位的数据输出宽度。可以节约一定的成本,具有相当的灵活性和实用性。

责任编辑:gt

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分