Thiết kế dùng vi mạch logic khả trình sử dụng ngôn ngữ lập trình VHDL. Tài liệu này gồm các phần: 1. Giới thiệu chung về công nghệ IC khả trình 2. Thiết kế dùng IC khả trình của Xilinx 3. Thiết kế số 4. Ngôn ngữ mô tả phần cứng VHDL
Trang 1logic khả trình
Giảng viên: TS Phạm Ngọc Nam
Trang 2• Bộ môn kỹ thuật điện tử tin học, ĐHBK Hà nội
Office: C9-401
Email: pnnam-fet@mail.hut.edu.vn
• Research:
FPGA, PSoC, embedded systems
Trí tuệ nhân tạo
• Education:
K37 điện tử-ĐHBK Hà nội (1997)
Master về trí tuệ nhân tạo 1999, Đại học K.U Leuven, vương quốc Bỉ
Đề tài: Nhận dạng chữ viết tay
Tiến sỹ kỹ thuật chuyên ngành điện tử-tin học, 9/ 2004, Đại học K.U Leuven, Vương Quốc Bỉ
Trang 31 Giới thiệu chung về công nghệ IC khả trình
2 Thiết kế dùng IC khả trình của Xilinx
3 Thiết kế số
4 Ngôn ngữ mô tả phần cứng VHDL
Trang 41 Giới thiệu chung về công nghệ IC khả trình
• Các bước thiết kế VLSI
Trang 51 Giới thiệu chung về công nghệ IC khả trình
• Các bước thiết kế VLSI
Trang 6• Ví dụ: Thiết kế bộ chạy đĩa DVD
Trang 8System Specification – Xác định kích thước, tốc độ,
công suất và các chức năng của hệ thống
Architectural Design – Xác định kiến trúc của hệ thống:
ví dụ: RISC/CISC, số lượng ALU, kích thước bộ nhớ cache Việc xác định kiến trúc sẽ giúp cho việc ước
lượng tốc độ xử lý của hệ thống, kích thước chip, công suất tiêu thụ …
Trang 9Functional Design – Xác định các khối chức năng chính
và kết nối giữa các khối Chưa cần xác định chi tiết cách thức thực hiện các khối này
Trang 10Logic Design – Thiết kế logic, ví dụ: thiết kế mạch
logic tổ hợp, logic dãy, ALU, khối điều khiển… Kết
quả của bước thiết kế này là bản mô tả RTL (Register
Transfer Level) RTL được biểu diễn bằng ngôn ngữ mô
tả phần cứng HDL (Hardware Description Language),
e.g., VHDL and Verilog.
X = (AB+CD)(E+F) Y= (A(B+C) + Z + D)
Trang 11Circuit Design – Thiết kế mạch bao gồm các cổng logic, transistors và các kết nối Kết quả thu được từ bước
thiết kế này là một netlist.
Trang 12• Net list:
net1: top.in1 i1.in
net2: i1.out xxx.B
topin1: top.n1 xxx.xin1
topin2: top.n2 xxx.xin2
botin1: top.n3 xxx.xin3
net3: xxx.out i2.in
outnet: i2.out top.out
Trang 13Component hierarchy
Trang 14Physical Design – Chuyển từ netlist sang dạng biểu diễn hình học Cách biểu diễn hình học này được gọi là
layout.
Trang 15Fabrication – Bao gồm các quá trình như quang khắc,
đánh bóng, khuyếch tán …để chế tạo ra chip (IC).
Packaging – Sắp xếp các IC trên một board mạch in
PCB (Printed Circuit Board) hoặc trên một module đa chíp MCM (Multi-Chip Module)
Trang 16System Specification
Architectural Specification
Architectural
Design
Functional Design
Logic Design
Physical Design
Fabrication
Packaging
Circuit Design
or Logic Synthesis
Trang 171 Giới thiệu chung về công nghệ IC khả trình
Trang 18Circuit Partitioning
Floorplanning & Placement
Routing
Layout Compaction
Trang 19Circuit Partitioning – Chia một mạch lớn thành các mạch nhỏ hơn
Trang 20Floorplanning – Thiết lập kế hoạch bố trí các module trên layout một cách hợp lý khi mà hình dạng, kích thước, ví trí chân của các module chưa được cố định
Deadspace
Trang 21Placement – Bố trí cố định các module (module có thể
là cổng logic, các khối chuẩn standard cells…) khi đã biết các thông số chi tiết của các module sao cho trễ tín hiệu, diện tích và số lượng kết nối nhỏ nhất
v
Feedthrough Standard cell type 1 Standard cell type 2
Trang 22Routing – Kết nối giữa các module trên cơ sở bảo đảm
về trễ, khoảng cách giữa các đường dây.
v
Feedthrough Type 1 standard cel1
Trang 23Compaction – Bước này tối thiểu hoá diện tích của
vùng layout để giảm kích thước chip
Verification – Kiểm tra layout bao gồm kiểm tra luật
thiết kế DRC (Design Rule Checking), tạo ngược lại
mạch điện từ layout (circuit extraction) để so sánh với
netlist ban đầu, kiểm tra hoạt động (performance
verification ) bằng cách lấy thông tin hình học để tính
toán các giá trị điện trở, điện dung, trễ…
Trang 241 Giới thiệu chung về công nghệ IC khả trình
Trang 25• Full-Custom ASICs (Application specific IC)
Các khối logic (logic cells) và các lớp mặt nạ không được thiết kế sẵn mà
do người thiết kế thiết kế
• Semicustom ASICs
Các khối logic ( logic cells) được thiết kế sẵn (được định nghĩa trong thư viện cell) và các lớp mặt nạ được thiết kế bởi người thiết kế
2 loại:
Standard-cell based and Gate-array-based ASICs
• Các linh kiện logic khả trình (Programmable logic devices)
Tất cả các khối logic được thiết kế sẵn và không cần phải thiết kế lớp
mặt nạ nào
Types: PLD (Programmable Logic Device) and
FPGA (Field Programmable Gate Array)
Trang 26Full-Custom ASIC
• Full-Custom ASICs
Đối với mỗi một chip ASIC, người thiết kế phải thiết kế toàn
bộ các khối logic, mạch điện, layout
Full-custom ICs là loại đắt nhất để chế tạo và thiết kế
Thời gian chế tạo 1 IC (không kể thời gian thiết kế) là 8 tuần
Dùng khi:
Không có các khối logic có sẵn trong thư viện
Các khối logic hiện có không đủ nhanh
Các khối logic hiện có có kích thước lớn
Các khối logic hiện có tiêu thụ công suất lớn
Chíp ASIC cần thiết kế quá đặc biệt dẫn tới nhiều mạch phải được thiết kế một cách tuỳ biến
Trang 27Full-Custom ASIC
Trang 28Cell-based ASIC
• Cell-Based ASIC (CBIC) sử dụng các khối logic được thiết kế sẵn (cổng AND, OR gates, multiplexers, flip- flops, )
Vùng khối logic chuẩn bao gồm các hàng khối logic chuẩn
Vùng khối logic chuẩn có thể kết hợp với các khối khác lớn hơn cũng được thiết kế sẵn như vi điều khiển, vi xử lý, các khối này được gọi là megacell
Trang 29Cell-based ASIC
• Đặc điểm:
Các khối tuỳ biến có thể được nhúng vào chip ASIC Người thiết kế ASIC chỉ phải định nghĩa vị trí đặt các khối logic
chuẩn và kết nối giữa các khối
Các khối chuẩn có thể được đặt bất kỳ chỗ nào trên phiến
silicon nên tất cả các lớp mặt nạ của CBIC có thể được tự do thiết kế
Thời gian chế tạo là 8 tuần
Trang 30Gate-Array-Based ASICs
• Bao g ồm một mảng 2 chiều các cổng logic giống hệt nhau (ví dụ các cổng NAND) được xác định sẵn trên phiến silic
• Các cổng logic được nối với nhau bới các lớp kết nối Việc kết nối giữa các cổng được thực hiện bới mặt nạ
do người thiết kế tạo ra.
• Thời gian chế tạo từ vài ngày đến 2 tuần
• Giá thành rẻ hơn các loại ASIC khác
Trang 311 Giới thiệu chung về công nghệ IC khả trình
Trang 32• Realisation as AND-OR:
F1=xy+xy’z+x’yz
• Realisation as OR-AND:
F1=((x’+y’) (x’+y+z’) (x+y’+z’))’
x y z
F1
x y z
F1
Trang 33Programmable logic array
• PLA
And plane
And plane
Or plane
Input
Output Programmable
Trang 34Programmable logic array
• PLA
Trang 35Programmable Array Logic
• PAL
And plane
And plane
Or plane
Input
Output Programmable
Fixed
Trang 36Programmable Array Logic
Trang 37Complex Programmable Logic Devices
• CPLD
Trang 38Complex Programmable Logic Devices
• Các công nghệ lập trình
PROM: Lập trình 1 lần
EPROM, flash, EEPROM: lập trình nhiều lần
Non-volatile
Trang 394-1 Mux
2 LSB
After manufacturing
Trang 40After programming
Trang 41Field-programmable Gate Array
• FPGA: XC40xx
CLB CLB
Routing via switching matrices
Trang 42Field-programmable Gate Array
• C ấu tạo của một CLB ( Configurable Logic Block)
16x1 LUT:
Bool-function
of 4 variables
16x1 LUT:
Bool-function
of 4 variables
FF G
G GQ
FF F
F FQ
Trang 43Field-programmable Gate Array
• FPGA: Switching Matrix SM
Pass TOR
Trang 44Field-programmable Gate Array
• C ác loại kết nối:
Trang 45Field-programmable Gate Array
Trang 46Field-programmable Gate Array
• Hãng cung cấp FPGA hàng đầu thế giới
Công ty Xilinx: http://www.xilinx.com/
Công ty Altera: http://www.altera.com/
Công ty Lattice Semiconductor: http://www.latticesemi.com/
Công ty Actel: http://www.actel.com/
Công ty Crypress: http://www.cypress.com/
Công ty Atmel: http://www.atmel.com/
Công ty QuickLogic: http://www.quicklogic.com/
Trang 47Ưu điểm
Trang 48Ưu điểm
• FPGA vs Custom ASIC
FPGAs are more flexible
FPGAs are more cost effective for small quantities
ASICs have higher densities
• FPGA vs Parallel Computer
FPGAs are more cost effective
FPGAs are smaller
Parallel Computers are easier to program
Trang 501 Giới thiệu chung về công nghệ IC khả trình
Trang 51• Aerospace & Defense
• Automotive
• Consumer
• Digital Video Technologies
• Industrial/Scientific & Medical
• Test & Measurement
• Wired Communications
• Wireless Communications
Trang 61trình của Xilinx
2.1 Các họ PLD của Xilinx
2.2 Cấu trúc PLD của Xilinx
2.3 Các bước thiết kế với PLD của Xilinx
Trang 64Power per MHz Price
Spartan
Spartan-3
'91 '92 '93 '94 '95 '96 '97 '98 '99 '00 '01 '02 '03 '04
Trang 65 200.000 logic cells, DSP, PowerPC
Thay thế ASIC, ASSP
Trang 70• All Xilinx FPGAs contain the same basic resources
Slices (grouped into CLBs)
Contain combinatorial logic and register resources
Trang 71Slices and CLBs
• Each Virtex -II CLB
contains four slices
Local routing provides
feedback between slices in the
same CLB, and it provides
routing to neighboring CLBs
A switch matrix provides
access to general routing
resources
CIN
Switch Matrix
BUFT BUF T
COUT COUT
Slice S0
Slice S1
Local Routing
Slice S2 Slice S3
CIN SHIFT
Trang 72D
Q CE PRE
CLR
Simplified Slice Structure
• Each slice has four outputs
Two registered outputs,
two
non-registered outputs
Two BUFTs associated
with each CLB, accessible
by all 16 CLB outputs
• Carry logic runs vertically,
up only
Two independent
Trang 73Detailed Slice Structure
MUXF7, MUXF8
(only the F5 and
F6 MUX are shown
in this diagram)
Carry Logic
Sequential Elements
Trang 74Combinatorial LogicA
B C D
Z
Look-Up Tables
• Combinatorial logic is stored in Look-Up
Tables (LUTs)
Also called Function Generators (FGs)
Capacity is limited by the number of inputs,
not by the complexity
• Delay through the LUT is constant
1 1 0 0 0
1 1 0 1 0
Trang 75Connecting Look-Up Tables
MUXF6 combines slices S2 and S3
MUXF7 combines the two MUXF6 outputs
MUXF6 combines slices S0 and S1 MUXF5 combines LUTs in each slice
Trang 76D CE PRE CLR
Q FDCPE
D CE S R
Q FDRSE
D CE PRE CLR
Q LDCPE G
_1
Flexible Sequential Elements
• Either flip-flops or latches
• Two in each slice; eight in each CLB
• Inputs come from LUTs or from an
independent CLB input
• Separate set and reset controls
Can be synchronous or
asynchronous
• All controls are shared within a slice
Control signals can be inverted
locally within a slice
Trang 77Shift Register LUT (SRL16CE)
• Dynamically addressable serial shift
registers
Maximum delay of 16 clock
cycles per LUT (128 per CLB)
Cascadable to other LUTs or
CLBs for longer shift registers
Dedicated connection from Q15 to D input of the next SRL16CE
Shift register length can
be changed asynchronously
by toggling address A
LUT
D Q CE
D Q CE
D Q CE
D Q CE
LUT D
CE CLK
A[3:0]
Q
Q15 (cascade out)
Trang 78• Separate clocks and
clock enables for I and O
• Set and reset signals
are shared
Reg Reg
Input
ICK1
ICK2
IOB
Trang 79SelectIO Standard
• Allows direct connections to external signals of varied voltages and thresholds
Optimizes the speed/noise tradeoff
Saves having to place interface components onto your board
• Differential signaling standards
Trang 80Other Virtex-II Features
• Distributed RAM and block RAM
Distributed RAM uses the CLB resources (1 LUT = 16 RAM bits)
Block RAM is a dedicated resources on the device (18-kb
blocks)
• Dedicated 18 x 18 multipliers next to block RAMs
• Clock management resources
Sixteen dedicated global clock multiplexers
Digital Clock Managers (DCMs)
Trang 81Distributed SelectRAM Resources
• Uses a LUT in a slice as memory
• Emulated dual-port RAM
One read/write port
One read-only port
RAM16X1S
O
D WE WCLK A0 A1 A2 A3
LUT
RAM32X1S
O
D WE WCLK A0 A1 A2 A3 A4
RAM16X1D
SPO
D WE WCLK A0 A1 A2 A3 DPRA0 DPO DPRA1 DPRA2 DPRA3
Slice
LUT LUT
Trang 82Block SelectRAM Resources
• Up to 3.5 Mb of RAM in 18-kb
blocks
Synchronous read and write
• True dual-port memory
Each port has synchronous read
and write capability
Different clocks for each port
• Supports initial values
• Synchronous reset on output
latches
• Supports parity bits
DIA DIPA ADDRA WEA ENA SSRA CLKA
DIB DIPB WEB ADDRB
ENB SSRB
DOA
CLKB
DOPA
DOPB DOB 18-kb block SelectRAM memory
Trang 83Dedicated Multiplier Blocks
• 18-bit twos complement signed operation
• Optimized to implement Multiply and Accumulate functions
• Multipliers are physically located next to block SelectRAM™ memory
18 x 18 Multiplier
18 x 18
Data_A (18 bits)
Data_B (18 bits)
4 x 4 signed
8 x 8 signed
12 x 12 signed
18 x 18 signed
Trang 84Global Clock Routing Resources
• Sixteen dedicated global clock multiplexers
Eight on the top-center of the die, eight on the bottom-center
Driven by a clock input pad, a DCM, or local routing
• Global clock multiplexers provide the following:
Traditional clock buffer (BUFG) function
Global clock enable capability (BUFGCE)
Glitch-free switching between clock signals (BUFGMUX)
• Up to eight clock nets can be used in each clock region
of the device
Each device contains four or more clock regions
Trang 85Digital Clock Manager (DCM)
• Up to twelve DCMs per device
Located on the top and bottom edges of the die
Driven by clock input pads
• DCMs provide the following:
Delay-Locked Loop (DLL)
Digital Frequency Synthesizer (DFS)
Digital Phase Shifter (DPS)
• Up to four outputs of each DCM can drive onto global clock buffers
All DCM outputs can drive general routing
Trang 86CPLD/FPGA design flow
• Design Flow
Trang 87Design Entry
• Using schematic editor:
Works well with small designs: 5k to 10 k gates
Schematic can be compiled to HDL
• Using HDL (Hardware Description Language)
VHDL, Verilog
Others: Abel
Works with large design: > 100 k gates
• Using State Editor:
Mostly for controller
Trang 88Design Entry
• Design tools:
Webpack ISE (miễn phí)
Thiết kế cho CPLD, FPGA
Có công cụ thiết kế dùng schematic, ngôn ngữ mô tả phần cứng, công cụ tổng hợp, mô phỏng và vật lý
ISE Foundation™ (không miễn phí)
chức năng tương tự như Webpack
EDK and Platform studio
Dùng để thiết kế hệ thống nhúng với FPGA
Trang 89Language based refinement:
VHDL editor
Trang 91Design Synthesis
• Synthesis process:
Check code syntax
Analyze the hierarchy of the design
Compile RTL to gate level
Create netlist of the design
Take into account the architecture of the target FPGA
• Synthesis tools:
XST (Xilinx synthesis technology)
Generate a NGC file
LeonardoSpectrum from Mentor Graphics, Inc
Synplify and Synplify Pro from Synplicity Inc
Trang 92Design Implementation
• Translate:
Translate the design netlist and constraints into (Xilinx) primitives
Input: NGC file, Output: NGD file (Native Generic Database)
• Map:
Map the primitives to the actual physic circuit of the device
Input: NGD file, Output: NCD file ( Native Circuit Description)
• Place and Route (PAR):
Place the circuits on the CLB and find a good route to connect them
Input: NCD file, Output: NCD file
Trang 93Xilinx device programming
• Create a bitstream to program the device
• Input: NCD file, Output: bit file
• Programming tools:
Download software + download cable
Trang 94Design verification
• Mô phỏng chức năng với behavioral simulation
• Mô phỏng về thời gian với timing simulation
• Kiểm tra phần cứng
• Verification tools:
ModelSim
ChipScope Pro
Trang 951 Giới thiệu chung về công nghệ IC khả trình
2 Thiết kế dùng IC khả trình của Xilinx
Trang 961 Giới thiệu chung về công nghệ IC khả trình
2 Thiết kế dùng IC khả trình của Xilinx
Trang 97• Thiết kế dùng các cổng logic rời rạc (Gate level):
AND, OR, NAND, NOT…, Flip Flops
Dùng cho các bài toán thiết kế đơn giản như thiết kế bộ tổng, tổng của tích, bộ đếm…
Kết quả: module
• Thiết kế dùng các thanh ghi và các module số (RTL:
register transfer level)
Thanh ghi dịch, decoder, ALU, Mux, bộ cộng, nhân, bộ
đếm…
Dùng cho các bài toán thiết kế từ trung bình đến phức tạp
như thiết kế vi xử lý, thiết kế các bộ mã hoá và giải mã âm thanh, hình ảnh …
Kết quả: vi mạch (IC)