1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

To chuc may tinh bài tập chương hai

2 315 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 44,96 KB

Nội dung

Bài tập tổ chức máy tính ,giúp cho sinh viên khoa điện tử viễn thông luyện tập các kiến thức đã học về lệnh assemble và mã lệnh máy . Cung cấp bài tập cơ bản ,các tài liệu tham khảo.Bài tập chương hai .

Computer Organization Homework 1) For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables i and j are assigned to registers $s0 and $s1, respectively Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively B[8] = A[i-j]; 2) For the following MIPS assembly instructions, what is the corresponding C statement? Assume that the variables f and g are assigned to registers $s0 and $s1, respectively Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively sll $t0, $s0, add $t0, $s6, $t0 sll $t1, $s1, add $t1, $s7, $t1 lw $s0, 0($t0) addi $t2, $t0, lw $t0, 0($t2) add $t0, $t0, $s0 sw $t0, 0($t1) # $t0 = f * # $t0 = &A[f] # $t1 = g * # $t1 = &B[g] # f = A[f] 3) For the MIPS assembly instructions in Exercise 2, rewrite the assembly code to minimize the number if MIPS instructions (if possible) needed to carry out the same function 4) Translate the following MIPS code to machine language: addi $t0, $s6, add $t1, $s6, $0 sw $t1, 0($t0) lw $t0, 0($t0) add $s0, $t1, $t0 5) Translate the following C code to MIPS assembly code Use a minimum number of instructions Assume that the values of a, b, i, and j are in registers $s0, $s1, $t0, and $t1, respectively Also, assume that register $s2 holds the base address of the array D for(i=0; i

Ngày đăng: 11/03/2018, 14:50

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w