0% found this document useful (0 votes)
61 views

Assignment 4

This document summarizes key concepts about machine instructions and addressing modes from Chapter 12 and 13 of the textbook: 1) Machine instructions typically contain opcodes, source and destination operand references, and references to the next instruction. Operands can be stored in memory, registers, or specified as immediate values. 2) Important issues in instruction set design include the operations provided, data types supported, instruction format, use of registers, and addressing modes for specifying operands. 3) Addressing modes determine how the effective address of an operand is calculated from information contained in the instruction and registers/memory. Common modes include immediate, direct, indirect, register, register indirect, displacement, and relative addressing. 4)

Uploaded by

Muhammad Umair
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

Assignment 4

This document summarizes key concepts about machine instructions and addressing modes from Chapter 12 and 13 of the textbook: 1) Machine instructions typically contain opcodes, source and destination operand references, and references to the next instruction. Operands can be stored in memory, registers, or specified as immediate values. 2) Important issues in instruction set design include the operations provided, data types supported, instruction format, use of registers, and addressing modes for specifying operands. 3) Addressing modes determine how the effective address of an operand is calculated from information contained in the instruction and registers/memory. Common modes include immediate, direct, indirect, register, register indirect, displacement, and relative addressing. 4)

Uploaded by

Muhammad Umair
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Assignment4

Chapter 12:
12.1 What are the typical elements of a machine instruction?
Opcodes, source operand reference, result operand reference and next
instruction reference .

12.2 What types of locations can hold source and destination operands?
Main memory, processor register, immediate , I/O device .

12.3 If an instruction contains four addresses, what might be the


purpose of each address?
The purpose could be to access or store information in memory or registers, or
to hold data from arithmetic operations .

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

Operation repertoire: How many and which operations to provide, and how
complex operations should be.

Data types: The various types of data upon which operations are performed.

Instruction format: Instruction length (in bits), number of addresses, size of


various fields, and so on.

Registers: Number of CPU registers that can be referenced by instructions, and


their use.

Addressing: The mode or modes by which the address of an operand is


specified.

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


Addresses, numbers, characters, and logical data .
12.7 What is the difference between an arithmetic shift and a logical
shift?
In a logical shift, the bits of a word are shifted left or right. On one end, the bit
that is shifted out is lost, while on the other end a zero is added in. With
arithmetic shift, treats the data as a signed integer and does not shift the sign
bit. On a right shift, the sign bit is replicated into the bit position to its right,
while with a left shift, a logic shift is performed on all bits but the sign bit .

12.8 Why are transfer of control instructions needed?


They are required for looping (allowing for repeated calls to instructions), allow
for decision making, and it allows for breaking up programs into smaller pieces
for easier programming .

12.10 What is meant by the term nesting of procedures?


Compare zero-, one-, two-, and three-address machines by writing
programs to compute
X = (A + B * C)/(D - E * F)
for each of the four machines. The instructions available for use are as
follows:

Being able to call a procedure from within a procedure


Chapter 13:
13.1 Briefly define immediate addressing.
-value of operand is in the instructions
Operand = A
A: contents of address field in the instructions

13.2 Briefly define direct addressing.


-Effective address = Address field in instructions
EA = A
EA: effective address of the location containing the reference operand

13.3 Briefly define indirect addressing.


-Effective address = contents of memory in)?(
EA = (x)
or
EA = (A)
(x): contents of memory location x or register x
In this case, (A), contents of A.

13.4 Briefly define register addressing.


-Effective address = address field in instruction of register R
EA = R

13.5 Briefly define register indirect addressing.


-Effective address = contents in memory of register R
EA = (R)

13.6 Briefly define displacement addressing.


-Effective address = address field in instruction + contents in memory of
register R
EA = A + (R)
13.7 Briefly define relative addressing.
-Current address is added to the address field to produce to EA
-implicitly references the PC (program counter)

13.10 What facts go into determining the use of the addressing bits of
an instruction?
-Number of addressing modes
-Number of operands
-Register vs. memory
-Number of register sets
-Address range
-Address granularity

13.11 What are the advantages and disadvantages of using a variable-


length instruction format?
Advantage: efficient & compact
Disadvantage: complexity depends on length

13.1 Given the following memory values and a one-address machine


with an accumulator, what values do the following instructions load into
the accumulator?
■■Word 20 contains 40. ■■ Word 30 contains 50.
■■Word 40 contains 60. ■■ Word 50 contains 70.
a. 20 b. 40 c. 60 d. 30 e. 50 f. 70
13.3 An address field in an instruction contains decimal value 14. Where
is the corresponding operand located for
13.4 Consider a 16-bit processor in which the following appears in main
memory, starting
at location 200:

The first part of the first word indicates that this instruction loads a value
into an accumulator. The Mode field specifies an addressing mode and,
if appropriate, indicates a source register; assume that when used, the
source register is R1, which has a value of 400. There is also a base
register that contains the value 100. The value of 500 in location 201
may be part of the address calculation. Assume that location 399
contains the value 999, location 400 contains the value 1000, and so on.
Determine the effective address and the operand to be loaded for the
following address modes:

You might also like