0% found this document useful (0 votes)
21 views2 pages

TuongAnhKiet Assessing Exercises of Chapter 12

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

TuongAnhKiet Assessing Exercises of Chapter 12

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

12.1 What are the typical elements of a machine instruction?

Typical elements of a machine instruction include the operation code (opcode), which
specifies the operation to be performed; source operand references, which indicate the input
data for the operation; destination operand references, which specify where the result should
be stored; and, in some cases, next instruction references, which provide information about
the subsequent instruction to execute. These elements together allow the CPU to execute a
variety of operations on different data sets.

12.2 What types of locations can hold source and destination operands?

Source and destination operands can be held in various locations, including registers within
the CPU for fast access, main memory (RAM) for larger data storage, cache for
intermediate-speed access, and immediate or direct values embedded within the instruction
itself. These locations allow flexibility in how data is accessed and manipulated during
program execution.

12.3 If an instruction contains four addresses, what might be the purpose of each address?

In an instruction with four addresses, the addresses might serve the following purposes: the
first address could specify the location of the first operand (source), the second address
could specify the location of the second operand (source), the third address could indicate
the destination for the result, and the fourth address might be used for specifying the
address of the next instruction (often used in branching or looping constructs).

12.4 List and briefly explain five important instruction set design issues.

Five important instruction set design issues include:

1. Instruction Length: Determines the number of bits in an instruction, affecting complexity


and processing speed.
2. Number of Operands: Influences the flexibility and complexity of instructions; common
formats include zero, one, two, or three operands.
3. Addressing Modes: Provides various ways to specify operand locations, impacting
instruction complexity and flexibility.
4. Complexity vs. Speed: Balances the richness of instruction set (CISC) versus simplicity
and speed (RISC).
5. Orthogonality: Ensures that instructions are designed such that they do not restrict the use
of operands and addressing modes, promoting simplicity and flexibility.

12.5 What types of operands are typical in machine instruction sets?

Typical operands in machine instruction sets include addresses (specifying memory


locations), numbers (immediate values), characters (data to be processed), and logical data
(used for control purposes). These operands allow instructions to perform a wide range of
operations on various data types.

12.6 What is the relationship between the IRA character code and the packed decimal
representation?

The IRA (International Reference Alphabet) character code represents text characters using
a specific encoding scheme. Packed decimal representation, often used in financial
computations, stores two decimal digits per byte, utilizing a binary-coded decimal (BCD)
format. The relationship lies in how data is encoded and represented in memory, with both
methods converting between human-readable characters and machine-readable formats.
12.7 What is the difference between an arithmetic shift and a logical shift?

An arithmetic shift preserves the sign bit for signed binary numbers, making it suitable for
signed arithmetic operations. In contrast, a logical shift treats all bits uniformly, shifting them
left or right without regard for the sign bit, thus suitable for unsigned numbers and bit
manipulation. Arithmetic shifts are used for multiplication and division, while logical shifts are
used for bitwise operations.

12.8 Why are transfer of control instructions needed?

Transfer of control instructions, such as jumps, calls, and branches, are needed to alter the
normal sequential execution flow of a program. They enable the implementation of loops,
conditional execution, function calls, and exception handling, thus providing the flexibility
necessary for complex program structures and logic.

12.9 List and briefly explain two common ways of generating the condition to be tested in a
conditional branch instruction.

Two common ways to generate the condition for a conditional branch instruction are:

1. Status Flags: Use specific bits in a status register (e.g., zero flag, carry flag) that are set or
cleared based on the outcome of previous operations.
2. Comparison Instructions: Directly compare two values and set status flags accordingly,
providing conditions such as equal, not equal, greater than, or less than for branching
decisions.

12.10 What is meant by the term nesting of procedures?

Nesting of procedures refers to the ability of a procedure (or function) to call another
procedure, which can in turn call yet another procedure, and so on. This hierarchy allows for
modular and organized program structure, enabling complex tasks to be broken down into
simpler, reusable sub-tasks. Each nested call typically involves storing return addresses and
local variables on a stack.

12.11 List three possible places for storing the return address for a procedure return.

Three possible places for storing the return address for a procedure return are:

1. Call Stack: A dedicated stack structure where return addresses are pushed upon
procedure calls and popped upon returns.
2. Registers: Specific registers may be designated to hold return addresses, especially in
systems with register-based calling conventions.
3. Memory: Return addresses can be stored in a fixed or dynamically allocated memory
location, referenced during procedure returns.

You might also like