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

Thiết kế mạch số dùng HDL-Chương 7 Thiết kế và tổng hợp bộ điều khiển dòng dữ liệu potx

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 (750.72 KB, 28 trang )

2009
dce
Thiết kế mạch số dùng HDL
Chương 7 Thiết kế và tổng hợp
bộ điều khiển dòng dữ liệu
Computer Engineering 2009
©2009, Pham Quoc Cuong
2
Advanced Digital Design with the Verilog HDL –
chapter 7
Nội dung chính
• Máy tuần tự phân hoạch
• Các ví dụ thiết kế
Computer Engineering 2009
©2009, Pham Quoc Cuong
3
Advanced Digital Design with the Verilog HDL –
chapter 7
Phân loại hệ thống số
• Control-dominated
 Là hệ thống đáp ứng đáp lại tác động bên
ngoài
• Data-dominated
 Yêu cầu tính toán và truyền nhận dữ liệu với
hiệu suất cao
 Hệ thống thông tin liên lạc, xử lý tín hiệu,…
 Máy tuần được phân loại và phân hoạch
thành bộ dòng dữ liệu và bộ điều khiển
Computer Engineering 2009
©2009, Pham Quoc Cuong
4


Advanced Digital Design with the Verilog HDL –
chapter 7
Bộ dòng dữ liệu – datapaths unit
• Bộ số học luận lý (arithmetic logic unit -
ALU)
• Bộ cộng
• Bộ nhân
• Bộ xử lý tín hiệu số
• Quản lý tài nguyên (registers)
• …
Computer Engineering 2009
©2009, Pham Quoc Cuong
5
Advanced Digital Design with the Verilog HDL –
chapter 7
Mô hình điều khiển cho dòng dữ liệu
Computer Engineering 2009
©2009, Pham Quoc Cuong
6
Advanced Digital Design with the Verilog HDL –
chapter 7
Các bước thiết kế
• Application-driven
• Lựa chọn cấu trúc hỗ
trợ cho tập lệnh trong
ứng dụng
• Định nghĩa các trạng
thái điều khiển hỗ trợ
tập lệnh
• Xây dựng FSM sinh

ra tín hiệu điều khiển
Computer Engineering 2009
©2009, Pham Quoc Cuong
7
Advanced Digital Design with the Verilog HDL –
chapter 7
Ví dụ thiết kế bộ đếm nhị phân
• Máy trạng thái không tường minh
 count <= count + 1
• Phân hoạch thành bộ điều khiển và bộ
dòng dữ liệu (Binary_Counter_Arch)
• Máy trạng thái tường minh
(Binary_Counter_STG)
• ASM
• RTL
Computer Engineering 2009
©2009, Pham Quoc Cuong
8
Advanced Digital Design with the Verilog HDL –
chapter 7
Binary_Counter_Arch
Computer Engineering 2009
©2009, Pham Quoc Cuong
9
Advanced Digital Design with the Verilog HDL –
chapter 7
Binary_Counter_STG
Computer Engineering 2009
©2009, Pham Quoc Cuong
10

Advanced Digital Design with the Verilog HDL –
chapter 7
ASM
ASM
ASMD cho bộ dòng dữ liệu được
điều khiển bởi máy trạng thái
Computer Engineering 2009
©2009, Pham Quoc Cuong
11
Advanced Digital Design with the Verilog HDL –
chapter 7
Binary_Counter_Part_RTL
Computer Engineering 2009
©2009, Pham Quoc Cuong
12
Advanced Digital Design with the Verilog HDL –
chapter 7
Tổng hợp mạch Binary_Counter_Part_RTL
Tổng hợp bằng Actel Libero IDE 8.2
Computer Engineering 2009
©2009, Pham Quoc Cuong
13
Advanced Digital Design with the Verilog HDL –
chapter 7
Tổng hợp mạch Binary_Counter_Part_RTL
Datapaths unit
Tổng hợp bằng Actel Libero IDE 8.2
Computer Engineering 2009
©2009, Pham Quoc Cuong
14

Advanced Digital Design with the Verilog HDL –
chapter 7
Ví dụ thiết kế máy RISC
• RISC: Reduced instruction-set computers
 Tập lệnh đơn giản
 Số chu kỳ clock cho mỗi lệnh là nhỏ
Computer Engineering 2009
©2009, Pham Quoc Cuong
15
Advanced Digital Design with the Verilog HDL –
chapter 7
Kiến trúc của RISC_SPM
Computer Engineering 2009
©2009, Pham Quoc Cuong
16
Advanced Digital Design with the Verilog HDL –
chapter 7
Trình tự thực thi
• Lấy lệnh từ bộ nhớ
• Giải mã lệnh và lấy toán hạng
• Thực thi lệnh
 Các tác vụ trên bộ ALU
 Cập nhật giá trị thanh ghi lưu trữ
 Cập nhật bộ đếm chương trình (PC)
 Cập nhật thanh ghi lệnh (IR)
 Cập nhật thanh ghi địa chỉ (ADD_R)
 Cập nhật bộ nhớ
 Điều khiển dòng dữ liệu
Computer Engineering 2009
©2009, Pham Quoc Cuong

17
Advanced Digital Design with the Verilog HDL –
chapter 7
Bộ điều khiển – Controller (1)
• Chức năng bộ điều khiển
 Định thời tất cả các hoạt động
 Lựa chọn đường dữ liệu từ các bộ multiplexer
 Giám sát trạng thái của bộ xử lý (Processing
Unit) và quyết định giá trị tín hiệu điều khiển
 Điều khiển các bus 3 trạng thái
Computer Engineering 2009
©2009, Pham Quoc Cuong
18
Advanced Digital Design with the Verilog HDL –
chapter 7
Bộ điều khiển – Controller (2)
Tín hiệu Chức năng
Load_Add_Reg Loads the address register
Load _PC Loads Bus_2 to the program counter
Load_IR Loads Bus_2 to the instruction register
Inc_PC Increments the program counter
Sel_Bus_1_Mux Selects among the Program_Counter, R0, R1,
R2, and R3 to drive Bus_1
Sel_Bus_2_Mux Selects among Alu_out, Bus_1, and memory to
drive Bus_2
Load_R0 Loads general purpose register R0
Load_R1 Loads general purpose register R1
Load_R2 Loads general purpose register R2
Load_R3 Loads general purpose register R3
Load_Reg_Y Loads Bus_2 to the register Reg_Y

Load Reg_Z Stores output of ALU in register Reg_Z
write Loads Bus_1 into the SRAM memory
Computer Engineering 2009
©2009, Pham Quoc Cuong
19
Advanced Digital Design with the Verilog HDL –
chapter 7
RISC_SPM: Tập lệnh (1)
• Thiết kế controller phụ thuộc vào tập lệnh
• Có hai dạng thứ lệnh
 Lệnh ngắn
 Lệnh dài
Computer Engineering 2009
©2009, Pham Quoc Cuong
20
Advanced Digital Design with the Verilog HDL –
chapter 7
RISC_SPM: Tập lệnh (2)
* Requires a second word of data; ? denotes a don't care.
opcode
NOP
ADD
AND
NOT
SUB
RD*
WR*
BR*
BRZ*
Instr

Instruction Word
Action
none
dest <= src + dest
dest <= src && dest
dest <= ~src
dest <= dest - src
dest <= memory[Add_R]
PC <= memory[Add_R]
PC <= memory[Add_R]
memory[Add_R] <= src
src dest
0000 ?? ??
0001 src dest
0011 src dest
0100 src dest
0010 src dest
0101 ?? dest
0110 src ??
0111 ?? ??
1000 ?? ??
HALT Halts execution until reset1111 ?? ??
* Lệnh dài, ? Don’t care
Computer Engineering 2009
©2009, Pham Quoc Cuong
21
Advanced Digital Design with the Verilog HDL –
chapter 7
Thiết kế bộ controller
• RISC có 3 pha xử lý: fetch, decode và

execute
 fetch: lấy 1 lệnh từ bộ nhớ (2 chu kỳ clock)
 decode: giải mã lệnh, tính toán dòng dữ liệu
và load giá trị vào thanh ghi (1 chu kỳ clock)
 execute: sinh ra kết quả câu lệnh (0, 1, 2 chu
kỳ clock)
Computer Engineering 2009
©2009, Pham Quoc Cuong
22
Advanced Digital Design with the Verilog HDL –
chapter 7
Các trạng thái của controller (1)
S_idle State entered after reset is asserted. No action.
S_fet1 Load the Add_R with the contents of the PC
S_fet2 Load the IR with the word addressed by the Add_R,
Increment the PC
S_dec Decode the IR
Assert signals to control datapaths and register transfers.
S_ex1 Execute the ALU operation for a single-byte instruction,
Conditionally assert the zero flag, Load the destination register
S_rd1 Load Add_R with the second byte of an RD instruction
Increment the PC.
S_rd2 Load the destination register with memory[Add_R]
S_wr1 Load Add_R with the second byte of a WR instruction,
Increment the PC.
S_wr2 Write memory[Add_R] with the source register
S_br1 Load Add_R with the second byte of a BR instruction
Increment the PC.
S_br2 Load the PC with the memory[Add_R]
S_halt Default state to trap failure to decode a valid instruction

Computer Engineering 2009
©2009, Pham Quoc Cuong
23
Advanced Digital Design with the Verilog HDL –
chapter 7
Controller ASM: NOP/ADD/SUB/AND
Computer Engineering 2009
©2009, Pham Quoc Cuong
24
Advanced Digital Design with the Verilog HDL –
chapter 7
Controller ASM: NOT
Computer Engineering 2009
©2009, Pham Quoc Cuong
25
Advanced Digital Design with the Verilog HDL –
chapter 7
Controller ASM: RD

×