Danh mục

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    
Thư viện của tui

Phí tải xuống: 32,000 VND Tải xuống file đầy đủ (65 trang) 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 ...

Tài liệu được xem nhiều: