Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Little Man program below uses only 2 branches (BRZ 09 and BR 01). Assume now that the program will only read 3 numbers. That

The Little Man program below uses only 2 branches (BRZ 09 and BR 01). Assume now that the program will only read 3 numbers. That is, the following numbers in the following order will be placed, one at a time, in the In-basket: 2, 15, and 10, where 2 is the count of numbers that follow, and 15 and 10 are the numbers that are to be added. The first column in the table below shows the order in which the instructions from the program will be executed. Trace the execution of these instructions and determine the contents of the PC before and after each instruction is executed. Also, write down in the table the contents of the In-basket, Accumulator, Memory locations 12 through 14, and Out-basket after each instruction is executed. Memory locations 13 and 14 are initialized with 1 and 0, respectively. The contents of memory location 12 is initially unknown. The entry 00 01 in the PC column means that the PC is 00 when instruction IN started and is changed to 01 when the IN instruction is finished. The instructions at addresses 00-11 represent the program area and the addresses 12-14 represent the data area.

Address Instruction Mnemonics

00 IN

01 STO 12

02 BRZ 09

03 IN

04 ADD 14

05 STO 14

06 LDA 12

07 SUB 13

08 BR 01

09 LDA 14

10 OUT

11 HLT

------------------------

Address Contents

12 DAT ? // stores the current count; 2, 1, 0; initially (?), at the end 0.

13 DAT 1 // constant 1; used to control the loop; decrements the count by 1.

14 DAT 0 // stores the partial and then the final sum; initially 0, at the end 25.

The sequence in which instructions

are executed

PC

before after

In-basket

Accumulator

Memory location 12

Memory location

13

Memory location

14

Out-basket

IN

00 01

2

2

?

1

0

?

STO 12

BRZ 09

IN

ADD 14

STO 14

LDA 12

SUB 13

BR 01

STO 12

BRZ 09

IN

ADD 14

STO 14

LDA 12

SUB 13

BR 01

STO 12

BRZ 09

LDA 14

OUT

HLT

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 19 21 2012 Proceedings Part 3 Lnai 7198

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284922, 978-3642284922

More Books

Students also viewed these Databases questions