Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a TOY program that reads, interactively, a number, multiplies that number by 4 = 22 and outputs the result. This means that the input

image text in transcribedimage text in transcribed

Write a TOY program that reads, interactively, a number, multiplies that number by 4 = 22 and outputs the result. This means that the input and output has to happen through the standard input and output, the number to be multiplied is not already in the memory of the computer. The table of instruction for the TOY machine appears at below. TOY reference card opcode operation format pseudo-code 0 halt - halt add RR R[d] = R[s] + R[t] Format RR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 subtract bitwise and Opcode destination d sources sourcet bitwise xor RR RR RR RR RR R[d] = R[s] - R[t] R[d] = R[s] & R[t] R[d] =R[s] ^ R[t] R[d] =R[s] > R[t] shift left shift right load addr A R[d] = addr Format A load 151413 12 11 10 9 8 7 6 5 4 3 2 1 0 A A R[d] = M[addr] Maddr] = R[d] store opcode destination d address ADDR load indirect RR R[d] = M[R[t]] store indirect branch zero branch RR A A RR A M[R[t]] = R[d] if (R[d] == 0) PC = addr if (R[d] >0) PC = addr PC = R[d] R[d] = PC + 1; PC = addr R[O] is always 0. STANDARD INPUT Load from FF. STANDARD OUTPUT Store to FF. jump register jump and link F Write a TOY program that reads, interactively, a number, multiplies that number by 4 = 22 and outputs the result. This means that the input and output has to happen through the standard input and output, the number to be multiplied is not already in the memory of the computer. The table of instruction for the TOY machine appears at below. TOY reference card opcode operation format pseudo-code 0 halt - halt add RR R[d] = R[s] + R[t] Format RR 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 subtract bitwise and Opcode destination d sources sourcet bitwise xor RR RR RR RR RR R[d] = R[s] - R[t] R[d] = R[s] & R[t] R[d] =R[s] ^ R[t] R[d] =R[s] > R[t] shift left shift right load addr A R[d] = addr Format A load 151413 12 11 10 9 8 7 6 5 4 3 2 1 0 A A R[d] = M[addr] Maddr] = R[d] store opcode destination d address ADDR load indirect RR R[d] = M[R[t]] store indirect branch zero branch RR A A RR A M[R[t]] = R[d] if (R[d] == 0) PC = addr if (R[d] >0) PC = addr PC = R[d] R[d] = PC + 1; PC = addr R[O] is always 0. STANDARD INPUT Load from FF. STANDARD OUTPUT Store to FF. jump register jump and link F

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Wiley CPA Exam Review Auditing And Attestation 2011

Authors: Patrick R. Delaney, O. Ray Whittington

8th Edition

0470554347, 978-0470554340

Students also viewed these Accounting questions

Question

What are two reasons that XML is needed for HTML documents?

Answered: 1 week ago

Question

design a simple disciplinary and grievance procedure.

Answered: 1 week ago