Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] instruction memory vs data memory

Status
Not open for further replies.

cyboman

Member level 4
Joined
Mar 9, 2010
Messages
71
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
USA
Activity points
1,808
i'm slightly confused about those two memories. i know that the name of memory corresponds to the type of data stored in it (duh), but i still don't quite see it.

say we have the following assembly:

MOV A, #24 ; move 0x24 to the accumulator

does it mean that opcode for MOV will be stored in instruction memory and the rest of the bytes will be stored in data memory? for some reason that feels wrong.

any help is appreciated.
 

Hi cyboman, In this example, 0x24 will be the part of instruction & hence will not be stored in data memory. It will be stored in instruction mem as part of instruction. for example, if hex code for MOV A is 12 (hex) so this complete instruction will take 2 bytes. First byte will be 12 & second will be 24, stored in inst mem. In data memory all the variables & stack is stored. So if it would have been MOV A, xyz, where xyz is a variable, then instruction (stored in inst mem) will be more than 1 byte however, in this case it will store 12 as first byte & address of location of variable xyz in data memory. (I've over simplified this ex. Hex code will be different for MOV A in both the cases due to different addressing modes.)
 
Last edited by a moderator:

So if it would have been MOV A, xyz, where xyz is a variable, then instruction (stored in inst mem) will be more than 1 byte however, in this case it will store 12 as first byte & address of location of variable xyz in data memory.

i'm having trouble reading this part of your reply. did you mean that it will store the opcode of the instruction and the address of xyz in the instruction memory and the value for the xyz variable in data memory. am i correct?
 

Bingo, you got it right. (Now reading back my reply, the language does appear a little confusing to me too :) ) However, what you've inferred is absolutely correct. So to summarize it: All variables, tables*, stack etc are stored in data memory & all instructions (along with any literal constants that are part of instruction) are stored in instruction memory.

*Certain architectures (eg COP8 if I remember) do provide tricks to store Tables in Instruction memory along with instructions like return. But as a general rule we store Data table in data memory.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top