mcf5271

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

mcf5271

1,454 次查看
Anand
Contributor I
Hi,
 
Is MCF5271 a byte addressable processor? If I am dealing with 32 bit data, does the program counter increment by 4?
标签 (1)
0 项奖励
4 回复数

343 次查看
SimonMarsden_de
Contributor II
When reading or writing data, you can transfer byte, 2-byte or 4-byte quanties (ColdFire calls these Byte, Word and Long).

Instruction widths are either 2, 4 or 6 bytes. The PC thus increments by 2, 4, or 6 each time a non-branch instruction is executed. Groups of instructions may be fetched from memory in a burst transfer.


Hope this helps


Simon
0 项奖励

343 次查看
Anand
Contributor I
Hi Simon,
 
Thanks for your reply. I am dealing with 32 bit data. So everytime I fetch 32 bits of data, the program counter would increment by 4 right??
 
0 项奖励

343 次查看
SimonMarsden_de
Contributor II
Hi Anand

I think you might be confusing two separate concepts - the program instructions (opcodes) in memory telling the processor what to do, and the data that the program operates on.

The Program Counter (PC) points to the next opcode to execute. Each time a new instruction is executed, it will increment by 2, 4 or 6 depending on the width of the instruction.

Separate from that, the processor can also read and write data. It can do this in byte, word or long-word transfers. There are many instructions capable of fetching 32-bit data from memory. Here are just a few:

    move.l   (a0),d0

    move.l   4(a3),d0

    move.l   fred(a2,d1.l*8),d0

    add.l     mydata,d0

All of these fetch 32 bits of data (the width is specified as xxx.L in each instruction). However, the widths of the instruction opcodes vary, and so the PC will increment by a variable amount.


Hope this helps


Simon
0 项奖励

343 次查看
mccPaul
Contributor I
Hi Anand
 
What do you mean by "everytime I fetch 32 bits of data"? Are you are talking about loading a register with data or dereferencing or incrementing a C pointer?
 
The program counter increments as each intruction is executed by the CPU and as Simon said, the instruction length is variable so the program counter can be incremented  by 2, 4 or 6 bytes.
 
We may be able to be clearer if you could show some source code that you need to have explained.
 
Cheers,
 
Paul.
0 项奖励