Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 10 pages
Exam (elaborations)

ECEN 350 PRELAB QUIZZES QUESTIONS

Document preview thumbnail
Preview 2 out of 10 pages

ECEN 350 PRELAB QUIZZES QUESTIONS

Content preview

ECEN 350 PRELAB QUIZZES QUESTIONS


Write down the representation of R- and I-format instructions. Explain the purpose of
each field in the instruction.

(fill in the large text box) - Answer -R-Format Instructions: opcode (6 bits), Rm (5 bits),
Shamt (6 bits), Rn (5 bits), Rd (5 bits)

opcode: the operation instruction
Rm: Source register, but the second operand
Shamt: Shift amount
Rn: Source register, but the first operand
Rd: Destination Register

EXAMPLE:ADD X1, X2, X3Translated as: X1 (Rd) = X2 (Rn) + X3 (Rm)
opcode: ADD = 10001011000 in binary
Rm: X3 = 00011 (3 in binary)
Shamt: 0 = 000000
Rn: X2 = 00010 (2 in binary)
Rd: X1 = 00001 (1 in binary)
Put it all together: 10001011000 00011 000000 00010 00001



I-format Instructions: opcode (10 bits), immediate (12 bits), Rn (5 bits), Rd (5 bits)

opcode: the operation instruction
immediate: the constant being added in the instruction
Rn: Source register
Rd: Destination Register

EXAMPLE: ADD X0, X0, #0x64
(Because there is a constant, we are using ADDI)
opcode: ADDI = 1001000100
immediate/"constant": #0x64 (this is in hex) = 000001100100
Rn: X0 = 00000
Rd: X0 = 00000
Put it all together: 1001000100 000001100100 00000 00000

For each of the following instructions, list the instruction format type:
SUB X1, X2, #4:
AND X1, X2, X3:
CBZ:
B:

, LDUR:
STURB:
(note: you will likely want to use the Green Sheet in your book to answer this)

(fill in SIX blanks) - Answer -I
R
CB
B
D
D

Write the binary encoding for the following instructions. Indicate the different fields in the
encoding by placing a space between them.
ADD X3,X2,X5:
ADD X3, X2, #40:
SUB X3,X5, X3:

(fill in THREE blanks) - Answer -10001011000 00101 000000 00010 00011

1001000100 000000101000 00010 00011

11001011000 00011 000000 00101 00011

Translate the following high-level code into assembly language.
Assume variables a − c are held in registers X0 - X2 and f − j are in X19 - X23

a=b-c;f=(g+h)-(i+j);

(fill in the large text box) - Answer -GIVENS:
a = X0; b = X1; c = X2
f = X19; g = X20; h = X21; i = X22; j = X23

SUB X0, X1, X2 (a = b - c)
ADD X1, X20, X21 (b = g + h)
ADD X2, X22, X23 (c = i + j)
SUB X19, X1, X2 (f = b - c)

Write an assembly program to swap the contents of 2 variables stored in registers
X4,and X5. If you need an extra register you may use X1.

(fill in the large text box) - Answer -EOR X1, X4, X5;
EOR X5, X1, X5;
EOR X4, X1, X5;

WORK:
if x1=00001, x4=00100, x5=00101:

Document information

Uploaded on
December 14, 2025
Number of pages
10
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$14.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
GEEKA
3.8
(364)
Sold
2149
Followers
1448
Items
59529
Last sold
17 hours ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions