Jamie wants to translate program P1 (except for the final HALT instruction) into a sequence of statements in a version of C with a 16-bit int type. Using the IM Fill in the rest of her program with assignments to variables named R2, R3, and R4 that represent the registers with these names in P1 and a while loop.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter6: System Integration And Performance
Section: Chapter Questions
Problem 3RP
icon
Related questions
Question

Consider a HW ISA program P1 with the following Instruction Memory IM:

Jamie wants to translate program P1 (except for the final HALT instruction) into a sequence of statements in a version of C with a 16-bit int type. Using the IM Fill in the rest of her program with assignments to variables named R2, R3, and R4 that represent the registers with these names in P1 and a while loop. 

int R0 = 0;

int R1 = 1;

int R2 = R0 + R0;

// ...

IM
Address
Contents
0x0-0x1
ADD RO, RO, R2
0x2-0x3
ADD R1, R1, R3
0x4-0x5
ADD R3, R3, R4
0x6-0x7
BEQ R3, R4, 3
0x8-0x9
ADD R2, R4, R2
OXA-0XB
SUB R4, R1, R4
OXC-0XD
JMP 3
OXE-OXF HALT
Transcribed Image Text:IM Address Contents 0x0-0x1 ADD RO, RO, R2 0x2-0x3 ADD R1, R1, R3 0x4-0x5 ADD R3, R3, R4 0x6-0x7 BEQ R3, R4, 3 0x8-0x9 ADD R2, R4, R2 OXA-0XB SUB R4, R1, R4 OXC-0XD JMP 3 OXE-OXF HALT
Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Principles of Information Systems (MindTap Course…
Principles of Information Systems (MindTap Course…
Computer Science
ISBN:
9781285867168
Author:
Ralph Stair, George Reynolds
Publisher:
Cengage Learning