kiến trúc máy tính trương văn cường lecture 02 chương ter 02 language of the computer 01 sv sinhvienzone com

50 100 0
kiến trúc máy tính trương văn cường lecture 02 chương ter 02 language of the computer 01 sv sinhvienzone com

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

COMPUTER ARCHITECTURE Chapter Lecture Instruction: Language of the Computer CuuDuongThanCong.com https://fb.com/tailieudientucntt The goals • Bốn nguyên tắc thiết kế • Ba tốn hạng máy tính • Biểu diễn lệnh máy tính • Phân loại lệnh theo định dạng: Rtype, I-Type, J-Type • Phân loại lệnh theo chức • Chuyển đổi lệnh ngôn ngữ: cấp cao, hợp ngữ, ngôn ngữ máy Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Chapter contents Introduction Operations/operands of the Computer Hardware Signed and Unsigned number (review) MIPS Instruction Arithmetic instruction Logical instruction Branch/jump instruction Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt References • Slide: • Computer Organization and Design, 4th Edition, Patterson & Hennessy, â 2008, MK ã Mary Jane Irwin, Penn State University • Textbook: Chương (p.74 – p.221) • Software: • Mars / Qtspim • MIPS reference Data • Resources: • https://uit.edu.vn/~ktmt/mips-tutorial • https://uit.edu.vn/~ktmt/references Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Lecture goals • Giới thiệu lệnh, tập lệnh • Kiến trúc tập lệnh MIPS • Phép tốn/tốn hạng máy tính • Xem lại số có dấu, số khơng dấu • Biểu diễn lệnh, phân loại lệnh Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Lecture contents • Introduction • Operations of the Computer Hardware • Operands of the Computer hardware • Representing Instruction in Computer Hardware • Instruction class Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt §2.1 Introduction Brainstorming Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Brainstorming Computer language Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt Definitions • Để lệnh cho phần cứng máy tính, cần ngơn ngữ phần cứng máy tính: • Instruction: lệnh • Instruction set: Tập lệnh, hay gọi từ vừng máy tính Sep-16 Introduction CuuDuongThanCong.com https://fb.com/tailieudientucntt Instruction Set • Tập lệnh máy tính • Máy tính khác có tập lệnh khác • Nhưng với nhiều khía cạnh giống • Máy tính sơ khai có tập lệnh đơn giản • Sự thực đơn giản • Nhiều máy tính đại có tập lệnh đơn giản Sep-16 CuuDuongThanCong.com 10 Introduction https://fb.com/tailieudientucntt 2s-Complement Signed Integers • Bit 31 is sign bit • for negative numbers • for non-negative numbers • –(–2n – 1) can’t be represented • Non-negative numbers have the same unsigned and 2s-complement representation • Some specific numbers • • • • 0: 0000 0000 … 0000 –1: 1111 1111 … 1111 Most-negative: 1000 0000 … 0000 Most-positive: 0111 1111 … 1111 Sep-16 CuuDuongThanCong.com Review: Signed and Unsigned Numbers https://fb.com/tailieudientucntt 36 Signed Binary Representation 2’sc binary decimal -23 = 1000 -8 -(23 - 1) = 1001 -7 1010 -6 1011 -5 1100 -4 1101 -3 1110 -2 1111 -1 0000 0001 0010 0011 0100 0101 0110 0111 complement all the bits 1011 0101 and add a and add a 1010 0110 complement all the bits 23 - = Sep-16 CuuDuongThanCong.com Review: Signed and Unsigned Numbers https://fb.com/tailieudientucntt 37 Sign Extension • Biểu diễn số sử dụng nhiều bit • Giữ nguyên giá trị • Trong tập lệnh MIPS • addi: extend immediate value • lb, lh: extend loaded byte/halfword • beq, bne: extend the displacement • Nhân rộng bit dấu bên trái • c.f unsigned values: extend with 0s • Examples: 8-bit to 16-bit • +2: 0000 0010 => 0000 0000 0000 0010 • –2: 1111 1110 => 1111 1111 1111 1110 Sep-16 CuuDuongThanCong.com Review: Signed and Unsigned Numbers https://fb.com/tailieudientucntt 38 Review : Evaluating ISAs • Design-time metrics: • Can it be implemented? With what performance, at what costs (design, fabrication, test, packaging), with what power, with what reliability? • Can it be programmed? Ease of compilation? • Static Metrics: • How many bytes does the program occupy in memory? • Dynamic Metrics: • How many instructions are executed? How many bytes does the processor fetch to execute the program? CPI • How many clocks are required per instruction? • How "lean" a clock is practical? Best Metric: Time to execute the program! depends on the instructions set, the processor organization, and compilation techniques Inst Count Sep-16 CuuDuongThanCong.com Representing Instructions in the Computer https://fb.com/tailieudientucntt Cycle Time 39 Two Key Principles of Machine Design Instructions are represented as numbers and, as such, are indistinguishable from data Programs are stored in alterable memory (that canMemory be read or written to) just like data Accounting prg (machine code)  Stored-program concept   Programs can be shipped as files of binary numbers – binary compatibility Computers can inherit ready-made software provided they are compatible with an existing ISA – leads industry to align around a small number of ISAs Sep-16 CuuDuongThanCong.com C compiler (machine code) Payroll data Source code in C for Acct prg Representing Instructions in the Computer https://fb.com/tailieudientucntt 40 MIPS (RISC) Design Principles • Simplicity favors regularity • fixed size instructions • small number of instruction formats • opcode always the first bits • Smaller is faster • limited instruction set • limited number of registers in register file • limited number of addressing modes • Make the common case fast • arithmetic operands from the register file (load-store machine) • allow instructions to contain immediate operands • Good design demands good compromises • three instruction formats Sep-16 CuuDuongThanCong.com Representing Instructions in the Computer https://fb.com/tailieudientucntt 41 MIPS-32 ISA Registers • Phân loại theo chức • • • • R0 - R31 Computational Load/Store Jump and Branch Floating Point PC HI • coprocessor LO • Memory Management • Special Phân loại theo định dạng lệnh op rs rt op rs rt op rd sa funct I format immediate J format jump target Sep-16 CuuDuongThanCong.com R format Representing Instructions in the Computer https://fb.com/tailieudientucntt 42 MIPS Instruction Fields • Các trường MIPS op bits rs bits rt bits rd shamt funct bits bits bits  Op: phép toán lệnh, thương gọi opcode (mã lệnh)  Rt: toán hạngRs : toán hạng ghi thứ  nguồn ghi thứ hai  Rd: tốn hạng ghi đích Nơi lưu kết phép toán  Shamt: shit amount  Funct: trường thường gọi mã hàm (function code), chọn biến cụ thể phép toán trường mã lệnh Sep-16 CuuDuongThanCong.com Lecture review 43 https://fb.com/tailieudientucntt Question • Có tất lệnh MIPS biểu diễn? • Tầm địa lệnh I-TYPE? • Tầm địa lệnh J-Type? Sep-16 CuuDuongThanCong.com Lecture review 44 https://fb.com/tailieudientucntt MIPS (RISC) Design Principles Có nguyên tắc thiết kế bản: Simplicity favors regularity Smaller is faster Make the common case fast Good design demands good compromises Sep-16 CuuDuongThanCong.com Lecture review 45 https://fb.com/tailieudientucntt Operands of the computer hardware Có ba loại tốn hạng: Tốn hạng ghi (Register Operand) Toán hạng nhớ (Memory Operand) Toán hạng trực tiếp (Immediate Operand) Sep-16 CuuDuongThanCong.com Lecture review 46 https://fb.com/tailieudientucntt MIPS Instruction Fields • Các trường MIPS op bits rs bits rt bits rd shamt funct bits bits bits  Op: phép toán lệnh, thương gọi opcode (mã lệnh)  Rs : toán hạng ghi thứ  Rt: toán hạng nguồn ghi thứ hai  Rd: tốn hạng ghi đích Nơi lưu kết phép toán  Shamt: shit amount  Funct: trường thường gọi mã hàm (function code), chọn biến cụ thể phép toán trường mã lệnh Sep-16 CuuDuongThanCong.com Lecture review 47 https://fb.com/tailieudientucntt Instruction format Instruction Formats: all 32 bits wide op rs rt op rs rt op rd sa funct R format I format immediate J format jump target R format: Các lệnh có tốn hạng tốn hạng ghi I format: Các lệnh có tốn hạng tốn hạng nhớ J format: Các lệnh nhảy (Jump) Sep-16 CuuDuongThanCong.com Lecture review 48 https://fb.com/tailieudientucntt MIPS instruction class Instruction class Arithmetic Số học MIPS example add, sub, addi Data transfer Di chuyển liệu Logical Luận lý Conditional branch Rẽ nhánh có điều kiện Jump Nhảy lw, sw, lb, lbu, lh, lhu, sb, lui and, or, nor, andi, ori, sll, srl beq, bne, slt, slti, sltiu j, jr, jal FIGURE 2.45, textbook, p.179 Sep-16 CuuDuongThanCong.com Lecture review 49 https://fb.com/tailieudientucntt Next Lecture and Reminder • Next lecture • Instruction: language of the Computer – L02 • Các lệnh số học • Các lệnh luận lý • Reminder 50 Sep-16 CuuDuongThanCong.com https://fb.com/tailieudientucntt ... 1110 -2 1111 -1 0000 0 001 0010 0011 010 0 010 1 011 0 011 1 complement all the bits 1011 010 1 and add a and add a 1010 011 0 complement all the bits 23 - = Sep-16 CuuDuongThanCong .com Review: Signed and... CuuDuongThanCong .com https://fb .com/ tailieudientucntt Lecture contents • Introduction • Operations of the Computer Hardware • Operands of the Computer hardware • Representing Instruction in Computer Hardware... CuuDuongThanCong .com Operands of the Computer Hardware https://fb .com/ tailieudientucntt 25 Memory Operands Sep-16 CuuDuongThanCong .com Operands of the Computer Hardware https://fb .com/ tailieudientucntt

Ngày đăng: 28/01/2020, 23:15

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan