(symbolic notation) (Binary Notation)
ILOAD i 0x15 0x02
ILOAD j 0x150x03
IADD 0x60
ISTORE i 0x360x01
ILOAD k 0x15 0x04
IADD 0x64
ILOAD i 0x15 0x01
BIPUSH 2 0x10 0x01
IADD 0x68
ISTORE i 0x360x01
ILOAD i 0x15 0x04
BIPUSH 5 0x10 0x02
IF_ICMPQ L1 0x9F 0x00 0x0D
ILOAD i 0x15 0x05
BIPUSH 3 0x10 0x05
IADD 0x72
ISTORE i 0x360x02
ILOAD k 0x15 0x06
BIPUSH i 0x10 0x05
ISTORE k 0x360x03
ILOAD i 0x15 0x07
BIPUSH 1 0x10 0x06
L1: ILOAD k 0x15 0x05
BIPUSH 2 0x10 0x06
Total number of instruction required are : 25
time taken=3*1 nanosecond= 3 nanosecond for this condition.
3. [40 points, level-2,-3, and-4] this question involves Level-4 “High language level", Level-3 "Machine language level...
Problem-1 (9 Points) Determine the machine code (in hex) for the following assembly language instructions: Machine Code (in Hex) Instruction a. LDX #$21B6 b. LDAB $1B,Y C. STAB $B34C
Question 3 (10 points) Convert the following MIPS assembly code into machine language. Write the instruction in hexadecimal. The opcode for sw 43 (101011). sw St1, -4(St3) Question 4 (10 points) Consider the following MIPS assembly code: addi $s3, $0, 5 addi $s1, S0, 3 addi Ss1, $s1, 2 beq Ss3, Ssl, target addi Ss1, Ss1, 1 target: add Ss3, Ss1, Ssl a. After running the code, what is the value of Ss3? b. If the memory address of the...
Exercise 1: For each of the following high-level language code snippets, write the SRO assembly code. Assume that the variables A, B, C, X. are in memory locations MA, MB, MC, MX, respectively. a) XA+ 2B- 4C; b) if (A <0) else if (A> 0) else c) for (int i 1; 10; i++) X A+B+C (Hint: Use branch instructions to set up the loop)
Translate each of the following pseudo-instructions into MIPS instructions. You should Produce a minimal sequence of MIPS instructions to accomplish the required computation. (8 Points) 1) bgt $t1, 100, Label # bgt means branch if greater than 2) ble $s2, 10, Next # ble means branch if less than or equal 3) ror $s0, $s4, 7 # ror means rotate right $s4 by 7 bits and store the result in $s0 4) neg $s5, $s4 # $s5 will have the...
(4 points) Convert the following MIPS assembly language instructions to machine language instructions. Express our results in hexadecimal representations. (a) addi $s2, Ss1, 3 (b) slt Sso, St1, Szero
Question 21 Implement the following code fragments in Hack Virtual Machine code, the variables a, b and c are in the local segment at offsets 4, 5 and 6 respectively. Jack Code a)-(alb) Virtual Machine Code [4 marks] b) (a(b+c) 5 marks] [5 marks] d) Recursive.factorial(6) 2 marks] e) a # c * b 4 marks] Total for Question 21: 20 marks] Question 21 Implement the following code fragments in Hack Virtual Machine code, the variables a, b and c...
1. [2 points] Write a MIPS assembly language program of the following C function and the code to call the function: int leaf_example (int g, h, i, j) { int f; f = (g + h) - (i + j); return f; مهه Arguments g, h, i, and j are passed to the function in registers $a0, $al, Şa2, and $a3, respectively while f in $50 (hence, need to save $50 on stack), and the result is to be stored...
Name B. (7 pts) MIPS short answer 1. (3pt) For the following MIPS assembly language program: loop: addi Sto, $to,-1 bne $to, $zero, loop Translate the second instruction into MIPS machine language and write it in hex. 2. (2 pt) Which best describes the reason that we maintain the stack pointer in a register? (circle one) i. The hardware forces use of a stack pointer. ii. We need a local pointer because we are often limited to relative addressing. ili....
(10 points) Translate the following algorithm into assembly language. IF 65 < X THEN X = 9+(X^2) ELSE X = - Y 3. (10 points) Translate the following algorithm into assembly language. X=0 FOR K = I TO 5 X=X+5 END_FOR 4. (10 points) Translate the following algorithm into assembly language. X=0 Y=5 Z=5 WHILE Z = 5 X=X+1 Y=Y-1 Z=X+Y 2. (10 points) Translate the following algorithm into assembly language. IF65 < X THEN X = 9t(X^2) ELSE X...
(2+2+1 5 points) Problem 10.1: simple cpu machine code = The following program has been written for the simple central processing unit introduced in class. The table below shows the initial content of the 16 memory cells. The first column denotes the memory address. Machine Code Assembly Code Description 001 1 0001 0 010 0 1111 1 001 1 0000 3 101 1 0100 110 1 0110 4 111 1 0000 5 6 001 0 001 1 100 1 0001...