









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










Department of Electrical and Computer Engineering The University of Texas at Austin
EE 460N Spring 2011 Y. N. Patt, Instructor Faruk Guvenilir, Milad Hashemi, Yuhao Zhu, TAs Exam 1 March 9, 2011
Name:
Problem 1 (25 points):
Problem 2 (15 points):
Problem 3 (20 points):
Problem 4 (20 points):
Problem 5 (20 points):
Total (100 points):
Note: Please be sure that your answers to all questions (and all supporting work that is required) are contained in the space provided.
Note: Please be sure your name is recorded on each sheet of the exam.
Please sign the following. I have not given nor received any unauthorized help on this exam.
Signature:
Name:
Problem 1 (25 points)
Part a (5 points): The basic performance equation is:
P erf ormance =
x ∗ y ∗ z
Decreasing x, y, or z improves performance. What are x, y, and z.
x: y: z:
y and z are always at odds with each other: decrease y at the expense of z, and vice-versa. Explain why that is in 20 words or fewer.
Part b (5 points): The LC-3b data path shows a path that increments the PC by 2 and then loads the result into the PC. Some have been concerned that there is a problem since the incremented PC would then get incremented by 2 again, and again, continuously loading into the PC. Since this would happen many times during the clock cycle, by the end of the cycle the PC would contain PC + a big number. Why is this not a problem? Please answer in fewer than 20 words. An answer that simply names the structures that comprise the PC will receive zero points. A correct answer explains what happens and when.
Part c (5 points): The XYZ company decided to redesign the LC-3b to be big-endian. Assume this redesign. Show the contents of locations x3000 and x3001 if the machine language instruction corresponding to the assembly language instruction RSHFA R3,R2,#6 is stored there.
x x
Name:
Problem 2 (15 points)
XYZ Computer Company wants to produce the LC-3b, but wants to make it a 32 bit machine (i.e., address space is 32 bits, registers are 32 bits, data path to memory is 32 bits, the LC-32b bus is 32 bits, etc.), and implement unaligned accesses. LC-32b, they wish to call it. In this problem we consider the implementation of the store halfword instruction in the LC-32b,
StH R1, A
which stores the low 16 bits of register 1 into memory locations A, A+1. All the generic features of the LC-32b are the same as they were in the LC-3b.
Part a (3 points): Assume R1 = #-10 (xFFFFFFF6) before this instruction executes. After decode, what gets loaded into the 32-bit MDR?
Part b (3 points): Assume A = xA805. After decode, what gets loaded into MAR?
Part c (4 points): For an unaligned write, one needs combinational logic to determine WE0, WE1, WE2, and WE3. The combinational logic block is shown below:
Comb Logic WE
WE
WE
Data.Size WE
R.W
Y
Z
What are the two inputs Y and Z that are usually necessary to determine the write enable signals. Hint: Y is a two-bit value, Z is a one-bit value.
Part d (5 points): For the values of Data.Size, R.W, Y and Z that are relevant for the above example, complete the one or two rows of the truth table that indicate the WE signals that are asserted to accomplish the StH instruction.
Data.Size R.W Y Z WE3 WE2 WE1 WE Halfword Write Halfword Write
Name:
Problem 3 (20 points)
In this problem, we would like you to reconstruct the code that must have been executed by an out-of-order machine during cycles 0 through 23. The first instruction is fetched in cycle 0, the last instruction finishes in cycle 23.
The diagram below shows what is going on in each cycle, from cycle 0 through cycle 23.
x x x x x x x x x x
x x x x x
x x x x x x x x x x x x
x x x x
Cycles
x
Figure 1. Occupancy Chart.
The machine has a simple 4 stage pipeline. The stages are: fetch, decode, execute, and writeback. Fetch, decode and writeback take 1 cycle each. Execute takes a variable number of stages.
The execution unit has two adders and one multiplier. An ’x’ in the chart above indicates that the functional unit is busy during that cycle. Figure 2 shows the state of the machine after cycle 7. A ’?’ indicates that you will need to figure out what that value is.
Pos. 0
Pos. 1
V TAG VALUE V TAG VALUE DR
DR = Destination Register Tag V = Valid bit
7
17
1
1
?
15
a
a b
d
15 1
0
c
e
Pos. 0
Pos. 1
Pos. 2 Pos. 3
V TAG VALUEV TAG VALUE DR
1
1
1
0
−
V TAG VALUE R R R R R R R R
1 0
0
0
1 1 1 1
d f e
a
5 10
17
100 15
31
−
0
0
0
1
b
d
c
f
d
73
73
b
Figure 2. The state of the machine after cycle 7.
Name:
Problem 4 (20 points)
You have been given a black box containing a 1K by 16-bit-addressable memory system, and you are asked to figure out the organization of that memory – how many ranks, and the degree of interleaving. You are told that the memory is made up of 32 x 16 bit chips.
You are provided with a sequence of addresses to use as a memory access pattern, which is shown below in Table 1. Unaligned memory accesses are not allowed.
You can assume that the memory requests are generated successively, starting at cycle 0 and the memory controller sends each request to DRAM as quickly as it is able to. The results from this sequence of memory accesses is shown below in Table 2.
Table 1. Test addresses. Table 2. Test results.
Access Number Test Address 1 x 2 x2A 3 x2D 4 x2FE 5 x2AB 6 x0C 7 x0A 8 x
Cycle Number Sent Returned 0 x284 – 1 – – 2 – – 3 – – 4 x2A4 x 5 x2D1 – 6 x2FE – 7 x2AB – 8 x0C6 x2A 9 – x2D 10 – x2FE 11 – x2AB 12 x0A0 x0C 13 x115 – 14 – – 15 – – 16 – x0A 17 – x
The rank bits are guaranteed to start from the MSB and are contiguous. The interleaving bits are guaranteed to be contiguous as well.
What is the organization of the memory system? That is, please identify the rank bits and the interleave bits.
Rank bits: Interleave bits:
Explain your answer in the box below.
Name:
Problem 5 (20 points):
Many ISAs use packed data, wherein one 16-bit word contains two 8-bit values. It saves space. Your task here is to implement PACKED.OP, an instruction that performs ADD, AND, or XOR on bytes. We will use the unused opcode
PACKED.OP has the following format:
PACKED.OP 1 0 1 0 OP
15 12 11 9 8 7 6 5 0 DR/SR S X
Note that the two operands are the high and low byte of SR, and the sign-extended or zero-extended result is stored into DR. Note that SR and DR are the same register. Also, the S bit specifies whether to sign-extend (S=1) or zero-extend (S=0). OP specifies whether to ADD (00), AND (01), or XOR (10). Condition codes are set based on the result written to DR, as usual.
The function of X (bits[5:0]) will be left for you to figure out. ...later.
Example Assembler Formats
PACKED.ADDs SR1 ; sign extend PACKED.ANDz SR1 ; zero extend PACKED.XORz SR1 ; zero extend
Semantically, the instruction is processed as:
setcc();
We can implement PACKED.OP with only two additional microinstructions and a few changes to the data path. We have made the changes to the data path. We have left for you to identify certain information about the data path and also to generate the two new microinstructions. Pages 9 and 10 deal with the data path, page 11 deals with the two new microinstructions. For this problem, we can ignore overflow conditions.
Name:
Problem 5 continued:
Part a: Identify X, W, Y, Z. Note that your answers may be bits of the IR, existing control signals in the LC-3b, new control signals that may be added to the LC-3b, or arbitrary bit patterns. If you use any new control signals, call them ECS1, ECS2, ECS3, etc.
Part b: What does logic block A do? Note that logic block A doesn’t include a shifter.
For each control signal to logic block A, describe what the values 0 and 1 mean.
Control Signal 0 1
Name:
Problem 5 continued:
Part c: Two states (A,B) are needed to implement PACKED.OP. Fill in the operation for states A and B, and pick valid state numbers.
Part d: A relevant portion of the microinstructions for states A and B are shown below. Fill in the table with the appropriate values, and cross out the columns for the extra control signals if you did not use them.
LD.IR LD.BEN LD.REG LD.CC LD.PC LD.TEMP GatePC GateALU GateSHF PCMUX[1:0] DRMUX SR1MUX ALUK[1:0] ECS1 (if needed) ECS2 (if needed) ECS3 (if needed) ECS4 (if needed) A
B
Table 1: Data path control signals Signal Name Signal Values LD.MAR/1: NO(0), LOAD(1) LD.MDR/1: NO(0), LOAD(1) LD.IR/1: NO(0), LOAD(1) LD.BEN/1: NO(0), LOAD(1) LD.REG/1: NO(0), LOAD(1) LD.CC/1: NO(0), LOAD(1) LD.PC/1: NO(0), LOAD(1) GatePC/1: NO(0), YES(1) GateMDR/1: NO(0), YES(1) GateALU/1: NO(0), YES(1) GateMARMUX/1: NO(0), YES(1) GateSHF/1: NO(0), YES(1) PCMUX/2: PC+2(0) ;select pc+ 2 BUS(1) ;select value from bus ADDER(2) ;select output of address adder DRMUX/1: 11.9(0) ;destination IR[11:9] R7(1) ;destination R SR1MUX/1: 11.9(0) ;source IR[11:9] 8.6(1) ;source IR[8:6] ADDR1MUX/1: PC(0), BaseR(1) ADDR2MUX/2: ZERO(0) ;select the value zero offset6(1) ;select SEXT[IR[5:0]] PCoffset9(2) ;select SEXT[IR[8:0]] PCoffset11(3) ;select SEXT[IR[10:0]] MARMUX/1: 7.0(0) ;select LSHF(ZEXT[IR[7:0]],1) ADDER(1) ;select output of address adder ALUK/2: ADD(0), AND(1), XOR(2), PASSA(3) MIO.EN/1: NO(0), YES(1) R.W/1: RD(0), WR(1) DATA.SIZE/1: BYTE(0), WORD(1) LSHF1/1: NO(0), YES(1)
Table 2: Microsequencer control signals Signal Name Signal Values J/6: COND/2: COND 0 ;Unconditional COND 1 ;Memory Ready COND 2 ;Branch COND 3 ;Addressing Mode IRD/1: NO, YES
R
PC<−BaseR
To 18
12
To 18
To 18
R R
To 18
To 18
To 18
MDR<−SR[7:0]
MDR <− M
IR <− MDR
R
DR<−SR1+OP2* set CC
DR<−SR1&OP2* set CC
[BEN]
PC<−MDR
32
1
5
0 0 1 To 18
To 18 (^) To 18
R R
[IR[15:12]]
28
30
R7<−PC
MDR<−M[MAR]
set CC
BEN<−IR[11] & N + IR[10] & Z + IR[9] & P
9 DR<−SR1 XOR OP2*
4
22
To 11
1011
JSR
JMP
BR
1010 To 10
21
20
0 1
LDB
MAR<−B+off
set CC
To 18
MAR<−B+off
DR<−MDR set CC
To 18
MDR<−M[MAR]
25
27
2 6 7 3
LEA STW STB SHF
TRAP
XOR
AND
ADD
RTI To 8
set CC
set CC
DR<−PC+LSHF(off9, 1)
14
LDW
MAR<−B+LSHF(off6,1) MAR<−B+LSHF(off6,1)
PC<−PC+LSHF(off9,1)
33
35
DR<−SHF(SR,A,D,amt4)
NOTES B+off6 : Base + SEXT[offset6] R
MDR<−M[MAR[15:1]’0]
DR<−SEXT[BYTE.DATA]
R
29
31
18, 19
MDR<−SR
To 18
R R
M[MAR]<−MDR
16
23
R R
17
To 19
24
M[MAR]<−MDR**
MAR<−LSHF(ZEXT[IR[7:0]],1)
To 18 15
PC+off9 : PC + SEXT[offset9]
MAR <− PC PC <− PC + 2
*OP2 may be SR2 or SEXT[imm5] ** [15:8] or [7:0] depending on MAR[0]
[IR[11]]
PC<−BaseR
PC<−PC+LSHF(off11,1)
R7<−PC
R7<−PC
13
Figure 3: A state machine for the LC-3b
IRD
Address of Next State
6
6
0,0,IR[15:12]
J[5]
Branch Ready^ Mode
Addr.
J[2] J[1] J[0]
COND1 COND
J[4] J[3]
BEN R IR[11]
Figure 5: The microsequencer of the LC-3b base machine