final-2021-solution
.pdf
keyboard_arrow_up
School
University of British Columbia *
*We aren’t endorsed by this school
Course
295
Subject
Computer Science
Date
Jan 9, 2024
Type
Pages
26
Uploaded by qqsunrain66
HONOR CODE
I have not used any online resources during the exam.
I have not obtained any help either from anyone in the class or outside when completing this exam.
No sharing of notes/slides/textbook between students.
NO SMARTPHONES.
CANVAS ANSWERS MAY BE LOCKED AFTER 1ST TRY.
Questions Sheet.
Read all of the following information before starting the exam:
For each question fill out the appropriate choice or write text on Canvas page. Also type clearly on
in the exam on the appropriate text.
IF THE MULTIPLE CHOICE ANSWER IS WRONG WE WILL MARK THE ANSWER WRONG. IF THE
MULTIPLE-CHOICE ANSWER IS CORRECT, WE WILL READ THE WRITTEN PORTION.
Show all work, clearly and in order, if you want to get full credit.
I reserve the right to take off points if I cannot see how you logically got to the answer (even if your
final answeris correct).
Circle or otherwise indicate your final answers.
Please keep your written answers brief; be clear and to the point.
I will take points off for rambling and for incorrect or irrelevant statements. This test has six
problems.
HONOR CODE
Questions Sheet.
Section Virtual Memory 17 points. Canvas Q1-Q31
Common questions. Canvas Q1-Q2
For the virtual address 0x11a39 answer the following Canvas Q3-Q12. (0.5 pt each)
For the virtual address 0xab6e7 answer the following. Canvas Q13-Q22 (0.5 pt each)
c. For the following virtual address 0x02974 answer the following (Canvas: 23-32) (0.5 pt each)
B. Easy. RISCV Blackbox. [10 Points]
33. What is the value of the registers a0,a1, a2 on line 5: CHECK ? (show your working and
explain your answer). Write down in hex [5]
34. Lets say message* is now a 2 character string "J-". The value of a2 on line 5:CHECK is 0.
What is the mystery character "-". It has to be an ascii character between '0'--'9' (note not
value 0-9). ? Write down the digit. [5]
C. Lets Cache I (10pts)
35. What is the number of tag bits in Cache-A and Cache-B ? (1pt)
36. What is the number of index bits in Cache-A and Cache-B ? (1pt)
37. What is the number of offset bits in Cache-A and Cache-B ? (1pt)
38. What is the hit rate for Cache-A and Cache-B for loop 1? What types of misses do we get?
(2 pts)
39. What is the hit rate for Cache-A and Cache-B when you execute loop 2? (5 pts)
D. Lets Cache II (10pts)
40. What is the bits for virtual address? (1)
41. What is the bits for physical address? (1)
42. Which associativity below will maximize cache size while maintaining the same
Tag:Index:Offset? (1)
43. Which block size below will maximize cache size while maintaining the same
Tag:Index:Offset? (1)
44. Assuming associativity and block size from questions 42 and 43 what is the number of
blocks? (1)
45. Now we’re working with a direct mapped cache with same TIO and block size as 43. What
is miss rate for code below (3)
46. You add an L2 and shrink the L1. L1 hit latency is 3 cycles. L2 hit latency is 50 cycles. L2 hit
rate is 90%. L1 hit rate is 25%. Memory is 100 cycles What is AMAT ? (2)
F. RISC-V Single Cycle Datapath
47. What is the number of register that beqjalr needs to read and write in a single cycle ? (1)
48. What is the RegWEn signal ? (1)
49. What is the branch comparison signal we are interested in? (1)
50. Which fields are passed to the branch comparison ? (1)
51. What is the logic for beqjalr signal ? (1)
52. Consider the following modifications to the Reg[] register file. (2)
53. What are the inputs to the register file ? (2)
54. What are the inputs to the ALU ? (1)
55. What are the changes to mux-A ? (2)
56. What are the changes to mux-B ? (2)
57. For beqjalr instruction signal does WBsel choose ? (2)
58. What are the changes to the writeback stage ? (2)
E. RISC-V Pipeline 12 points.
59. What hazards existing between instruction 1 and 2 ? (1)
60. What hazards existing between instruction 2 and 3 ? (1)
61. What hazards existing between instruction 3 and 4 ? (1)
62. What hazards existing between instruction 4 and 5 ? (1)
63. How many cycles does instruction 2 stall for ? (2)
64. How many cycles does instruction 3 stall for ? (2)
65. How many cycles does instruction 4 stall for ? (2)
66. How many cycles does instruction 5 stall for ? (2)
G. Lets RISC-V II 10 points
67. We are designing a new RISC-V instruction with 16 registers. Assuming that you use the
extra bits to extend the immediate field, what is the range of half-word
instructions that can
be reached using a branch instruction in this new format? (2)
66- refer code below
68. What is the PC address of instruction 4:beq
(hex) ?
69. What is the PC address of instruction 9:addi
(hex) ?
70. What is the PC address of instruction 12:ecall
(hex) ?
71. What is the PC address of instruction 14:mul
(hex) ?
72. What is the machine code for instruction at address 0x1C (hex) ? (2)
73. After the first pass of the assembler instruction at 0d20 does not have the label resolved. (1)
74. After the first pass of the assembler instruction at 0d28 does not have the label resolved. (1)
Section Virtual Memory 17 points. Canvas Q1-Q31
Refer slide deck L21-VM-III Week 8 if you need to.
The chart below shows how memory accesses are treated in a system. The table below describes the
parameters int he memory system. Please use the data below to answer question groups Q1,Q2,Q3,Q4 on canvas.
CAUTION: When converting from binary to hex you can always pad the MSB
e.g., 10 1010 (6 bit field) in hex is 0010 1010 (2 0s padded in MSB)
is 0x2a
.
Parameter
Value
Physical address bits
16
Size of page
256 bytes
Virtual address bits
20
-------------------------
---------------------
TLB Sets
4
TLB Ways
2
TLB Size
8 entries
-----------------------
-------------------
Parameter
Value
Cache block
8 bytes
Cache size
64 bytes
Cache Sets
8
Cache Ways
1
Terminology
VPN - Virtual page number
Index (Set index of cache or TLB)
PPN - Physical page number
INVALID. TLB entry is invalid
TLB-T (TLB Tag)
TLB
Way 0
PPN
Index:0 TLB-T:[0x69]
---
Index:1 TLB-T:[0x396]
---
Index:2 TLB-T:[0x46]
eb
Index:3 TLB-T:[0x29c]
4a
Way 1
0
Index:0 TLB-T:[0x3b]
---
Index:1 TLB-T:[0x010]
88
Index:2 TLB-T:[0x2ad]
4b
Index:3 TLB-T:[0x6]
dc
Page Table (Partial)
CAUTION: Only partial table relevant to the questions are shown.
VPN
PPN
Valid
0x1a4
---
0
VPN
PPN
Valid
0xe59
---
0
0x11a
0xeb
1
0xa73
0x4a
1
0xec
0x00
1
0x29
0x12
1
0xab6
0x4b
1
0x1b
0xdc
1
0x8ff
0x91
1
0xbf1
0x47
1
0x016
0x99
1
0x010
0x88
1
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Sir please make use case diagram about consumer and chicken breeder application. In this app, consumer can buy chicken meat and chicken egg from the chicken breeder. The chicken meat and chicken egg will be delivered from the breeder to the consumer via online courier. Please Sir. Please. Thank you.
arrow_forward
Hi we're allowed to ask at least 3 questions per question, please answer the second one at least
arrow_forward
q5
Sometimes, you want to show the button, but
gray out the button by setting this property to
False.
Group of answer choices
Size
Location
Enabled
Locked
arrow_forward
Fill in the blank
When the markdown is added to the selling price, you may determine the price of an item. (clue 8 letters)
arrow_forward
If you don't see me on Facebook for 48
hours, immediately call the police.
Which if clause this (zero, first,
second or third)
arrow_forward
True or False The form’s title is displayed in the bar along the top of a form.
arrow_forward
The Paste Special dialog box offers the ____ option, which enables you to copy and paste a cell range that contains one or more blank cells where the blank cells are not pasted over any existing values in the range into which they are pasted.
arrow_forward
Box in create 3D commands
Will allow you to create a 3D box by selecting 20
.points in the X, Y
Will allow you to create a 3D box by selecting 30
.points in the X, Y, and Z axes
Will allow you to create a 2D box by selecting 30
.points in the X, Y, and Z axes
arrow_forward
4. Click the help icon
arrow_forward
After lunching the App, the user will need to enter information about each of the vehicles in the garage. This includes entering the lot numbers that identifies a vehicle, the year, and the vehicle make and model, Millage, Engine Capacity and Price, entering information for each extra including ID, Name, Type (interior or Exterior). To conduct a sale the application users selects from among the list of vehicles and extras to add to a receipt. The app must not allow an extra into a receipt until at least one vehicle is inserted. When the a vehicle and extras is inserted into a receipt, the app must calculate:Page 4 of 8 Subtotal: use a function to compute this as the price less the amount of discount (if any) plus the cost of extras (if any). Sales Tax: Regular customers must pay a state sales tax on their purchase. The tax rate is 5% and is computed on the subtotal. Wholesale dealers purchasing a vehicle do NOT pay any sales tax. This must be computed using a function. Total due:…
arrow_forward
What is the purpose of comments in your code? Please provide a few examples of when you should use a comment.
arrow_forward
please quickly thanks ! true or false
9.The uplink is the base station to the mobile phone direction and the downlink is the mobile phone to the base station.
arrow_forward
Directions: The column on the left tells what to search for. On the second column, you
will write on the search box what will you type to achieve the task. Apply the use of
symbols and tip you've learned. The first one is done for you. Write your answer on a
separate sheet of paper.
Task
Search Term
Find web pages
Google Atlantis continent
that have...
all these words:
Atlantis continent
Google Atlantis continent –shuttle -film –movie
But don't show pages
that have..any of
these unwanted
words: shuttle film
movie
Find web pages
Google
that have...
all these words:
| Atlantis
Find web pages
Google
that have...
all these words:
Waterbury
But don't show pages
that have... any of
Google
these unwanted
words: Connecticu t
CT
Find web pages
Google
that have..
all these words:
Waterbury
this exact wording or
Google
phrase: San Diego
State University
Find web pages
Google
that have..
the song title of this
lyrics: Mama
"something'
arrow_forward
Tasks:
Design the Pseudo Code.
Draw the Flow Chart.
An ATM allows a customer to withdraw a maximum of $500 per day. If a customer withdraws more than $300, the service charge is 4% of the amount over $300. If the customer does not have sufficient money in the account, the ATM informs the customer about the insufficient fund and gives the option to withdraw the money for a service charge of $25.00. If there is no money in the account or if the account balance is negative, the ATM does not allow the customer to withdraw any money. If the amount to be withdrawn is greater than $500, the ATM informs the customer about the maximum amount that can be withdrawn.
Design pseudo code and flowchart that allows the customer to enter the amount to be withdrawn. It then checks the total amount in the account, dispenses the money to the customer, and debits the account by the amount withdrawn and the service charges, if any.
arrow_forward
the comments explanation is incomplete, ypu didnt provide explanation for each line, you skipped many
arrow_forward
Default settings control how the screen is set up and how a document looks when you first start typing.
True
O False
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Related Questions
- Sir please make use case diagram about consumer and chicken breeder application. In this app, consumer can buy chicken meat and chicken egg from the chicken breeder. The chicken meat and chicken egg will be delivered from the breeder to the consumer via online courier. Please Sir. Please. Thank you.arrow_forwardHi we're allowed to ask at least 3 questions per question, please answer the second one at leastarrow_forwardq5 Sometimes, you want to show the button, but gray out the button by setting this property to False. Group of answer choices Size Location Enabled Lockedarrow_forward
- Fill in the blank When the markdown is added to the selling price, you may determine the price of an item. (clue 8 letters)arrow_forwardIf you don't see me on Facebook for 48 hours, immediately call the police. Which if clause this (zero, first, second or third)arrow_forwardTrue or False The form’s title is displayed in the bar along the top of a form.arrow_forward
- The Paste Special dialog box offers the ____ option, which enables you to copy and paste a cell range that contains one or more blank cells where the blank cells are not pasted over any existing values in the range into which they are pasted.arrow_forwardBox in create 3D commands Will allow you to create a 3D box by selecting 20 .points in the X, Y Will allow you to create a 3D box by selecting 30 .points in the X, Y, and Z axes Will allow you to create a 2D box by selecting 30 .points in the X, Y, and Z axesarrow_forward4. Click the help iconarrow_forward
- After lunching the App, the user will need to enter information about each of the vehicles in the garage. This includes entering the lot numbers that identifies a vehicle, the year, and the vehicle make and model, Millage, Engine Capacity and Price, entering information for each extra including ID, Name, Type (interior or Exterior). To conduct a sale the application users selects from among the list of vehicles and extras to add to a receipt. The app must not allow an extra into a receipt until at least one vehicle is inserted. When the a vehicle and extras is inserted into a receipt, the app must calculate:Page 4 of 8 Subtotal: use a function to compute this as the price less the amount of discount (if any) plus the cost of extras (if any). Sales Tax: Regular customers must pay a state sales tax on their purchase. The tax rate is 5% and is computed on the subtotal. Wholesale dealers purchasing a vehicle do NOT pay any sales tax. This must be computed using a function. Total due:…arrow_forwardWhat is the purpose of comments in your code? Please provide a few examples of when you should use a comment.arrow_forwardplease quickly thanks ! true or false 9.The uplink is the base station to the mobile phone direction and the downlink is the mobile phone to the base station.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE LNp Ms Office 365/Excel 2016 I NtermedComputer ScienceISBN:9781337508841Author:CareyPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:9781337508841
Author:Carey
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning