0% found this document useful (0 votes)
18 views4 pages

HW1 Sol

Uploaded by

5z6r72
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

HW1 Sol

Uploaded by

5z6r72
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CENG3420 Homework 1

Due: Feb. 15, 2023

Solutions
All solutions should be submitted to the blackboard in the format of PDF/MS Word.

Q1 (10%) This is a question about integrated circuit cost. Assume that a wafer contains 4096
dies and a die has 0.125 defects on average, please answer the following sub-questions.

1. Calculate the yield of this wafer. (5%)


2. Assume that you wanted to spend 8 millions HKD on manufacturing, how much
money can you save for manufacturing the same number of dies if the average defects
of a die can be reduced to 0.1? (5%)

A1 These are suggested solutions.

1.
1
Yield = Defects per area×Die area 2
(1)
(1 + 2
)
We have known that a die has 0.125 defects on average. Thus, Defects per area ×
1
Die area = 0.125 and Yield = (1+ 0.125 )2
= 0.8858.
2

2. Before optimization,
Cost per wafer Cost per wafer
Cost per die = = . (2)
Dies per wafer × Yield Dies per wafer × 0.8858
After optimization,
1 1
Yield = = = 0.9070. (3)
(1 + Defects per area×Die area 2
2
) (1 + 0.1
2
)2

Cost per wafer Cost per wafer


Cost per die = = . (4)
Dies per wafer × Yield Dies per wafer × 0.9070
The saved money is 8M ∗ ( 0.9070
0.8858
− 1) = 0.19M . You can save 190k HKD.

Q2 (5%) Sort the computational performance of the following computers (from low to high):

1. Embedded computer
2. Personal computer
3. Mobile phone
4. Quad-CPU Server
5. Warehouse scale computer

A2 (1) < (3) < (2) < (4) < (5)

1
Q3 (5%) Suppose we developed a new processor that has 75% of the capacitive load of the
older processor. Further, it can reduce voltage 15% compared to previous generation,
which results in a 15% shrink in frequency. What is the impact on dynamic power? Give
Powernew
the ratio of .
Powerold

A3 0.4606
1
Power = × α × Capacitive load × Voltage2 × Frequency switched (5)
2
The power ratio between the new one and the old one is 0.75 × 0.852 × 0.85 = 0.4606.

Q4 (20%) We have an int (32 bits) array named arr0. The pointer of arr0’s first element
stored in register a1. Please answer the following questions.

1. How to put the fourth element of arr0 to register t1? (5%)


2. How to calculate t1 + 16? Please store the result in register t2 (5%)
3. Find an efficient way to calculate t2 /16 and t2 %16. Please store the results in
t3 and t4, respectively. Note that / is an integer division and % is the modulo
operation. (hint: using shift and logical operations) (10%)

A4 1. lw t1, 12(a1)
2. addi t2, t1, 16
3. t2 /16: srli t3, t2, 4; t2 %16: andi t4, t2, 0x0F.

Q5 (20%) We have an int (32 bits) array named arr1. The pointer of arr1’s first ele-
ment stored in register a2. We also have the registers t1 = 0xAAAAAAAA, t2 =
0xFEDCBA98
Please answer the following questions:

1. For the register values shown above, what is the value of t3 for the following
sequence of instructions? (5%)
slli t3, t1, 4
srli t3, t3, 4

2. What is the value of t3 for the following sequence of instructions? (5%)


slli t3, t2, 3
srai t3, t3, 3

3. Write a piece of assembly program to: (10%)


• Store the result of t1 & t2 to register t4; (3%)
• Store t4 to the first element of arr1; (3%)
• Store the lowest 8 bits of t4 to the second element of arr1. (4%)

A5 1. 0x0AAAAAAA
2. 0xFEDCBA98

2
3. Results:
• and t4, t1, t2
• sw t4, 0(a2)
• sb t4, 4(a2)

Q6 (20%) Consider the following RISC-V instructions:


li t1, 0
li t2, 1
li t3, 1
li t4, 10
LOOP:
beq t1, t4, DONE
add t5, t2, t3
addi t2, t3, 0
addi t3, t5, 0
addi t1, t1, 1
jal x0, LOOP
DONE:
# end of the program

1. How many times is the loop executed (between LOOP and DONE)? (5%)
2. List the value of t2 at each loop iteration. (5%)
3. List the value of t3 at each loop iteration. (5%)
4. What does this program do? (5%)

A6 1. 10
2. {1, 2, 3, 5, 8, 13, 21, 34, 55, 89}
3. {2, 3, 5, 8, 13, 21, 34, 55, 89, 144}
4. Calculating the Fibonacci sequence.

Q7 (20%) Write RISC-V instructions to implement the following functionalities.

1. t2 = t1 ∗ 4 + 7 (5%)
2. t3 = (t1 + t2)%16 (5%)
3. t2 = t1! (hint: assume multiply instruction mul is available) (10%)

A7 1.

slli t2, t1, 2


addi t2, t2, 7

2.

3
add t3, t1, t2
andi t3, t3, 0x0F

3.

li t3, 0
li t2, 1
LOOP:
beq t1, t3, DONE
mul t2, t2, t1
addi t1, t1, -1
jal x0, LOOP
DONE:

You might also like