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 ______________.
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
Represent following LEGv8 machine code into assembly instruction. 0x784302CD
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
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
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) {...
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
---------------------------------------------------------------------------------------------------------------- C++ //code a program for the following the given Instruction. Geometry Calculator 1. Calculate the...
---------------------------------------------------------------------------------------------------------------- C++ //code a program for the following the given Instruction. Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1-4): If the user enters 1, the program should ask for the radius of the circle and then display its area. Use 3.14159 for pi. #03   If the user enters 2, the program should ask for the length and width of...
True and False 1. The instruction register stores machine code for the instruction being executed. 2....
True and False 1. The instruction register stores machine code for the instruction being executed. 2. Before a digital computer may execute an instruction, the instruction code must be fetched from memory. 3. A pointer is a binary code for data in the arithmetic logic unit. 4. Von Neumann computer architecture stores data and instruction codes in the same memory. 5. Complex instruction set computers have instructions with greater speed than those in reduced instruction set computers.
Enter the first usable host address on the network 181.15.144.200 255.255.255.192. Please show work.
Enter the first usable host address on the network 181.15.144.200 255.255.255.192. Please show work.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT