Kiến trúc máy tính-Ngôn ngữ máy
Số trang: 65
Loại file: pdf
Dung lượng: 339.77 KB
Lượt xem: 21
Lượt tải: 0
Xem trước 7 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Tài liệu kiến trúc máy tính,dành cho sinh viên năm 2 các trường ĐH,CĐ chuyên ngành CNTT
Nội dung trích xuất từ tài liệu:
Kiến trúc máy tính-Ngôn ngữ máy Computer Architecture Nguy n Trí Thành Information Systems Department Faculty of Technology College of Technology ntthanh@vnu.edu.vn10/11/2011 1Instructions: Language of the Computer10/11/2011 2Instruction Set The repertoire of instructions of a computer Early computers had very simple instruction sets Simplified implementation Many modern computers also have simple instruction sets Instructions operate using registers10/11/2011 3The MIPS Instruction Set Used as the example throughout the book Stanford MIPS commercialized by MIPS Technologies (www.mips.com) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, … Typical of many modern ISAs See MIPS Reference Data tear-out card, and Appendixes B and E10/11/2011 4CPU Abstract / Simplified View Data Register # Address PC Instruction Registers ALU Address Register # Instruction Data memory memory Register # Data10/11/2011 5Main Types of Instructions Arithmetic Integer Floating Point Memory access instructions Load & Store Control flow Jump Conditional Branch Call & Return10/11/2011 6Arithmetic Operations Add and subtract, three operands Two sources and one destination add a, b, c # a gets b + c All arithmetic operations have this form Design Principle 1: Simplicity favours regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost10/11/2011 7Arithmetic Example C code: f = (g + h) - (i + j); Compiled MIPS code: add t0, g, h # temp t0 = g + h add t1, i, j # temp t1 = i + j sub f, t0, t1 # f = t0 - t110/11/2011 8Register Operands Arithmetic instructions use register operands MIPS has a 32 × 64-bit register file Use for frequently accessed data Numbered 0 to 31 32-bit data called a “word” Assembler names $t0, $t1, …, $t9 for temporary values $s0, $s1, …, $s7 for saved variables10/11/2011 9Register Operand Example High-level swap(int v[], int k) language {int temp; program temp = v[k]; (in C) v[k] = v[k+1]; C code: v[k+1] = temp; } f = (g + h) - (i + j); C compiler f, …, j in $s0, …, $s4 swap: Compiled MIPS code: Assembly muli $2, $5,4 language program add $2, $4,$2 (for MIPS) lw $15, 0($2) add $t0, $s1, $s2 lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) add $t1, $s3, $s4 jr $31 sub $s0, $t0, $t1 Assembler Binary machine 00000000101000010000000000011000 language 00000000100011100001100000100001 program 10001100011000100000000000000000 (for MIPS) 1000110011110010000000000000010010/11/2011 ...
Nội dung trích xuất từ tài liệu:
Kiến trúc máy tính-Ngôn ngữ máy Computer Architecture Nguy n Trí Thành Information Systems Department Faculty of Technology College of Technology ntthanh@vnu.edu.vn10/11/2011 1Instructions: Language of the Computer10/11/2011 2Instruction Set The repertoire of instructions of a computer Early computers had very simple instruction sets Simplified implementation Many modern computers also have simple instruction sets Instructions operate using registers10/11/2011 3The MIPS Instruction Set Used as the example throughout the book Stanford MIPS commercialized by MIPS Technologies (www.mips.com) Large share of embedded core market Applications in consumer electronics, network/storage equipment, cameras, printers, … Typical of many modern ISAs See MIPS Reference Data tear-out card, and Appendixes B and E10/11/2011 4CPU Abstract / Simplified View Data Register # Address PC Instruction Registers ALU Address Register # Instruction Data memory memory Register # Data10/11/2011 5Main Types of Instructions Arithmetic Integer Floating Point Memory access instructions Load & Store Control flow Jump Conditional Branch Call & Return10/11/2011 6Arithmetic Operations Add and subtract, three operands Two sources and one destination add a, b, c # a gets b + c All arithmetic operations have this form Design Principle 1: Simplicity favours regularity Regularity makes implementation simpler Simplicity enables higher performance at lower cost10/11/2011 7Arithmetic Example C code: f = (g + h) - (i + j); Compiled MIPS code: add t0, g, h # temp t0 = g + h add t1, i, j # temp t1 = i + j sub f, t0, t1 # f = t0 - t110/11/2011 8Register Operands Arithmetic instructions use register operands MIPS has a 32 × 64-bit register file Use for frequently accessed data Numbered 0 to 31 32-bit data called a “word” Assembler names $t0, $t1, …, $t9 for temporary values $s0, $s1, …, $s7 for saved variables10/11/2011 9Register Operand Example High-level swap(int v[], int k) language {int temp; program temp = v[k]; (in C) v[k] = v[k+1]; C code: v[k+1] = temp; } f = (g + h) - (i + j); C compiler f, …, j in $s0, …, $s4 swap: Compiled MIPS code: Assembly muli $2, $5,4 language program add $2, $4,$2 (for MIPS) lw $15, 0($2) add $t0, $s1, $s2 lw $16, 4($2) sw $16, 0($2) sw $15, 4($2) add $t1, $s3, $s4 jr $31 sub $s0, $t0, $t1 Assembler Binary machine 00000000101000010000000000011000 language 00000000100011100001100000100001 program 10001100011000100000000000000000 (for MIPS) 1000110011110010000000000000010010/11/2011 ...
Tìm kiếm theo từ khóa liên quan:
kiến thức phần cứng kiến trúc máy tính hợp ngữ hệ điều hành lệnh hợp ngữGợi ý tài liệu liên quan:
-
Giáo trình Lý thuyết hệ điều hành: Phần 1 - Nguyễn Kim Tuấn
110 trang 453 0 0 -
67 trang 300 1 0
-
173 trang 275 2 0
-
175 trang 272 0 0
-
Giáo trình Nguyên lý các hệ điều hành: Phần 2
88 trang 272 0 0 -
Giáo trình Nguyên lý hệ điều hành (In lần thứ ba): Phần 1 - PGS.TS. Hà Quang Thụy
98 trang 248 0 0 -
Đề tài nguyên lý hệ điều hành: Nghiên cứu tìm hiểu về bộ nhớ ngoài trong hệ điều hành Linux
19 trang 245 0 0 -
Giáo trình Kiến trúc máy tính và quản lý hệ thống máy tính: Phần 1 - Trường ĐH Thái Bình
119 trang 235 0 0 -
Bài thảo luận nhóm: Tìm hiểu và phân tích kiến trúc, chức năng và hoạt động của hệ điều hành Android
39 trang 229 0 0 -
Giáo trình Hệ điều hành: Phần 2
53 trang 219 0 0