Ca2324 hw3 Questions
Ca2324 hw3 Questions
Note: You are required to use the LATEX template provided on Brightspace.
Address 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
x3000 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0
x3001 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0
x3002 0 1 0 1 0 1 1 0 1 1 1 0 0 0 0 0
x3003 0 0 0 1 0 1 1 0 1 1 0 0 0 0 0 1
x3004 0 0 0 1 0 1 0 0 1 0 1 1 1 1 1 1
x3005 0 0 0 0 1 0 1 1 1 1 1 1 1 1 0 1
x3006 1 1 1 1 0 0 0 0 0 0 1 0 0 1 0 1
x3007 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
x3008 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0
Table 1
PC R1 R2 R3 R4 R5
x3004 is executed the 1st time ? ? ? ? ? ?
At the end of the program ? ? ? ? ? ?
Table 2
Question 2 (5 points)
The memory addressability is 64 bits. What does this tell you about the size of the MAR and
MDR?
1
Computer Architecture Homework 3
where DR is the Destination Register, SR1 is Source Register 1, and SR2 is Source Register 2.
Assuming that there are 300 opcodes, answer the following questions.
b) What is the maximum number of registers in this architecture? Motivate your answer.
c) If we use the maximum number of registers for DR, SR1 and SR2 fields in the IR format, what
is the number of UNUSED bits in this architecture? Clarify your answer.
c) Using only one LC-3 instruction and without changing the contents of the register, how might
one set the condition codes based on the value that resides in R1?
d) Is there a sequence on LC-3 instructions that will cause the condition codes at the end of the
sequence to be both N=1, Z=1 and P=0? Explain.
Question 5 (5 points)
In Figure 1, the content of some of the memory locations is provided. The content of the relevant
LC-3 registers are also shown. What are the contents of register R1 and the NZP flags after the
instruction pointed by the PC is executed?
2
Computer Architecture Homework 3
Figure 1
Table 3
Preparation
Make sure you have LC3Tools installed. If you have not done this yet, or do not know how to do
this, consult the LC3 guide on Nestor.
3
Computer Architecture Homework 3
As you might have noticed, there is another file on Brightspace called ca2324 hw3 skeleton.asm.
This file will serve as a template for this assignment. Open the file in LC3Tools.
Description
In this assignment you will closely monitor the contents of all registers R0 to R7 while running the
code we provided below. At this point, the provided code template should be opened in LC3Tools.
We highly recommend you to type over the code into the template, rather than copy pasting it.
You can test if you have written the code correctly by submitting the .asm file to Themis (at
LC-3: Basic Multiplication) and check if it passes.
Once you are done writing the code, press the “Assemble” button at the top right. As explained
in Tutorial 2, you can now run the code line-by-line using the “step in” button, or run it normally
using the “run” button.
In the solution template of this assignment, you will find a table. This table should be filled
in and contain the following rows:
• One row for the state of the registers before the loop starts
• One row for the state of the registers after each iteration of the loop
Before you run the code, try to answer this question: how many rows do you think you
will end up with in your table?
After you are done running the code, make sure that you fill in the table in the template (ob-
viously reporting the actual values from ALL eight registers, for ALL iterations of the loop)!