The PIC24F instruction set supports both word and byte operations. As a consequence of byte accessibility, all EA calculations are
internally scaled to step through word-aligned memory.
For example, the core recognizes that Post-Modified Register Indirect Addressing mode [Ws++] will result in a value of Ws + 1 for
byte operations and Ws + 2 for word operations.
Data byte reads will read the complete word, which contains the byte, using the LSB of any EA to determine which byte to select.
The selected byte is placed onto the LSB of the data path.
That is, data memory and registers are organized as two parallel, byte-wide entities with shared (word) address decode, but
separate write lines. Data byte writes only write to the corresponding side of the array or register which matches the byte address.
All word accesses must be aligned to an even address. Misaligned word data fetches are not supported, so care must be taken when
mixing byte and word operations or translating from 8-bit MCU code. If a misaligned read or write is attempted, an address error
trap will be generated.
Thank you - this is starting to make more sense. I have now read ahead in the (PIC24FJ256GB210) data sheet and this is how PIC covers those pointsQuoteThe PIC24F instruction set supports both word and byte operations. As a consequence of byte accessibility, all EA calculations are
internally scaled to step through word-aligned memory.
A 16-bit CPU architecture has a 16-bit wide address bus (https://en.wikipedia.org/wiki/16-bit_computing (https://en.wikipedia.org/wiki/16-bit_computing)).
The DEC alpha originally accessed only words; I believe that was later modified.
Sure, and it's easier for Harvard architectures. Nothing says that the width of an instruction has to be the same as the width of address bus.
I asked the original question because I was wondering about the size of a C pointer on a given machine. The data "address range" is 2^16 bytes for the PIC mentioned. Therefore I think a C compiler must use 16-bit pointers - and all 16 bits in that pointer are potentially significant (depending on how much data memory is implemented).
As I see it though: On a Harvard machine, a function pointer might conceivably need a different size (from a data pointer) but the size of the program memory bus would need to differ from the data memory bus by at least 8 bits for this to make a difference to the size of a pointer (as measured in 8-bit bytes).
After seeing Silicon Wizard's comments I have (now) placed quotation marks around "my" definition, with which this thread began, to emphasise it is taken from the link given - Wikipedia. (I gave the link because I was unsure of the definition). I had never been certain of what N-bit architecture meant, although terms like that are often used. After reading the comments on this thread, I think there is no single correct answer.
Microchip (and others) categorise their processors by "bits". Is there inconsistency in the way say Microchip, ARM, Intel etc list their products as being N-bit?
But pretty much all tricks of making a 8 or 16bit CPU support more than 256 or 64K of memory tend to be annoying in some way. One of the rare non annoying ones is Intel PAE (Physical Address Extension) that uses the 32bit era well established virtual memory addressing to map in memory above 4GB without the applications even knowing it. This only really makes sense on modern multitasking OSes where no single application uses up all of the memory for itself. Tho Windows didn't really support it properly like Linux did.It sounds non-annoying to an application programmer. It's a PITA to a kernel which needs access to all of that RAM but can't have it mapped into its own address space permanently.
Even more egregious, you now hear people talking about "8-bit graphics" referring to Apple ][ or IBM CGA era. 2 bits per pixel isin't nearly 8...It's shorthand for "graphics typical of 8-bit computers and game consoles of the early- to mid-80s."
I asked the original question because I was wondering about the size of a C pointer on a given machine. The data "address range" is 2^16 bytes for the PIC mentioned. Therefore I think a C compiler must use 16-bit pointers - and all 16 bits in that pointer are potentially significant (depending on how much data memory is implemented).
Very early computers often had deviating word sizes. for example https://en.wikipedia.org/wiki/PDP-8 (https://en.wikipedia.org/wiki/PDP-8) had a word size of 12 bits. Possibly the concept of a "Byte" with 8-bits was not even in common use back then.
The historical Cray-1 used 32 bit memory, and probably 32 bit was the only addressing mode. But that one is also from the '70ies and pretty old (though impressive at that time).
https://en.wikipedia.org/wiki/Cray-1 (https://en.wikipedia.org/wiki/Cray-1)
A 16-bit CPU architecture has a 16-bit wide address bus (https://en.wikipedia.org/wiki/16-bit_computing (https://en.wikipedia.org/wiki/16-bit_computing)).It actually doesn't say exactly that. Which is good, because it would be wrong. It does go on to explain that various means can be used to extend the address range. (but especially: an "8-bit CPU Architecture" has NEVER meant an 8-bit address bus. Even the 8008 had a 14bit address bus.)
how does it 'spend' that 2^16? If, like a 16-bit PIC, it is able to acess to a byte resolution, memory can only be of size up to 2^16 bytes. If however the machine can only operate at a "memory cell size" resolution, memory size (in bytes) can be a as large as 2^16 * (memory cell size). However in this case, we accept that accessing individual byes must involve 'unpacking' a machine word."it varies." For example, if you look at a lot of 32bit processors (like the ARM), they'll usually implement a form of indexed addressing like:
LDRx destRegister, [indexRegister, offset]"indexRegister" is 32bits wide, so the final address is going to be 32bits. But "offset" is a constant, and has to fit into the instruction, which is as most 32bits itself, so "offset" is smaller than 32bits, limiting the range FROM the index. It's desirable to have the range be as large as possible, so for LDRs of "words", the offset is multiplied by 4, for halfwords it's multiplied by 2, and for load byte it's just added.(the "load reg, memoryAddress" where memoryAddress is a full-width constant number (like AVR's LDS R1, 0x1234) doesn't exist!)I asked the original question because I was wondering about the size of a C pointer on a given machine. The data "address range" is 2^16 bytes for the PIC mentioned. Therefore I think a C compiler must use 16-bit pointers - and all 16 bits in that pointer are potentially significant (depending on how much data memory is implemented).Writing a C compiler for a chip that doesn't have byte addressing is really annoying; C really wants pointers to be consistent, and point to the smallest accessible object size (this is one of the reasons that C doesn't have "bit" variables. Not enough chips support a "pointer to a bit.") 8086 was pretty painful (two pointers to the same memory might not be identical.) There was a really smart guy who wrote a C compiler for the PDP-10, but it took a long time...
the DEC PDP-10, had a 36bit word
the DEC PDP-10, had a 36bit word
Why did it have 32+4 bit word rather than just 32?
Why did it have 32+4 bit word rather than just 32?If you don't care about byte addressability, word size doesn't matter. There were actually several 36bit CPUs around at the time - apparently (WP) 36bits matched up well with the 10digit accuracy of mechanical calculators. A fair number of printers and etc were uppercase only, so you could represent a pretty complete alphabet in 6bit characters. There were CDC mainframes with 60bit words...
QuoteWhy did it have 32+4 bit word rather than just 32?If you don't care about byte addressability, word size doesn't matter. There were actually several 36bit CPUs around at the time - apparently (WP) 36bits matched up well with the 10digit accuracy of mechanical calculators. A fair number of printers and etc were uppercase only, so you could represent a pretty complete alphabet in 6bit characters. There were CDC mainframes with 60bit words...