Assignment
1. Trace the program below and summarize what the program does; not a step-by-step description of each instruction.
Address / Mailbox #
|
Assembly / Mnemonic
|
Numeric Code
|
00
|
IN
|
901
|
01
|
STO 90
|
390
|
02
|
IN
|
901
|
03
|
STO 91
|
391
|
04
|
LDA 90
|
590
|
05
|
OUT
|
902
|
06
|
LDA 91
|
591
|
07
|
OUT
|
902
|
08
|
HLT
|
000
|
...
|
|
|
90
|
DAT 0
|
000
|
91
|
DAT 0
|
000
|
2. Complete the table below to construct an LMC program that will accept a set of three numbers as INPUT and then add the first two numbers and output the answer, then subtract the first number from the third and output the answer. The program begins at address 00 and data is stored in address 90.
Mailbox #
|
Mnemonic
|
Numeric code
|
Instruction Description
|
00
|
IN
|
901
|
Input first number
|
01
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3. Complete the table below and construct an LMC program that will accept a number INPUT and OUTPUT a sequence of numbers, starting at 1 and finishing with the INPUT (maxNumber). The counter must be initialized to zero each time the program is run. The program will continue (loop) until a 0 is entered.
Mailbox #
|
Mnemonic
|
Numeric code
|
Instruction Description
|
00
|
|
|
load zero (from 93) to the accumulator
|
01
|
|
|
Store the initial count
|
02
|
|
|
input
|
03
|
|
|
If zero, branch to halt
|
04
|
|
|
Store maxNumber
|
05
|
|
|
LoopTop load count
|
06
|
|
|
Add step to counter
|
07
|
|
|
Store count
|
08
|
|
|
Output
|
09
|
|
|
Subtract maxNumber
|
10
|
|
|
If positive, endLoop
|
11
|
|
|
Jumpt to loopTop
|
12
|
|
|
endLoop jump to start
|
13
|
|
|
Halt execution
|
|
|
|
|
90
|
|
|
step DAT 1
|
91
|
|
|
maxNumber DAT
|
92
|
|
|
count DAT
|
93
|
|
|
zero DAT
|
4. Complete the table below to construct an LMC program that will accept two INPUT numbers and then OUTPUT the greater of the two. The program should begin at address 00 and data should be stored in addresses beginning at 90.
Mailbox #
|
Mnemonic
|
Numeric code
|
Instruction Description
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5. Consider the LMC program below in which 2 numbers are entered and added. Suppose the first input entry was stored in mailbox location 00.
a. Would the program have produced the same result?
b. What would have happened if the program were executed a second time?
c. What characteristic of the computer makes this true?
Mailbox Address
|
Numeric Code
|
00
|
901
|
01
|
306
|
02
|
901
|
03
|
106
|
04
|
902
|
05
|
000
|
06
|
000
|
6. If a computer has a 38-bit memory address register. How much memory can this computer address? (Assume: 1 byte/cell; use the most appropriate measure unit). Show your work.
Consider the following LMC instructions found in the given locations in memory.
Mailbox Address
|
Mnemonic Code
|
15
|
LDA 40
|
16
|
ADD 41
|
...
|
|
40
|
723
|
41
|
021
|
7. Show the CPU Fetch/Execute cycle steps and the values of Instruction Register (IR), the Program Counter (PC), the Memory Address Register (MAR), the Memory Data Register (MDR), and Accumulator (A) when the instruction in address 15 is completed.
F/E cycle
|
Register Values
|
|
|
|
|
|
|
|
|
|
|
8. Show the contents of each register as each step of the F/E cycle is performed for instruction 16 in the above program.
F/E cycle
|
PC
|
MAR
|
MDR
|
IR
|
A
|
PC → MAR
|
|
|
|
|
|
MDR → IR
|
|
|
|
|
|
IR [address] → MAR
|
|
|
|
|
|
A + MDR → A
|
|
|
|
|
|
PC + 1 → PC
|
|
|
|
|
|
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.