第 1章 FPGA和 CPLD器件结构
<EDA技术 与应用 > 课程讲义
合肥工业大学 彭良清
本章内容(一)
1,PLD期间的发展历程
2,PLD器件的基本结构
3,基于存储器的 PLD器件原理
4,PLA和 PAL器件原理
5,GAL器件原理
6,CPLD器件原理
7,FPGA原理
? 更多 ······
本章内容(续一)
7,Altera公司的 PLD器件综述
8,Xilinx公司的 PLD器件综述
9,Lattice公司的 PLD器件综述
10,PLD器件的配置与编程
11,PLD器件中的 JTAG技术和 ISP技术
PLD期间的发展历程
? 1970,PROM,EPROM,EEPROM结构的 PLD
? 1974,PLA ( Programmable Logic Array )
? 1977,PAL ( Programmable Array Logic ) MMI
公司,PAL16L8
? 1985 GAL ( Generic Array Logic ) Lattice公司
GAL16V8,GAL20V8
? 1985,EPLD ( Eraable PLD)Altera公司
? 1985,FPGA ( Field Progamable Gate Array)
Xilinx公司
? 1989,CPLD ( Complex PLD) Lattice公司
PLD器件的基本结构
逻辑可编程
基于存储器的 PLD器件原理
PROM的基本结构
地址位宽度, n
数据位宽度, m
PROM的
逻辑函数
不可编程
可编程
PROM可编程逻辑阵列
我们现在来看一个
4X2的 PROM的电路结构
4X2 PROM的逻辑阵列图
连接符号
用 PROM实现半加器
0 0
0 1
0 1
1 0
这些存储单元的值?
半加器逻辑表达式
( PROM) PLD的问题?
? 只能用于组合逻辑
? 输入变量的增加,存储容量按 2的幂次增加
? 不适合很多输入变量的组合逻辑电路实现
? 原因?
与阵列 不可编程;
或阵列 可编程。
? 解决办法?
PLA
PLA的结构
与或阵列均可编程
PLA与 PROM的比较
PLA
PROM地址
000
001
010
011
100
101
110
111
PLA的问题
?需要简化的逻辑函数表达式。
?多输入输出时,简化算法复杂。
?运行速度下降。
?已经淘汰,现主要用于全定制 ASIC芯片中
?新的替代 PLD器件是?
PAL的结构
等价表达
与阵列
可编程
或阵列
固定
PAL 16V8的结构
PAL器件的方框图
PAL器件的特点
1,与阵列可编程,或阵列不可编程
2,具有时钟输入,触发器电路,可用于时序电
路设计
3,不同应用需要不同 PAL器件,器件种类较多
4,采用熔丝工艺,一次编程。
? 已经被 GAL 器件所取代
GAL的原理
? 和 PAL基本一样,差别是:
1,输出端增加了通用结构输出逻辑宏单元
( OLMC)
2,改变输出方式,通过软件对其编程即可实现,
而 PAL必须进行硬件的改变。
3,使用过程中,一种 GAL器件可以替代相同管脚
数的所有 PAL器件。
4,存储单元采用 E2CMOS技术,可重复擦写。
GAL


OLMC结构之 1,2( GAL)
寄存器输出结构
寄存器双向输出结构
OLMC结构之 3,4( GAL)
组合输出双向结构
复合型组合输出结构
OLMC结构之 5,6( GAL)
反馈输入结构
输出反馈结构
OLMC结构之 7( GAL)
简单模式输出
GAL器件的问题?
1,规模太小
2,计算器资源太少,不能构成复杂时序电路。
3,I/O不够灵活,限制了片内资源的利用率。
4,需要专用编程工具
? 解决,CPLD的出现
CPLD的原理
?产品
? Altera的 MAX7000,MAX3000系列( EEPROM
工艺)
? Xilinx的 XC9500系列( Flash工艺)
? Lattice,Cypress的大部分产品( EEPROM工艺)
?下面以 Altera公司的 MAX7000系列介绍之。
MAX7000系列框图
MAX7000结构框图
基于乘积项的 PLD
?PLD的组成:
? 宏单元( Marocell)
? 可编程连线( PIA)
? I/O控制块
?宏单元
? 宏单元是 PLD的基本结构,由它来实现基本的逻
辑功能, 下图 是宏单元( Marocell),的结构
MAX7000的宏单元结构( 原图 )
宏单元的构成说明(一)
? 由三部分组成
1,乘积项阵列
基本乘积项,共享扩展乘积项,并联扩展乘积项,
2,乘积项选择矩阵
3,可编程 D触发器
? 各部分的具体作用是,???
宏单元的构成说明(二)
1,乘积项阵列(图左)
? 实际就是一个与或阵列,每一个交叉点都是一个可编程
熔丝,如果导通就是实现“与”逻辑。
2,乘积项选择矩阵(图中间)
? 是一个“或”阵列。两者一起完成组合逻辑。
3,可编程 D触发器(图右侧)
? D触发器的时钟,清零输入都可以编程选择,可以使用
专用的全局清零和全局时钟,也可以使用内部逻辑(乘
积项阵列)产生的时钟和清零。如果不需要触发器,也
可以将此触发器旁路,信号直接输给 PIA或输出到 I/O脚。
共享扩展乘积项( Shareable Expanders)
局部连线
共享扩展
项提供的
“与非”
乘积项
宏单元的
乘积项
逻辑
宏单元的
乘积项
逻辑
原图
并联扩展乘积项( Parallel Expanders)
参看原图
不同宏单元信号的
级联
实现复杂逻辑
可编程连线阵列( PIA)
LAB
参看原图
I/O控制块( I/O Control Blocks)
参看原图
问题:
软件如何进行编程?
PLD器件 I/O的使用提示
1,可配置为:
1,单向输入、单向输出、双向、三态等端口
2,PLD器件内部信号不能实现“高阻态”
3,与其他器件连接时应注意电平匹配
4,高阻输出时,不能连接过高的电平逻辑
? 请看下图的接法 LED是否能控制?
I/O的高阻输出
IO56=‘Z’ LED 不亮
IO56=‘0’ LED 亮
是吗?
FPGA原理:查找表
? 采用查找表结构的 PLD称为 FPGA
? 如 altera的 ACEX,APEX系列,xilinx的 Spartan,Virtex系列等。
? 查找表( Look-Up-Table)简称为 LUT,LUT本质上就是一个
RAM。
? FPGA中 用 4输入的 LUT
? 每一个 LUT 相当于 一个有 4位地址线的 16x1的 RAM。
? 一个 N输入 LUT可以实现 N个输入变量的任何逻辑功能,如
N输入“与”,N输入“异或”等。
? 查找表实例
4输入查表表的例子
查找表的工作过程说明
LUT的工作过程
? 用户通过原理图或 HDL语言描述了一个逻辑电路
? PLD/FPGA开发软件计算逻辑电路的所有可能的结
果(代码),并把结果事先写入 RAM
? 输入一个信号进行逻辑运算 就等于 输入一个地址
进行查表,找出地址对应的内容,然后输出即可。
实际的 LUT结构
FLEX10K系列结构
..,IOCIOC
IO
C
IO
C.,,
..
.IOC
..
.
IOC
IOC
..
.IOC,..
IOC
IOC
逻辑单元 LE
..,IOCIOC,.,IOCIOC
IO
C
IO
C.,,
快速通道互连
IO
C
IO
C.,,
参见原图
逻辑阵列块 LAB
LAB图示
参见原图
LE结构图
数据 1
Lab 控制 3
LE 输出
进位链 级联链查找表 (LUT)
清零和
预置逻辑
时钟选择
进位输入 级联输入
进位输出 级联输出
Lab 控制 1
CLRN
D Q数据 2数据 3
数据 4
Lab 控制 2
Lab 控制 4 参见原图
快速通道 FastTrack
I/O单元与
专用输入端口
参见原图
嵌入式阵列块 EAB
( Embedded Array Block)
参见原图
EAB的位置和作用
?位置,EAB在 PLD器件的 I/O端口附近,不是
位于 PLD器件的中间(?)
?用作 ROM,RAM,FIFO等各种类型存储器
?实现计数器,地址译码器,硬件乘法器等
?多个 EAB可组合,以满足更大规模的应用
软件人员的 FPGA?
?Steven Watkis说, ( Blue Pacific Computing 的共同创始人兼
总裁)
FPGA
最终 是为
软件人员 服务
的硬件。
Altera公司的 PLD器件综述
1,PLD器件
? MAXII
2,主流 FPGA产品
? Cyclone(飓风)
? CycloneII
? Stratix
3,FPGA配置芯片
? 配置 EEPROM
? Cyclone专用配置器件
?
4,早期器件,大部分已经停产
早期器件,大部分已经停产
1,MAX7000S/AE/B,MAX3000A ( PLD)
2,FLEX10K/E,ACEX1K (FPGA)
3,FLEX6000 (FPGA)
4,APEX20K/20KE (FPGA)
5,APEXII (FPGA)
6,StratixGX (FPGA)
MAX II
1,新一代 PLD器件,2004年底推出
2,0.18um falsh工艺,
3,采用 FPGA结构,配置芯片集成在内部,和普通 PLD
一样上电即可工作。
4,容量比上一代大大增加
5,内部集成一片 8Kbits串行 EEPROM,增加很多功
能。
6,MAXII采用 2.5v或者 3.3v内核电压,MAXII G系列
采用 1.8v内核电压
? 型号表
Cyclone(飓风),
1,Altera中等规模 FPGA,2003年推出,
2,0.13um工艺,1.5v内核供电,
3,与 Stratix结构类似,
4,低成本 FPGA,目前主流产品,
5,配置芯片也改用全新的产品。
? 型号表
CycloneII:
1,Cyclone的下一代产品,2005年开始推出,
2,90nm工艺,1.2v内核供电,
3,属于低成本 FPGA,性能和 Cyclone相当,
4,提供了硬件乘法器单元
? 型号表
Stratix,
1,altera大规模高端 FPGA,2002年中期推出,
2,0.13um工艺,1.5v内核供电。
3,集成硬件乘加器,
4,芯片内部结构比 Altera以前的产品有很大变
化。
? 型号表
StratixII:
1,Stratix的下一代产品,2004年中期推出,
2,90um工艺,1.2v内核供电,
3,大容量高性能 FPGA
? 型号表
配置 EEPROM
1,用于配置 SRAM工艺 FPGA的 EEPROM,
2,EPC2以上的芯片可以用电缆多次擦写
? 型号表
Cyclone专用配置器件
1,专门用于配置 Cyclone器件的 EEPROM,
2,可以用 ByteblasterII在线改写,
3,电压为 3.3v
? 型号表
Xilinx公司的 PLD器件综述
1,主流 PLD产品
? XC9500; XC9500XL/XV:
? CoolRunner-II:
2,主流 FPGA产品
? Spartan IIE; Spartan II; Spartan
? Spartan-3/3L; Spartan-3E:
? Virtex-II pro; Virtex-4; Virtex-II
3,配置器件
? XCF01/02/04/08/16/32 系列
? XC18V01/ 02/04 系列(早期产品)
? XC17V01/ 02/04 系列(早期产品)
目前主流产品
Lattice公司 的 PLD器件综述
1,主流 PLD产品
? MachXO:
? ispMACH4000V/B/C/Z
2,主流 FPGA产品:
? LatticeEC/ECP:
? LatticeXP:
3,数模混合产品
? ispPAC
? ispPAC- Power
PLD器件的配置与编程
?何谓配置和编程?
? 将 VHDL代码形成的文件写入 PLD器件的过程
?配置( configure)和编程 (program)的区别
? Program:对 flash或者 EEPROM工艺的配置芯片
或者 PLD器件进行写入的过程
? Configure:对 SDRAM工艺的 FPGA写入数据必
须每次上电后均要进行一次,编程文件保存在配
置芯片中,上电时从编程芯片下载到 FPGA中
Altera的 CPLD和 FPGA的
配置编程过程
?CPLD器件可独立使用,无需其他编程芯片,
直接通过 JTAG接口或其他接口进行编程
?FPGA器件不能独立使用(调试时可以),
需要和配置芯片一起使用,在生产时,代码
写入配置芯片中,应用时,加电后代码自动
从配置芯片写入 FPGA中
PLD器件的 2种配置方法
2,通过专用编程器配置
1,通过 PC机配置
通过专用编程器配置
MAX7128的配置电路
? MAX 7000S devices are in-system programmable via an
industry-standard 4-pin Joint Test Action Group (JTAG)
interface (IEEE Std,1149.1-1990).
? The ISP circuitry in MAX 7000S devices is compatible
with IEEE Std,1532 specification,The IEEE Std,
1532 is a standard developed to allow concurrent ISP
between multiple PLD vendors.
? 电路图
MAX7128的配置电路图
多片 MAX7128的配置电路图
Altera公司的 FPGA的配置
共有 7种模式:
1,Passive Serial (PS)
2,Active Serial (AS)
3,Passive Parallel Synchronous (PPS)
4,Fast Passive Parallel (FPP)
5,Passive Parallel Asynchronous (PPA)
6,Passive Serial Asynchronous (PSA)
7,Joint Test Action Group (JTAG) JTAG模式
可通过 FGPA的 MSEL0,MSEL1引脚选择
被动 /主动
串行 /并行
异步 /同步
???
有关配置的术语
?被动 /主动
是指 FPGA的配置过程是 FPGA发起 还是配置器件(主
机 host)发起,如是 FPGA器件发起配置,则为主动,
否则为被动
?串行 /并行
配置数据通过一根数据线传送道到 FPGA中为串行,并
行配置一般有 8根数据线,速度更快
?异步 /同步
异步配置,没有时钟信号线,同步配置有时钟信号线
Passive Serial (PS) 被动串行
可通过一下 2种方式配置:
1,the enhanced configuration devices
EPC16,EPC8,and EPC4),EPC2,EPC1,EPC1441
2,serial synchronous microprocessor interface:
I,he USB Blaster USB Port Download Cable,
II,MasterBlasteTMr communications cable,
III,ByteBlasterTM II parallel download cable
IV,ByteBlasterMVTM parallel port download cable.
Active Serial (AS) 主动串行
1,Configuration with the serial configuration
devices (EPCS1 and EPCS4).
2,用于 Cyclone系列器件的配置
3,必须使用 ByteBlaster II电缆
Passive Parallel Synchronous (PPS)
被动并行同步
1,Configuration with a parallel synchronous
microprocessor interface.
用于 微处理器对 FPGA进行配置,配置为并行
传输,同步
Fast Passive Parallel (FPP) 快速被
动并行
Configuration with an enhanced configuration
device or parallel synchronous microprocessor
interface where 8 bits of configuration data are
loaded on every clock cycle,Eight times faster
than PPS.
比 PPS模式快 8倍的配置模式,其他同 PPS
Passive Parallel Asynchronous (PPA)
被动并行异步
Configuration with a parallel asynchronous
microprocessor interface,In this scheme,the
microprocessor treats the target device as
memory.
用于微处器配置电路
Passive Serial Asynchronous (PSA)
被动串行异步
Configuration with a serial asynchronous
microprocessor interface.
用于微处器配置电路,串行线路
Joint Test Action Group (JTAG)
JTAG模式
Configuration through the IEEE Std,1149.1
(JTAG) pins,(1)
1,使用 JTAG接口配置,
2,调试时最常用的配置方式
FPGA配置电路图,Cyclone器件
多个 Cyclone器件配置
调试时的 Cyclone器件配置
配置电路的设计问题
1,选择合适的配置模式( PS,JTAG,AS等)
根据 FPGA类型,并考虑 调试和运行 2种状态的配置
模式
2,选择配置器件( EPC2,EPS1,MCU等)
根据器件,FPGA类型,芯片的价格等
3,选择一种编程电缆,可自行制作配置电缆电路
根据 FPGA类型,一般按:
I,ByteBlaster II
II,ByteBlaster MV
III,ByteBlaster
的顺序选择。
ByteBlaster II编程 电缆电路
ByteBlaster II的 10 PIN 插头定义
ByteBlaster MV
编程电缆电路
ByteBlaster MV的 10 PIN 插头定义
ByteBlaster 编程电缆电路
ByteBlaster 的 10 PIN 插头定义
PLD器件中的 JTAG技术和 ISP技术
1,何为 JTAG?
2,何为 ISP?
JTAG:起源
1,随着 IC技术的发展,PCB越来越复杂,尤其是
SMD器件 (surfacemount packaging device) 的大
量使用,PCB面积越越小。
2,传统测试方法 难以使用
1,external test probes(外部测试探针)
2., bed-of-nails” test fixtures(针床测试设备)
? 1980年,JTAG( the Joint Test Action Group)组
织提出了一种新的测试方案
JTAG:结构
? 定义了一种 boundary-scan testing 方法,在 IC
芯片中增加实现这种测试的电路。
? 该方法后来成为 IEEE1149.1标准
? 图示:
JTAG接口的信号定义
引 脚 描 述 功 能
T D I 测试数据输入
( T e s t D a t a I np ut )
测试指令和编程数据的串行输入引脚。数据在 T C K 的上
升沿移入。
T D O 测试数据输出
( T e s t D a t a O ut pu t )
测试指令和编程数据的串行输出引脚,数据在 T C K 的下
降沿移出。如果数据没有被移出时,该引脚处于高阻态。
T M S 测试模式选择
( T e s t M od e S e l e c t )
控制信号输入引脚,负责 T A P 控制器的转换。 T M S 必须
在 T C K 的上升沿到来之前稳定。
T C K 测试时钟输入
( T e s t C l oc k I np ut )
时钟输入到 B S T 电路,一些操作发生在上升沿,而另一
些发生在下降沿。
T R S T 测试复位输入
( T e s t R e s e t I np u t )
低电平有效,异步复位边界扫描电路 ( 在 I E E E 规范中,
该引脚可选 ) 。
JTAG:功能
? 有 3个功能:
1,内部测试 一 IC内部的逻辑测试
2,外部测试 一 IC间相互连接的测试( PCB线路
测试)
3,取样测试 一 IC正常运行时的数据取样测试
? 现在,JTAG电路和接口被广泛用于芯片的
代码下载,请看 电路图
FLEX 10K等器
件的 JTAG电路
JTAG:更多内容
参见文献:
1,IEEE 1149.1 (JTAG) Boundary-
ScanTesting in Altera Devices
September 2000,ver,4.05 Application
Note 39
2,相关器件的 datasheet
The end.
连接符号
返回
返回
Shareable Expanders
Each LAB has 16 shareable expanders that can be viewed as a pool of
uncommitted single product terms (one from each macrocell) with
inverted outputs that feed back into the logic array,Each shareable
expander can be used and shared by any or all macrocells in the LAB to
build complex logic functions,A small delay (tSEXP) is incurred when
shareable expanders are used,Figure 5 shows how shareable expanders
can feed multiple macrocells.
每个 LAB有 16个共享逻辑扩展项,
电路结构图
返回
Parallel Expanders(一)
Parallel expanders are unused product terms that can be
allocated to a neighboring macrocell to implement fast,
complex logic functions.Parallel expanders allow up to 20
product terms to directly feed the macrocell OR logic,with
five product terms provided by the macrocell and 15
parallel expanders provided by neighboring macrocells in
the LAB,更多
Parallel Expanders(二)
The compiler can allocate up to three sets of up to five
parallel expanders automatically to the macrocells that
require additional product terms.Each set of five parallel
expanders incurs a small,incremental timing delay
(tPEXP),For example,if a macrocell requires 14 product
terms,the Compiler uses the five dedicated product terms
within the macrocell and allocates two sets of parallel
expanders; the first set includes five product terms and the
second set includes four product terms,increasing the total
delay by 2 × tPEXP,更多
Parallel Expanders(三)
Two groups of 8 macrocells within each LAB (e.g.,
macrocells 1 through 8 and 9 through 16) form two chains
to lend or borrow parallel expanders,A macrocell borrows
parallel expanders from lowernumbered macrocells,For
example,macrocell 8 can borrow parallel expanders from
macrocell 7,from macrocells 7 and 6,or from macrocells 7,
6,and 5,Within each group of 8,the lowest-numbered
macrocell can only lend parallel expanders and the
highest-umbered macrocell can only borrow them,Figure 6
shows how parallel expanders can be borrowed from a
neighboring macrocell.
? 图示
返回
Programmable Interconnect Array(PIA)
Logic is routed between LABs via the programmable
interconnect array (PIA),This global bus is a rogrammable
path that connects any signal source to any destination on
the device,All MAX 7000 dedicated inputs,I/O pins,and
macrocell outputs feed the PIA,which makes the signals
available throughout the entire device,Only the signals
required by each LAB are actually routed from the PIA into
the LAB,Figure 7 shows how the PIA signals are routed
into the LAB,An EEPROM cell controls one input to a 2-
input AND gate,which selects a PIA signal to drive into the
LAB,更多
Programmable Interconnect Array(继前 )
?While the routing delays of channel-based
routing schemes in masked or FPGAs are
cumulative,variable,and path-dependent,
the MAX 7000 PIA has a fixed delay,The
PIA thus eliminates skew between signals
and makes timing performance easy to
predict.
?图示
返回
I/O Control Blocks
? The I/O control block allows each I/O pin to be individually
configured for input,output,or bidirectional operation,
? All I/O pins have a tri-state buffer that is individually
controlled by one of the global output enable signals or
directly connected to ground or VCC,
? Figure 8 shows the I/O control block for the MAX 7000
family,The I/O control block of EPM7032,EPM7064,and
EPM7096 devices has two global output enable signals
that are driven by two dedicated active-low output enable
pins (OE1 and OE2),
? The I/O control block of MAX 7000E and MAX 7000S
devices has six global output enable signals that are driven
by the true or complement of two output enable signals,a
subset of the I/O pins,or a subset of the I/O macrocells.
? 图示
返回
返回
返回
返回
返回
返回
MAXII
返回
Cyclone(飓风),
返回
Cyclone II:
返回
Stratix,
返回
StratixII,
返回
配置 EEPROM
返回
Cyclone专用配置器件
返回
关于 Lattice公司
?Lattice(中文名:莱迪思)是 ISP(在线可编
程)技术的发明者,ISP技术极大的促进了
PLD产品的发展,80年代和 90年代初是其黄
金时期。
?Lattice中小规模 PLD/FPGA比较有特色,种
类齐全,性能不错。
?99年 Lattice收购 Vantis(原 AMD子公
司),2001年收购 Lucent微电子的 FPGA部门,
是世界第三大可编程逻辑器件供应商。
?目前 Lattice公司在上海设有研发部门。 返回