-4 CS 254-Digital Computer Architecture Exam 2 Name 3.(20 pnts) Figure 1 shows s
ID: 3705435 • Letter: #
Question
-4 CS 254-Digital Computer Architecture Exam 2 Name 3.(20 pnts) Figure 1 shows seven addressing modes graphically. With the given registers and memory contents in Figure 3, determine what operand A is fetched for each Figure 2 shows two instruction formats used in this system. Format 1 is used for addressing mode listed below. rect, Indirect and Stack addressing modes. Format 2 is used for Register, Register Indirect and Displacement addressing modes. (The 6-bit opcode is given as. Show all steps in your definition of the EA (effective address) Format 1 Opcode Format 2 Address/Operand 10 bits 6 bits Opeode Register Address/Operand 6 bits 2 bits 8 bits Fig 2: Two Instruction Formats Register ABCD Memory Addr Contents Contents RO R1 R2 R3 SP 0123 A001 0041 7654 0051 0123 4321 7654 A001 ABCD4321 A001 7654 0123 ABCD 4321 Fig. 3: Registers and Memory Contents a. Immediate Addressing IR-Xxxxxx0001100010 b. Direct Addressing IR- XxxXxx 0001010001Explanation / Answer
a) Immediate mode: In this mode operand directly specified in instruction.
For the given problem the value of A is 01010001
Example: MOV A, 15H (move the data 15H into A register)
b)Direct Mode: The operand’s offset id given as part of the instruction.
Example: ADD A,[0104] //add the contents of offset address 0104 to A Register
In the given Problem offset is [0001010001] = [0051] .So the value of A is A001
c) InDirect Mode: In this effective address of an operand(A) is pointed by address specified in the instruction.
given address is 01010001 = [0051] -->[A001]--->4321.So the value of A is 4321
d)Register Addressing mode :In register addressing the operand is placed in one of general purpose registers. The data is in the register that is specified by the instruction.
in given problem the register is R3(11 means 3 - register bits according to format2)-.So the value of A is nothing but the value in R0 Registger 0041
e)Register Indirect mode:The effective address of the data(A) is placed in any one of the registers in the instruction.
in given problem the register is R1(01 means r1 - register, bits according to format2)-.So the value of A is at the address location in R1.
i.e)A =[R1] =[0123]=7654
f)Example for dispalcemt to easily understand :
According to given problem register bits=11 i.e) R3 registger .The value at R register is 0041
And
address/operand bits=11100010=00E2.
Finally the value of A at the location =[R3+00E2]=[0041+00E2] =[0123]=7654
f)Stack addressing mode :
In this mode, operand is at the top of the stack. For example: ADD, this instruction will POP top two items from the stack, add them, and will then PUSH the result to the top of the stack.
According to given problem,Stack pointer points to location 7654
And stack displacement address is 0000000000 =0000.
The effective address of the value A is [SP+0000]=[7654]=ABCD
address/operand bits=11100010=00E2.
Finally the value of A at the location =[R3+00E2]=[0041+00E2] =[0123]=7654
Displacement Add R4, 100(R1) R4 <- R4 + M[100+R1]Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.