Question: An incomplete assembly language program for the Simple Computer is shown below. For this problem, you will fill in the blanks in the program to

An incomplete assembly language program for the Simple Computer is shown below. For this problem, you will fill in the blanks in the program to complete the following task, using the register assignments shown in the comments at the top of the program.
Program task:
* This program concatenates an aggregate 16-bit result.
* The input array length is four.
* The input array location is variable. This value must be read out of Data Memory location 0.
* The output array should be stored in consecutive memory locations beginning in Data Memory location 0x10.
// Register assignments
// r0: the value 0
// r1: pointer to array data
// r2: loop counter (for loop structure)
// r3: current array element
// r4: mask
// r5: data
// r6: pointer to output array
//initialize registers
xor r0, r0, r0
ld r1, r0
ldi r2,_____
[ Select ]
["0","1","2","3","4","5","6","7"]
ldi r4,7
xor r5, r5, r5
ldi r6,_____
[ Select ]
["0","1","2","3","4","5","6","7"]
shl r6, r6
shl r6, r6
// read data from memory and mask
ld r3,_____
[ Select ]
["r0","r1","r2","r3","r4","r5","r6","r7"]
and r3, r3, r4
// concatenate and store result
or r5, r5, r3
st r6, r5
shl r4, r4
shl r4, r4
shl r4, r4
// for loop structure
inc r1,_____
[ Select ]
["r0","r1","r2","r3","r4","r5","r6","r7"]
inc r6,_____
[ Select ]
["r0","r1","r2","r3","r4","r5","r6","r7"]
dec r2,_____
[ Select ]
["r0","r1","r2","r3","r4","r5","r6","r7"]
brz r2,_____
[ Select ]
["-10","-8","-3","0","1","2","3"]
brz r0,_____
[ Select ]
["-19","-11","-4","0","1","2"]
// infinite loop (so program counter does not advance)
brz r0,______
[ Select ]
["-20","-12","-10","-5","0","1"]
This program is stored in Instruction Memory starting at address 0x00.
The initial contents of the following Data Memory locations are known. The contents of any location not listed in the table below are unknown prior to program execution.
Data Memory Address (in hex) Initial Contents (in hex)
00003
16A0E
22D85
39F4C
42A3B
501E9
68E14
73DDF
873B1
Trace the execution of the program using the Data Memory values in the table above. Determine the register contents after each instruction is executed.
Using these Data Memory values, how many processor cycles are required to execute this program entirely? (assume the instruction labeled "infinite loop" is only executed once.)
[ Select ]
["21","56","84"]
If the clock frequency is 50MHz, how long would this take to execute?
[ Select ]
["210","420","560","840","1120","1680"]
ns
After the entire program is executed, what will the following registers contain? (Give your answers in hex.)
Register Register contents (in hex)
R0[ Select ]["0000","0004","2A3B"]
R1[ Select ]["0000","0004","0007","0008","2A3B","3DDF","73B1", "Unknown"]
R2[ Select ]["0000","0004","2D85","2A3B","8E14", "Unknown"]
R3[ Select ]["0000","0004","0007","0C00","0E00","3DDF", "Unknown"]
R4[ Select ]["0000","0007","0070","0700","0E00","7000", "Unknown"]
R5[ Select ]["0001","0006","0007","01FC","0FFC", "Unknown"]
R6[ Select ]["0000","0010","0013","0014","0C2B", "Unknown"]
PC [ Select ]["0000","0014","0015","0020","0021", "Unknown"]
After the entire program is executed, what will the following Data Memory locations contain? (Give your answers in hex.)
Data Memory Location Contents (in hex)
0x0[ Select ]["0000","0001","0003"]
0x1[ Select ]["0000","0004","0006","6A0E"]
0x5[ Select ]["0001","0009","0010","01E9"]
0x10[ Select ]["0004","0007","000C","003C","0FFC","9F4C", "Unknown"]
0x11[ Select ]["0004","0007","000C","0010","003C","0FFC","2D85","01E9"]
0x12[ Select ]["0004",

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!