Tải bản đầy đủ (.pdf) (32 trang)

Thiết kế mạch bằng VHDL

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.24 MB, 32 trang )

Dr. Le Dung
Hanoi University of Science and Technology
THIẾT KẾ SỐ VỚI VHDL
QUA CÁC VÍ DỤ
NỘI DUNG
Dr. Le Dung Hanoi University of Science and Technology
•  GIỚI THIỆU CHUNG VỀ THIẾT KẾ SỐ VỚI VHDL
•  TỔNG QUAN VỀ NGÔN NGỮ VHDL
•  LIBRARY DECLARATION
•  ENTITY DECLARATION
•  ARCHITECTURES
•  CONFIGURATION
Dr. Le Dung Hanoi University of Science and Technology
DANH SÁCH CÁC VÍ DỤ
•  VÍ DỤ 1 : Bộ cộng Half-Adder
•  VÍ DỤ 2: Bộ so sánh 3 bits
•  VÍ DỤ 3: FSMD - ISA bus interface design
•  VÍ DỤ 4: Bộ MUX21 (Thiết kế 1, 2 , 3)
•  VÍ DỤ 5: Testbench cho MUX21
•  VÍ DỤ 6: Mạch so sánh 2 số 8 bits
•  VÍ DỤ 7: Mảng AND 4 bits
•  VÍ DỤ 8: XOR3_Gate kiến trúc DATAFLOW
•  …….
GIỚI THIỆU CHUNG VỀ THIẾT KẾ SỐ VỚI VHDL
Dr. Le Dung Hanoi University of Science and Technology
•  Các mức thiết kế trừu tượng (Levels of Abstraction)
•  Chu trình thiết kế số trên ASIC & FPGA với VHDL
•  Công cụ phần mềm thiết kế với VHDL
Dr. Le Dung Hanoi University of Science and Technology
CÁC MỨC THIẾT KẾT TRỪU TƯỢNG
- Levels of Abstraction in IC design -


Physic
layout level
Behavioural level
Register Transfer
level (RTL)
Gate level
F
a
b
y y = f(a,b)
Design Compilation Process
Dr. Le Dung Hanoi University of Science and Technology
CHU TRÌNH THIẾT KẾ SỐ TRÊN ASIC & FPGA
Requirements
Simulate RTL Model
Gate-level
Model
Synthesize
Simulate Test Bench
ASIC or FPGA
Place & Route
Timing
Model
Simulate
Design Compilation Process
Dr. Le Dung Hanoi University of Science and Technology
CHU TRÌNH THIẾT KẾ VỚI VHDL
Mô phỏng mã
VHDL
Viết mã VHDL

cho từng khối
(Block)
Viết mã VHDL cho
bàn kiểm tra
(Testbench)
Phân tích hệ thống và
phân chia khối (Block)
Tổng hợp logic
(netlists & gate structure)
Mô phỏng ở mức cổng (gate level)
Tổng hợp trên vi mạch
(floor planning, place, route, timing, implement)
Behavioural level
RT level
Gate level
Physic
layout level
chiếm 70%
thời gian
thiết kế
Design Compilation Process
Dr. Le Dung Hanoi University of Science and Technology
CÔNG CỤ PHẦN MỀM THIẾT KẾ VỚI VHDL
•  Aldec Active HDL
•  Mentor Graphics ModelSim
•  Synplicity Synplify Pro
•  ModelSim Xilinx
•  Xilinx XST
•  Xilinx ISE
•  Xilinx WebPACK

•  Altera Quartus II
•  ModelSim Altera
•  Altera Quartus II Web Edition
•  GMU ATHENa
•  DirectVHDL Green Mountain
EDA TOOLS
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ: PHẦN MỀM QUARTUS II 9.0
Dr. Le Dung Hanoi University of Science and Technology
CHU TRÌNH THIẾT KẾ TRÊN QUARTUS II 9.0
Dr. Le Dung Hanoi University of Science and Technology
GIAO DIỆN QUARTUS II 9.0
TỔNG QUAN VỀ NGÔN NGỮ VHDL
Dr. Le Dung Hanoi University of Science and Technology
•  KEYWORDs, STATEMENTs, IDENTIFIERs
•  ENTITY và một số khái niệm cơ bản
•  CẤU TRÚC CƠ BẢN CỦA MỘT ENTITY
+ Library declarations
+ Entity
+ Architecture
+ Configuration
•  TESTBENCH
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ 1: BỘ CỘNG HALF-ADDER
Schematic
block design
Reserved
words
(keywords)
Statement

Identifiers
VDHL Entity design
Statement
Statement
ending
Comment
Dr. Le Dung Hanoi University of Science and Technology
CÁC TỪ KHÓA CỦA VHDL
Dr. Le Dung Hanoi University of Science and Technology
CÁC QUI ƯỚC CƠ BẢN CỦA VHDL
•  Không phân biệt chữ hoa chữ thường (case insensitive)
•  Chú thích (comment) được đặt sau 2 ký tự gạch ngang “ ” và tính cho đến
cuối dòng. Có thể bắt đầu từ bất kỳ vị trí nào.
•  Một phát biểu (statement) có thể được triển khai trên nhiều dòng và luôn kết
thúc bằng dấu chấm phẩy “;”.
•  Dấu phẩy “,” dùng để ngăn cách giữa các phần tử trong 1 danh sách.
•  Gán tín hiệu (signal assignment) bằng ký hiệu ngoặc nhọn và dấu bằng “<=“.
•  Liên kết cổng (port association) với tín hiệu thì dùng “=>”.
•  Định danh có thể gồm các chữ cái (A-Z,a-z), số (0-9) và dấu gạch chân (_),
phải bắt đầu bằng chữ cái. Định danh là duy nhất trong Entity và Architecture.
Dr. Le Dung Hanoi University of Science and Technology
MỘT SỐ MỞ RỘNG TRONG VHDL93
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ 2: BỘ SO SÁNH 3 BIT
Top-level
Entity
Top-level
Entity
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ 3: FSMD - ISA bus interface


ISA bus interface design (ISA.vhd)

8-bit adder
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity adder is
. . . . . . . . . . . . . . . .
end adder;
architecture behv of adder is
. . . . . . . . . . . . . . . .
end behv;
Comparator
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity comparator is
. . . . . . . . . . . . . . . . .
end comparator;
architecture behv of comparator is
. . . . . . . . . . . . . . . . .
end behv;
Data Register
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity data_reg is
. . . . . . . . . . . . . . . . .
end data_reg;
architecture behv of data_reg is
. . . . . . . . . . . . . . . . .
end behv;

Data Path of ISA bus interface

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity datapath is
. . . . . . . . . . . . . . .
end datapath;
architecture struct of datapath is
component data_reg is
. . . . . . . . . .
end component;
component comparator is
. . . . . . . . . . .
end component;
component adder is
. . . . . . . . . . . .
end component;
end struct;

FSM controller for ISA bus interfacing


library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity controller is
. . . . . . . . . . . . . . .
end controller;
architecture fsm of controller is
. . . . . . . . . . . . . . .
end struct;

ISA bus interface ( FSM + Datapath )
VHDL structural modeling

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use work.all;
entity ISA is
. . . . . . . . . . . . .
end ISA;
architecture struct of ISA is
component controller is
. . . . . . . . . .
end component;
component datapath is
. . . . . . . . . . . .
end component;
begin
end struct;

U1: datapath port map ( . . . . . . . );
U0: controller port map (. . . . . . );
/>labs/tutorial/ISA.vhd
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ 3: FSMD - ISA bus interface
Dr. Le Dung Hanoi University of Science and Technology
ENTITY VÀ MỘT SỐ KHÁI NIỆM CƠ BẢN
DESIGN (VHDL)
TOP-LEVEL ENTITY
COMPONENT C1
COMPONENT C2
COMPONENT C3
ENTITY BL1
ENTITY BL2
COMPONENT C2
ENTITY BL3
COMPONENT C4
COMPONENT C4
LIBRARY.PACKAGE
. . . . . . . . .
Dr. Le Dung Hanoi University of Science and Technology
CẤU TRÚC ENTITY ĐƠN GIẢN
Entity
declaration
Architecture
of the entity
design entity: HALFADDER
Lưu trong tệp: halfadder.vhd
(thường cùng tên với Entity và có đuôi là .vhd)
VÍ DỤ 1: Chỉ khai báo một Entity với một Architecture

Dr. Le Dung Hanoi University of Science and Technology
ENTITY & ARCHITECTURES
Design Entity - most basic
building block of a design.
One entity can have 3 styles of
architecture
entity declaration
architecture 1
architecture 2
architecture 3
design entity
- File extension for a VHDL file is .vhd
- Name of the file should be the same
as the entity name.
Dataflow Behavioral
Structural
Dr. Le Dung Hanoi University of Science and Technology
CẤU TRÚC CƠ BẢN CỦA ENTITY
library …;
use … ;
entity ETT is
port ( ……….);
end entity ETT ;
architecture STYLE of ETT is
begin

end architecture STYLE;
configuration CONF of ETT is
for STYLE


end for;
end configuration CONF;
ENTITY
Dr. Le Dung Hanoi University of Science and Technology
MÃ VHDL CƠ BẢN CỦA ENTITY
Configuration
Dr. Le Dung Hanoi University of Science and Technology
VÍ DỤ 4: BỘ MUX21
Thiết kế 1 : 1 Entity + 1 Architecture
A
B
S
Y
Schematic
RTL Viewer
Technology mapping viewer

Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×