[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [f-cpu] F-CPU endianess...


Nikolay Dimitrov wrote:

First, I'm amazed with the speedy response :)

you're simply lucky that i am now online :-)

Second, it seems that core can address data at addresses 0x00, 0x08, 0x10, 0x18......

"seems" ...
it depends on a lot of different things and this will vary from implementation to implementation

and accessing data that is not aligned, for example 0x03 will cause an exception.

nope. You can access bytes, words and dwords at this address.

To be more specific : data can be accessed if they are aligned on the "natural boundaries" :
byte : 1 byte, 16-bits : 2 bytes and so on.

To check if the pointer is aligned, the "size" field of the instruction is decoded to a bit field,
and the LSB of the pointer register is read. Both are ANDed.
If the result is not zero, the pointer is not aligned.

For example :
read 16-b word from register 42 (which is equal to 127)

mask=1, 1 & 127 = 1, so the pointer is not aligned, the instruction is trapped and
an alignment routine is triggered.

For 32-bits, mask=0x3, 64-bits: 0x7 and so on.

The LSU will "align" and adjust the endianness itself.

I'm asking about _memory organisation_. We say for example (in a x86 world) that a block of 256 32-bit words will have a size 1Kb (described in 8-bit bytes). So, 1Kb RAM space in F-CPU will hold 1024 / 64 = 128 64-bit words. And when we say that F-CPU has 1Kb RAM, we mean that the core has access to 128 64-bit memory cells. Is this so?

you seem to forget that F-CPU is defined to handled "arbitrary large words".
So currently we work on 64-bit data words but the VHDL code can already
be scaled to 128, 256 etc... So forget about data width. Memory organisation
follows in a logical way. For example, L1 cache lines are probably 256 bits wide.
but it is not written in stone : just change a constant in a configuration file and
it's 512 bits, for example.

If we want to be free, we have to be flexible...

Best regards to all!

P.S.: I was so absent-minded in the previous letter, that I forgot to paste my signature :)))

Nikolay Dimitrov, a.k.a. PicMaster
Software Developer


To unsubscribe, send an e-mail to majordomo@xxxxxxxx with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/