Question

In: Computer Science

Suppose the address of the first instruction is 5F370654 in hexadecimal in the following code. Show...

Suppose the address of the first instruction is 5F370654 in hexadecimal in the following code. Show in decimal the immediate value (i.e. offset) in the beq and bne instruction, and in hexadecimal (of 7 digits) the psedudo address in the j instruction. Separate the numbers by comma.

label1:
  beq $t1, $t2, label3
  (17 instructions here)
label2:
  bne $t3, $t4, label1
  (46 instructions here)
label3:
  j  label2

Solutions

Expert Solution

label1:
beq $t1, $t2, label3
(17 instructions here)
label2:
bne $t3, $t4, label1
(46 instructions here)
label3:
j label2

Address of first instruction = 0x5F370654
Address of Label2 = 0x5F370654 + (18*4) = 0x5F370654 + 0x48 = 0x5F37069C
Address of Label3 = 0x5F370654 + (65*4) = 0x5F370654 + 0x104 = 0x5F370758


Number of instructions between beq $t1, $t2, label3 and label 3 = (17 + 47) = 64
offset = 64
other Method: When instruction beq $t1, $t2, label3 is executing, value of PC = (0x5F370654 + 4) = 0x5F370658
Address of label3 = 0x5F370758
offset = (0x5F370758 - 0x5F370658)/4 = 0x100/4 = 256/4 = 64

Number of instructions between bne $t3, $t4, label1 and label 1 = 18
offset = -(18 + 1) = -19

other Method: When instruction bne $t3, $t4, label1 is executing, value of PC = (0x5F37069C + 4) = 0x5F3706A0
Address of label1 = 0x5F370654
offset = (0x5F370654 - 0x5F3706A0)/4 = -(0x4c)/4 = -76/4 = -19

Hexadecimal (of 7 digits) the psedudo address in the j instruction.
Address of Label2 = 0x5F370654 + (18*4) = 0x5F370654 + 0x48 = 0x5F37069C
(F37069C)>>2 = 0x3cdc1a7


Related Solutions

1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled...
1.The machine code of LEGv8 instruction SUB X15,X16,X17 in hexadecimal is? 2.The LEGv8 assembly instruction assembled into the hexadecimal machine code D1001695 is? 3.What does the LEGv8 instruction below do? LSL X12,X12,#8
Convert 110.7510 to binary ______ and hexadecimal ______. Show the answer in both binary and hexadecimal....
Convert 110.7510 to binary ______ and hexadecimal ______. Show the answer in both binary and hexadecimal. There are ____________ kilobytes in a megabyte. Convert -13210 to a 16-bit 2’s complement in binary ____________ and hexadecimal ______________.
Given the following memory values and address instruction with an accumulator. Determine the values with the...
Given the following memory values and address instruction with an accumulator. Determine the values with the following instructions load into accumulator. Word 16 contains 22 Word 18 contains 24 Word 20 contains 26 Word 22 contains 28 Word 24 contains 30 Word 26 contains 32 Word 28 contains 34 i. LOAD IMMEDIATE 16 ii. LOAD DIRECT 16 iii. LOAD INDIRECT 16 iv. LOAD IMMEDIATE 18 v. LOAD DIRECT 18 vi. LOAD INDIRECT 20 vii. LOAD IMMEDIATE 24 viii. LOAD DIRECT...
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b....
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b. 85 - binary: - hexadecimal: c. 128 - binary: - hexadecimal: d. 4563 - binary: - hexadecimal:
write a python code to Determine the binary and decimal representations of the following hexadecimal numbers....
write a python code to Determine the binary and decimal representations of the following hexadecimal numbers. Store answers in the appropriate variables in the .py file. (a) 0xfca1 (b) 0xc4d8
Micro-processing/ DEBUGGING- Show how the instruction MOV [DI], DX can be assembled into memory address CS:100
Micro-processing/ DEBUGGING- Show how the instruction MOV [DI], DX can be assembled into memory address CS:100
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What...
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What is the RISC-V instruction format and specific assembly language instruction? 0xfe810113
Number conversion between hexadecimal and binary. Show the working steps. a) Convert the hexadecimal number E4D2...
Number conversion between hexadecimal and binary. Show the working steps. a) Convert the hexadecimal number E4D2 into binary. b) Convert the binary number 1100010111110011 into hexadecimal
code in c++ using the code given add a hexadecimal to binary converter and add a...
code in c++ using the code given add a hexadecimal to binary converter and add a binary to hexadecimal converter #include <iostream> #include <string> #include<cmath> #include<string> using namespace std; int main() { string again; do { int userChoice; cout << "Press 2 for Decimal to Binary"<< endl; cout << "Press 1 for Binary to Decimal: "; cin >> userChoice; if (userChoice == 1) { long n; cout << "enter binary number" << endl; cin>>n; int decnum=0, i=0, remainder; while(n!=0) {...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT