设计中心 - uestc...设计中心 creating a behavioral design • this section will show the...

85
设计中心 VLSI设计的FPGA验证 实验教案

Upload: others

Post on 15-Mar-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

VLSI设计的FPGA验证

实验教案

Page 2: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

用VHDL语言开发FPGA的完整流程1.文本编辑:用任何文本编辑器都可以进行,也可以用专用的

HDL编辑环境。通常VHDL文件保存为.vhd文件

2.功能仿真:将文件调入HDL仿真软件进行功能仿真,检查逻辑功能是否正确(也叫前仿真,对简单的设计可以跳过这一步,只在布线完成以后,进行时序仿真)

3.逻辑综合:将源文件调入逻辑综合软件进行综合,即把语言综合成最简的布尔表达式。逻辑综合软件会生成.edf(edif)的EDA工业标准文件。

4.布局布线:将.edf文件调入PLD厂家提供的软件中进行布线,即把设计好的逻辑安放到PLD/FPGA内。

5.时序仿真:需要利用在布局布线中获得的精确参数,用仿真软件验证电路的时序。(也叫后仿真)

6.编程下载:确认仿真无误后,将文件下载到芯片中

Page 3: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Active-HDL

Creating a Behavioral Design

Functional Simulation

Page 4: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Active-HDL4.2

FPGA Express

Foundation

Page 5: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Creating a Behavioral Design

• This section will show the following operations:– How to use New Design Wizard to create

new design– How to use New Source File Wizard to

create source files– How to create your own VHDL code– Basic operations in Design Browser– Basic operations with Language Assistant

Page 6: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

使用Active-HDL4.2编写代码、仿真验证

From the desktop shortcut or the windows start menu, start Active-HDL4.2

点击下面的按钮,即刻上阵……

Page 7: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Select VHDL Design Entry option

Page 8: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Select Create new design option

Page 9: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Select Create an empty design option

Page 10: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 11: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Because we are not using synthesis and implementation tools in this lab, you can leave Synthesis tool and Implementation tool settings unchanged

• Set Block Diagram Configuration to ”HDL” and Default HDL Language to ”VHDL”

• Click on the Next button to advance to the next page

Page 12: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 13: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• In the Type the design name field, enter Your_Design_name, example: study

• Leave default values in the Select the location of the design folder box and the The name of the default working library of the design box

• Click on the Next button to advance to the next page

• Click Finish in the last window of the Wizard

Page 14: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 15: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 16: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 17: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 18: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 19: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 20: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• To complete the HEX2LED architecture use the Language Assistant’s template

• Invoke the Language Assistant window (Tools | Language Assistant menu option)

• Select the Synthesis templates / HEX2LEDConverter item and drag & drop it into the VHDL editor. You can also use the Use optionfrom the shortcut menu. This code goes in the architecture between begin and end.

Note: The code is inserted where the cursor is located in your file. Check this before you invoke the use command.

Page 21: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 22: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 23: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 24: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• The signs by the file name in the Design Browser show the status of the file:? - not compiled, or modified after the last compilation

- succesfully compiled! - compiled with warnings

- compiled with errors

Page 25: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Functional Simulation

A> 手动加测试激励进行仿真

B> 编写宏文件(*.do)进行仿真

C> 编写测试平台进行仿真

Page 26: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

A> 手动加测试激励进行仿真

Page 27: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Set the AND2entity-architecture pair as top-level unit for simulation:

— click the "+" sign next to it and right click on the E/A pair to bring up the menu— select Set as Top Leveloption

Page 28: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

New Waveform

Right Click

Page 29: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 30: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心 Run

Page 31: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

B> 编写宏文件(*.do)进行仿真

Page 32: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• The force command used from the console or in macro files lets you create any waveform using the following syntax:

where more than two pairs of signal value and time can be specified and -r switch is skipped for aperiodic waveforms

• Select File | New | Macro from the menu• Type the following lines into the document:

• Note: the spacing must be exact when typing in the above! The Macro command parameters are case sensitive!

force CLK 0 0, 1 10 ns -r 20 nsforce RESET 1 0, 0 25 nsforce ENABLE 0 0, 1 50 ns

force value1 time1, value2 time2 -r period

Page 33: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 34: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Adding the do file to the project

• Select File | Save asfrom the menu, type Macro_and2 in the File name box

• select the Automatically add new files to designcheckbox.

Page 35: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Right click Macro_and2.do icon in the Design Browser and select Execute from the shortcut menu.

• Then Run 100ns

Page 36: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

C> 编写测试平台进行仿真

Page 37: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Test Bench Concept• The figure below illustrates the concept of a test bench

• The process implemented in the architecture body of a test bench forces desired stimulus on the inputs of the tested design unit (Unit Under Test = UUT).

Page 38: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• Generate Test Bench

• Test Bench Wizard

……

(P.124~P.131)

Page 39: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Set as Top-level

Simulation……

Page 40: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

FPGA Express

Page 41: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Active-HDL4.2

FPGA Express

Foundation

Page 42: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 43: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 44: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 45: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 46: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 47: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 48: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 49: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 50: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 51: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

implementation

Page 52: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Active-HDL4.2

FPGA Express

Foundation

Page 53: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Design Manager

Page 54: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Flow engine

Timing analyzer

Floorplanner

PROM file formatter

JTAG Programmer

Hardware Debugger

FPGA Editor

*.bit

*.ucf

*.mcs

Page 55: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

.EDF .NGD .NCD .NCD .BIT

.XNF

网表合并、编译 逻辑配置映射到目标元件

为FPGA布局布线 BIT流目标文件配置

Page 56: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

• NCD (netlist circuit description)• NGD (native generic database)• BIT (a binary file,configuration bitstream)

Page 57: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Floorplanner底层编辑器

Page 58: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

PROM file formatter

可编程ROM文件格式化生成器

生成 *.mcs文件

MCS (Intel’s MCS-86 format)

Page 59: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 60: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 61: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

基于查找表技术(Look-Up table)技术

• 包含SRAM工艺的FPGA(如Altera的所有FLEX,ACEX,APEX系列,Xilinx的Sparten,Vertex), 10,000门以上的大规模PLD/FPGA。由于SRAM工艺的特点,掉

电后数据会消失。

• PROM,实时配置

Page 62: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 63: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 64: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

实验开发板芯片选型

• FPGA:

Xilinx SpartanXL S10XL_PC84 -4• PROM:

Xilinx XC18V02_PC44

双列直插式封装(DIP)有引线载体(LCC)四方型扁平封装(QFP)针栅阵列(PGA) 、球栅阵列(BGA)

芯片尺寸封装(CSP)

Page 65: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

FPGA验证实验

数字功放的FPGA下载及试听验证

计数器的FPGA验证

计数器改进设计及其FPGA验证

Page 66: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

实验一、数字功放FPGA下载及试听验证

• FPGA: ﹡.bit• PROM:﹡.mcs

Page 67: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 68: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

实验二、计数器的FPGA验证

Page 69: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

十进制加1计数器

LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY count10en ISPORT(i, clr, en : IN STD_LOGIC;

qa, qb, qc, qd : OUT STD_LOGIC);END count10en;

clr qa

en qb

i qc

qd

U1

count10en

Page 70: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心ARCHITECTURE rtl OF count10en IS

SIGNAL count_4 : STD_LOGIC_VECTOR(3 downto 0);BEGIN

process(i, clr)begin

if (clr = '1') thencount_4 <= "0000";

elsif (i'event and i = '1') thenif (en = '1') then

if (count_4="1001") then count_4 <= "0000";else count_4 <= count_4 + 1;

end if; end if; end if;end process;

qa<=count_4(0); qb<=count_4(1); qc<=count_4(2); qd<=count_4(3);

END rtl;

Page 71: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 72: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

计数器输出to

LED(共阳)

case M iswhen "0000" => LED <= "1000000"; --0when "0001" => LED <= "1111001"; --1when "0010" => LED <= "0100100"; --2when "0011" => LED <= "0110000"; --3when "0100" => LED <= "0011001"; --4when "0101" => LED <= "0010010"; --5when "0110" => LED <= "0000010"; --6when "0111" => LED <= "1011000"; --7when "1000" => LED <= "0000000"; --8when "1001" => LED <= "0010000"; --9when others => LED <= "0000110"; --E

end case;

Page 73: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

按键弹跳现象

• 手动按键的抖动不可避免

• 按键信号稳定前后往往出现不该有的噪声

• 弹跳信号现象:

• 如果这样的信号直接输入计数器,结果可能发生计数超过1次以上的误动作

Page 74: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

实验三、计数器改进设计及其FPGA验证

Page 75: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

微分电路

• 将原本可能超过一个时钟周期的信号A,微分成恰好只有一个周期。微分信号三种形式:

上升沿微分、下降沿微分、升降沿微分

D Q

CP

A Q1

CPD Q

CP

Q2UP_OP

DN_OP

DL_OP

Page 76: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 77: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 78: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

防弹跳电路

• 相邻两次采样数据相同,则认为信号稳定有效,输出该值;否则为非稳定信号,输出保持原值不变。

采样信号CP

Page 79: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 80: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 81: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

防弹跳电路+微分电路

Page 82: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

Page 83: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

采样频率的提出

采样信号CP

Page 84: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

采样频率的选定

• 人的按键速度至多是10次,即一次按键时间100ms,有效按下时间可估算50ms。

• 若取采样信号CP周期T=8ms,则一次按键可采样6次(8ms×6次≈50ms)。

• 对于不稳定噪声,一般在4ms以下,则至多被采样到1次。

• 即采样信号CP频率可选择f =1/T=125Hz

Page 85: 设计中心 - UESTC...设计中心 Creating a Behavioral Design • This section will show the following operations: – How to use New Design Wizard to create new design – How

设计中心

THE END