c310-hw4-1

3
Name:____________________________ CMIS 310 – Spring 2015 HOMEWORK #4 – Week #4 This homework is worth 10% of your course grade. Read each problem carefully. Failure to follow the instructions for a problem will result in a zero score for that problem. Submit the completed Homework via Assignment in LEO. 1. Show how the ASCII value for “ORENTM” is stored in memory in Big Endian and in Little Endian format starting at location 100 hexadecimal. Assume that each memory location stored two ASCII characters. Memory Location Big Endian Little Endian 100 101 102 2. For X = 0100 1011, show the result of the following independent operations (i.e. each instruction occurs with X starting at the value above): a) Logical Shift Left ____ ____ b) Rotate Right ____ ____ c) Logical Shift Right ____ ____ d) Rotate Left ____ ____ e) Arithmetic Shift Right ____ ____ 3. a) Convert the following expression from infix to postfix (Reverse Polish Notation): 1

Upload: richard-mcdaniel

Post on 08-Dec-2015

219 views

Category:

Documents


10 download

DESCRIPTION

Homework assignment

TRANSCRIPT

Page 1: C310-HW4-1

Name:____________________________CMIS 310 – Spring 2015

HOMEWORK #4 – Week #4

This homework is worth 10% of your course grade.

Read each problem carefully. Failure to follow the instructions for a problem will result in a zero score for that problem.

Submit the completed Homework via Assignment in LEO.

1. Show how the ASCII value for “ORENTM” is stored in memory in Big Endian and in Little Endian format starting at location 100 hexadecimal. Assume that each memory location stored two ASCII characters.

Memory Location Big Endian Little Endian100101102

2. For X = 0100 1011, show the result of the following independent operations (i.e. each instruction occurs with X starting at the value above):

a) Logical Shift Left ____ ____

b) Rotate Right ____ ____

c) Logical Shift Right ____ ____

d) Rotate Left ____ ____

e) Arithmetic Shift Right ____ ____

3. a) Convert the following expression from infix to postfix (Reverse Polish Notation): X = (A / B) * (C + D ) – ( E + F)

b) Write the stack instructions to perform the computation in part a:

It is important to remember that operational hierarchy dictates that: we first perform all arithmetic inside inner parentheses (if there are any), then inside outer parentheses (if there are any), then do multiplication and division operations before addition and subtraction

operations. For stack operations, items are placed on the stack in the order that they appear in the expression.

1

Page 2: C310-HW4-1

4. Suppose we have the instruction Load 700. Given that memory and register R1 contain the values below:

Memory R1 200

500 600

: :

600 700

: :

700 800

: :

800 500

: :

900 600

Then assuming R1 is implied in the indexed addressing mode, determine the actual value loaded into the accumulator and fill in the table below:

Mode Value Loaded into AC

Immediate

Direct

Indirect

Indexed

5. The memory unit of a computer has 512K words of 32 bits each. The computer has an instruction format with 4 fields: an opcode field; a mode field to specify 1 of 4 addressing modes; a register address field to specify 1 of 30 registers; and a memory address field. Assume an instruction is 32 bits long. Answer the following:

a. How large must the mode field be? _____

b. How large must the register field be? ____

c. How large must the address field be? ____

d. How large is the opcode field? ____

2

Page 3: C310-HW4-1

3