----------------------------------------------------------------------------
CDA3101 - Fall 2011 - Exam #2 Review
----------------------------------------------------------------------------
TOPICS WE HAVE COVERED IN ADDITION TO EXAM-1:
(Study these in Book and Web Notes)
2. ISA, Machine Language, and Number Systems
2.6. Pointers and Arrays
3.Computer Arithmetic
3.1. Arithmetic and Logic Operations
3.2. Arithmetic Logic Units and the MIPS ALU
3.3. Boolean Multiplication and Division
3.4. Floating Point Arithmetic
3.5. Floating Point in MIPS
4.Processors
4.1. The Central Processor - Control and Dataflow
4.2. Datapath Design and Implementation
4.3. Single-Cycle and Multicycle Datapaths
TYPES OF QUESTIONS:
- Short Answer (1-2 sentences - no dissertations, please)
- Computation (e.g., convert a binary number to its decimal value,
do signed or unsigned addition, subtraction, mul-
tiplication, or division)
- Programming (maybe one or two very simple MIPS code fragments,
on pointers and addressing only))
- Comparison For example, compare software and hardware features
of CISC vs. RISC...
EXAMPLE QUESTIONS: (answers in blue typeface)
* How are MIPS programs produced, and what type of code is
involved?
Answer: MIPS programs are produced in assembly language
by (a) a programmer using an editor, or (b) by a compiler
translating high-level programming language (HLL) to assembly.
An assembler translates the assembly language to object
code, which is combined with libraries by a linker, to
produce machine code. A loader or runtime module
puts the machine code into memory and saves the start address A
so execution can begin by loading A into the PC.
* What is the difference between assembly and object code?
Answer: Assembly code is written with pseudo-names for the
registers, text labels, and has the result register first
in the list of operands. The assembler resolves dependencies,
codes the register addresses in terms of numbers, and translates
the labels to addresses. If libraries are called, the dependencies
are resolved by the linker.
* What is a pointer, and what is it used for?
Answer: A pointer is an address that it is used to reference
data directly in memory.
* How is pointer arithmetic used in programming practice?
Answer: By incrementing or decrementing pointers, you can
efficiently access large amounts of data without actually
having to handle the parts of memory that store the data.
For example, instead of passing large arrays in the argument
list of a function (call-by-value), we pass the pointers to
the arrays (call-by-reference).
* How do load/store operations in MIPS relate to pointer arithmetic?
Answer: If x is a variable and p is a pointer, and you have the
C-like statement "p = &x", this is like fetching the address of
a memory element in MIPS. If you have "x = *p", that is like
a load operation in MIPS, because it says "the variable x contains
the data referenced by pointer (address) p." Conversely, if
you have "*p = x", that is like a store operation, since it
means "put the contents of x into memory at address p."
* How is the MIPS ALU and coprocessor used for floating point
arithmetic operations?
Answer: The MIPS ALU has some floating point instructions
(e.g., add.s, mul.d) in its ISA, but these are executed on
a coprocessor, which has floating-point hardware. Execution
of a floating point instruction involves (a) shipping the
data from the MIPS processor to the coprocoessor, (b) executing
the FP instruction on the coprocessor, and (c) returning the
result to the MIPS processor.
* How does Booth's algorithm for multiplication work, and why
is it used?
Answer: Booth's algorithm is designed for multiplication of
signed binary numbers. It uses a two-symbol classifier to
determine if the multiplier should be shifted, added, or
subtracted from the accumulated product. This algorithm
works only for two's complement arithmetic, since the leading
1 (or zero) in the partial multiplier induces the correspondingly
signed partial product, which is then added to the accumulated
product. The use of the current and next bits in the multiplier
help determine what the sign of the partial product should be.
* What is the IEEE 754 standard, and how is it used?
Answer: The IEEE 754 standard describes operand formats for
single- and double-precision floating-point arithmetic. The
standard is used to make FP operations on computers more
consistent, reliable, and accurate by having everyone adhere
to the standard in the design of FP libraries and programs
that use FP operations.
* What are denorms in IEEE 754, and why are they used?
Answer: Denorms are a special value in IEEE 754 FP standard
that allows one to express operands as small as 2-150.
These are necessary because the standard IEEE 754 single precision
notation only allows values as small as 2-126 to be
expressed. Here, we assume that absolute values are discussed.
Thus, denorms are a way of extending the precision of IEEE 754
numbers without extending the format to double precision. Denorms
can also be used for double precision numbers.
* Convert the unsigned number 101101 (base two) to decimal form.
Working upward (leftward) from the LSB, we have:
1 x 20 + 0 x 21 + 1 x 22
+ 1 x 23 + 0 x 24 + 1 x 25
= 1 + 0 + 4 + 8 + 0 + 32 = 4510
* Convert the twos complement number 101110 to decimal form.
There are six significant digits in the representation.
Therefore, the representation 101110 in twos complement
means:
-1 x 25 + 0 x 24 + 1 x 23
+ 1 x 22 + 1 x 21 + 0 x 20
= -32 + 0 + 8 + 4 + 2 + 0 = -32 + 14 = -1810
* Write a MIPS program to perform the following operation in
floating point (IEEE 754): y = 2*x + z^3, where
x and z are single-precision, and y is double-precision
Answer: Here is how the program is structured:
Step 1: Send x and z to the coprocessor
Step 2: On the coprocessor, multiply temp = z * z, and
check for overflow (using the hi and lo registers)
Step 3: On the coprocessor, multiply temp = temp * z, and
check for overflow (using the hi and lo registers)
Step 4: On the coprocessor, multiply temp2 = 2 * x, and
check for overflow (using the hi and lo registers)
Step 5: On the coprocessor, set y = temp2 + temp1, and
check for overflow (using the hi and lo registers)
Step 6: Get y from the coprocessor, and store it in the
MIPS processor's hi and lo registers
* What is the difference between a single- and multi-cycle datapath?
Why is a multi-cycle datapath typically faster?
Answer: A single-cycle datapath has CPI = 1 for all instructions,
since each instruction is performed in one cycle. A multi-cycle
datapath has potentially different CPI for each instruction, since
a given type of instruction can require different CPI to execute.
A multicycle datapath is typically faster than a single-cycle
datapath because the former can employ a fast clock, since its
hardware components dedicated to each cycle are small, and the
critical path through the components is relatively short. As
a result, the components take relatively little time to settle.
In contrast, the single-cycle datapath requires that all
instructions move at the speed of the slowest instruction, which
is determined by the longest path through the entire datapath.
The resultant asynchronous interaction between circuit components
causes the settling time to be much longer, which results in
a slower clock rate. The gains realized by setting CPI=1 in
the single-cycle datapath do not outpace the gains realized by
the faster clock rate in the multicycle case.
* What is an ISA and why is it important in processor design?
An instruction set architecture is the specification that
links the hardware structure and function to that of the
software. ISAs are important because they clarify processor
design and provide a convenient abstraction for hardware/
software interface design, analysis, and maintenance.
* Know how to solve the types of problems we did in class and
recitation re: CPUtime = IC x CPI x CycleTime. This is
*very* important. Hint: You might be asked to compute the
runtime of one or more MIPS programs that you write, as well
as discuss the work requirement in an arithmetic algorithm
such as Booth's algorithm for signed multiplication. So
practice on the exercises we used for Homework #3.
-EOF-