Computer Organization and Design Chapter 2 ) (Solved Questions 100% VERIFIED QUESTIONS AND ANSWERS)
4 views 0 purchase
Course
Computer Organization and Design Chapter 2
Institution
Computer Organization And Design Chapter 2
instruction set >>> the repertoire of instructions of a computer
instruction sets are (the same/different) across computers >>> different
instruction sets in early computers were... >>> simple
instruction sets in many modern computers are... >>> simple...
Computer Organization and Design
Chapter 2
instruction set >>> the repertoire of instructions of a computer
instruction sets are (the same/different) across computers >>> different
instruction sets in early computers were... >>> simple
instruction sets in many modern computers are... >>> simple
what is LEGv8? >>> a subset of the ARMv8 instruction set
a large share of the embedded core market uses what type of instruction set? >>> LEGv8
add and subtract have how many operands? >>> 3
what is the LEGv8 instruction for adding b+c and saving the value into a? >>> ADD a, b, c
every arithmetic operation has 3 operands, following which design principle? >>> principle 1: simplicity
favors regularity
translate the following C code into compiled LEGv8 code:
f = (g+h) - (i+j) >>> ADD t0, g, h
ADD t1, i, j
ADD f, t0, t1
arithmetic instructions use which kind of operands? >>> register operands
what kind of register file does LEGv8 have? >>> a 32 x 64 bit register file
what is 64 bit data called in LEGv8? >>> doubleword
what is 32 bit data called in LEGv8? >>> word
X0 to X30 are what kind of registers? >>> 64-bit general purpose registers
X0 to W30 are what kind of registers? >>> 32-bit general purpose sub-registers
which design principle supports only having 32 registers? >>> principle 2: smaller is faster
X0-X7 are... >>> procedure arguments/results
x8 is the... >>> indirect result location register
,X9-X15 are... >>> temporaries
X16-X17 (IP0-IP1) may be... >>> used by linker as a scratch register, other times as temporary register
X18 >>> platform register for platform independent code; otherwise a temporary register
X19-X27 >>> saved
X28 is the... >>> stack pointer
what does SP stand for? >>> stack pointer
what does FP stand for? >>> frame pointer
X29 is the >>> frame pointer
X30 is the >>> link register (return address)
what does LR stand for? >>> link register
XZR or X31 is... >>> the constant value 0
using register operands, what is the following C code compiled in LEGv8 code?
f = (g+h) - (i+j)
(where f..., j are in X19, X20..., X23) >>> ADD X9, X20, X21
ADD X10, X22, X23
SUB X19, X9, X10
the main memory is used for which type of data? >>> composite data
what are 3 examples of composite data? >>> arrays, structures, dynamic data
what are the 2 steps to apply arithmetic operations to data in memory? >>> load values from memory
into registers, store result from register to memory
how is memory addressed? >>> in bytes
each address in memory identifies an... >>> 8-bit byte
LEGv8 (does/does not) require words to be aligned in memory >>> does not (except for instructions
and the stack)
, what is the compiled LEGv8 code of this C code?
A[12] = h + A[8]
(where h is in X21, and the address of A is in X22) >>> LDUR X9,[X22,#64]
ADD X9,X21,X9
STUR X9,[X22,#96]
assuming you want to load the value in the array A at index 8, what should you pass to the LEGv8 LDUR
instruction?
(assume the address of A is X22, and you are loading into X9) >>> X9, [X22, #64] (an index of 8 requires
an offset of 64)
which are faster to access, registers or memory? >>> registers
operating on memory data requires... >>> loads and stores
using loads and stores means (more/less) instructions are executed >>> more
when must the compiler use registers for variables? >>> as much as possible
when does the compiler use memory for variables? >>> only when the variables are less frequently
used
ADDI represents what kind of instruction? >>> addition with a constant (or "immediate")
constant/immediate operands are supported by which design principle? >>> principle 3: make the
common case fast
the range of an unsigned int using 32 bits >>> 0 to 4,294,967,295 (2^n -1)
the range of a signed int using 32 bits >>> -2,147,483,648 to 2,147,483,647 (-2^(n-1) to 2^(n-1) -1)
which bit is the "sign" bit? >>> bit 31
in 2s complement, does 1 or 0 represent negative? >>> 1
in 2s complement, does 1 or 0 represent positive? >>> 0
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller johnlynn297. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $9.65. You're not tied to anything after your purchase.