fetch & execute

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Kindly guide me with the following question:
A hypothetical microprocessor communicates with its memory and peripheral over an 8 bit data bus and 16 bit address bus. It contians 8-bit accumulator A and 2 16 it registers: program counter PC and index register X. The opcode of each instruction is one byte long. Suppose that any internal processor time is negligible and that time to address memory and transfer one byte in either direction over the data bus equals unity. What is the time take to fetch and execute the 3-byte instruction "store A in some address indexed by X"?
My solution is based upon 8-bit data bus is:
1. get instruction (3 units time)
2. get operand A (1 unit of time)
3. get operand X (1 unit of time)
4. Store data (1 unit of time )

total time=6 units

Plz guide me with the correct answer.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,062
Presumably the values are already stored in A and X from as a resiult of executing previous instructions. Thay are just sitting there ready to use.

Is this a von Neumann machine or a Harvard architecture?
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for your interest in this question. I have written the entire question. It does not give any more information about the architecture. Kindly tell me about the correct answer.

Zulfi.
 

WBahn

Joined Mar 31, 2012
30,062
With no further information, you have to assume it is a von Neumann architecture.

So use the hint I gave in my last post.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Hi,
Thanks for guiding me. If its von Neumann architecture then we cant access the data and instruction at the same time.
I cant understand:

Presumably the values are already stored in A and X from as a resiult of executing previous instructions.
Plz guide me.

Zulfi.
 

absf

Joined Dec 29, 2010
1,968
Presumably the values are already stored in A and X from as a resiult of executing previous instructions.
Using 6502 MPU as an example:

Rich (BB code):
LDA #$20        ;ACC = 20H
LDX #$56        ;X REG = 56H
STA $3000,X    ;20H -> MEMORY(3000H + 56H)
The 1st and 2nd instruction would set up the Acc and X Reg for the 3rd instruction STA $3000,X

HTH

Allen
 

WBahn

Joined Mar 31, 2012
30,062
Hi,
Thanks for guiding me. If its von Neumann architecture then we cant access the data and instruction at the same time.
I cant understand:

Presumably the values are already stored in A and X from as a resiult of executing previous instructions.
It's like the following statement in a high level language:

y = a + b;

This statement doesn't put values in either a or b, it merely uses the values that are already in them as a result of prior statements.

In most architectures, you don't have to spend time "getting" operands that are stored in registers. In some sense that's why the registers are there - to make their contens immediately available to the instruction being executed.
 

Thread Starter

zulfi100

Joined Jun 7, 2012
656
Thanks. I did not pay attention to the fact that A and X are registers.

So now:
get inst (3 units)
store (1 unit)

So total time is 4.

Is it right now?

Zulfi.
 
Top