void swap (int arr[], int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] } temp; void selectionSort (int arr[], int n) { for (int i = 0; i < n 1; i++) { int min i; for (int j=i+1; j < n; j++) { if (arr[j] arr[min]) min = j; swap (arr, min, i); } } } int main() { int arr[] = { 3, 5, 8, 4, 1, 9, -2 }; int n = 7; selectionSort (arr, n); return 0; } 1. Tranlaste the above C program to MIPS codes, suppose the starting address of codes is binary number 1000, the starting address of data is binary number 100000. 2. Translate the first MIPS codes of "if (arr[j] Add ALU (MAX- Add result Shift RegDst Branch left 2 MemRead Instruction [31-26] MemtoReg Control ALUOP MemWrite ALUSrc RegWrite Instruction [25-21] Read Read address register 1 Read Instruction [20-16] data 1 Read Instruction register 2 0 [31-0] M Read Write data 2 Instruction Instruction [15-11] x register memory 1 Write MJX result Zero ALU ALU Read Address data data Registers Data Write data memory 16 Instruction [15-0] Sign- extend Instruction (5-0) 32 32 ALU control Ox
void swap (int arr[], int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] } temp; void selectionSort (int arr[], int n) { for (int i = 0; i < n 1; i++) { int min i; for (int j=i+1; j < n; j++) { if (arr[j] arr[min]) min = j; swap (arr, min, i); } } } int main() { int arr[] = { 3, 5, 8, 4, 1, 9, -2 }; int n = 7; selectionSort (arr, n); return 0; } 1. Tranlaste the above C program to MIPS codes, suppose the starting address of codes is binary number 1000, the starting address of data is binary number 100000. 2. Translate the first MIPS codes of "if (arr[j] Add ALU (MAX- Add result Shift RegDst Branch left 2 MemRead Instruction [31-26] MemtoReg Control ALUOP MemWrite ALUSrc RegWrite Instruction [25-21] Read Read address register 1 Read Instruction [20-16] data 1 Read Instruction register 2 0 [31-0] M Read Write data 2 Instruction Instruction [15-11] x register memory 1 Write MJX result Zero ALU ALU Read Address data data Registers Data Write data memory 16 Instruction [15-0] Sign- extend Instruction (5-0) 32 32 ALU control Ox
New Perspectives on HTML5, CSS3, and JavaScript
6th Edition
ISBN:9781305503922
Author:Patrick M. Carey
Publisher:Patrick M. Carey
Chapter14: Exploring Object-based Programming: Designing An Online Poker
Section14.1: Visual Overview: Custom Objects, Properties, And Methods
Problem 7QC
Related questions
Question
Help with question #3 please
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Recommended textbooks for you
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning