views:

1243

answers:

16

We have 8-bit, 16-bit, 32-bit and 64-bit hardware architectures and operating systems. But not, say, 42-bit or 69-bit ones.

Why? Is it something fundamental that makes 2^n bits a better choice, or is just about compatibility with existing systems? (It's obviously convenient that a 64-bit register can hold two 32-bit pointers, or that a 32-bit data unit can hold 4 bytes.)

+9  A: 

The venerable PDP-10 was 36 bits.

Otávio Décio
What a bizarre machine! :-)
Joonas Pulakka
I fail to see how pointing out one specific architecture answers the question "why".
Bryan Oakley
@Joonas at the time, the character size was 6 bits, hence 36 (6 * 6) made sense... This and other insight are covered in the wikipedia article Voytek Jarnot found for us, in this post.
mjv
@Bryan, pointing out a counterexample is very relevant.
Grandpa
Most of the PDP's were strange numbers :- http://www.village.org/pdp11/faq.pages/WhatPDP.html It is relevant, because it disproves the initial premise.
JonB
The 1953 BESK had 40-bits. http://en.wikipedia.org/wiki/BESK http://www.pbase.com/jakobe/besk_remains
Jonas Elfström
@JonB perhaps not that strange, they're all multiples of 3, the number of bits in an octal number.
fvu
@fvu, Yes, I always thought bytes should be 9 bits so octal worked properly.
JonB
Actually, on the PDP-10, byte size was variable. A word was 36 bits, and any instructions that accessed bytes included a field to specify the byte size. They considered ASCII to be a 7-bit code then, so you could fit 5 ASCII bytes in a word with one bit left over. Some applications would then use that bit as a flag, for example, the BASIC interpreter used a word to hold the line number, with a maximum of five digits, and then the extra bit was set to 1 to indicate this was a line number. They also used a code they called SIXBIT with (surprise!) six bits per byte, and you could thus ...
Jay
... fit six SIXBIT bytes into a word. You could work with binary-coded decimal fairly easily by using 4-bit bytes. Etc. All told I thought that was a pretty cool feature of the machine.
Jay
Totally irrelevant to the present question but thinking of the PDP-10: When I first started using that computer we had 300-baud modems. Then one day we got 1200-baud modems. I remember being incredibly impressed with their speed. I commented to a friend, "Wow, this thing can print faster than you can read it!!"
Jay
@Jay - First time I got impressed by a modem it was a synchronous 9600 baud, huge, all wired circuit that we used to talk to an IBM mainframe... good times :)
Otávio Décio
@JonB That the PDP series had word sizes in multiples of 3, and that 3 bits is what is needed to hold an octal digit is no accident. Early PDP series computers had front panel switches for direct data entry. The switches were arranged in groups of three to make conversion from octal to switch settings easy (similarly the status lamps displayed bits in groups of threes).
Stephen C. Steel
+18  A: 

That's mostly a matter of tradition. It is not even always true. For example, floating-point units in processors (even contemporary ones) have 80-bits registers. And there's nothing that would enforce us have 8-bit bytes instead of 13-bit bytes.

Sometimes this has mathematical reasoning. For example, if you decide to have an N bits byte and want to do integer multiplication you need exactly 2N bits to store the results. Then you also want to add/subtract/multiply those 2N-bits integers and now you need 2N-bits general-purpose registers for storing the addition/subtraction results and 4N-bits registers for storing the multiplication results.

sharptooth
Some of our products are based on a TI DSP that has 40 bit longs. http://focus.ti.com/docs/toolsw/folders/print/sprc122.html
Dolphin
+18  A: 

http://en.wikipedia.org/wiki/Word_%28computing%29#Word_size_choice

Different amounts of memory are used to store data values with different degrees of precision. The commonly used sizes are usually a power of 2 multiple of the unit of address resolution (byte or word). Converting the index of an item in an array into the address of the item then requires only a shift operation rather than a multiplication. In some cases this relationship can also avoid the use of division operations. As a result, most modern computer designs have word sizes (and other operand sizes) that are a power of 2 times the size of a byte.

Voytek Jarnot
This explains why machines with 8-bit minimum addressable units use 16, 32... bus widths, but doesn't explain the prevalence of the 8-bit byte.
dmckee
The 8 bit byte isn't compulsory either :- http://en.wikipedia.org/wiki/Byte
JonB
An 8-bit byte is present because 7 bits was enough to encode English in ASCII and the 8th bit can be used for parity.
Will Bickford
6 bits are sufficient to encode the Latin Alphabet + Numbers (leaving a null 3/4-of-a-byte and another symbol). Some early text encodings were even 5 bits.
Robert Fraser
+1  A: 

Related, but possibly not the reason, I heard that the convention of 8 bits in a byte is because it's how IBM rigged up the IBM System/360 architecture.

Joel
Really, it comes down to how easy is the conversion from binary to hex, and the smallest useful microcontroller size. A nibble (4 bits) converts very easy to a single hex digit (0-F). But that only give you 15 instructions. A byte gives you 255 possible instruction while still being easy to convert to hex in your head.
SDGator
A nibble! Not heard that before.
Joel
@SDGator: on the old 18, 24, and 36 bit architectures, people used octal instead of hex because *that* fit evenly (which is why c supports decimal, hex, and octal integer expressions). You are mistaking convention for something fundamental.
dmckee
My guess is that it is due to binary coded decimal (BCD), i.e. two decimal digits in a byte. Bean counters love decimal numbers, it avoids rounding problems for money.
starblue
@starblue: There may be something to that notion.
dmckee
+4  A: 

Your memory system wants to be a byte multiple, which makes your cache want to be a byte multiple, which makes your whole system want to be a byte multiple.

Speaking as a HW designer, you generally want to design CPU's to byte boundaries of some kind, ie multiples of 8. Otherwise you either have to add a lot of awkward circuitry to a 49-bit system to make it utilize the mod-8 bits, or you end up ignoring the extra bits, in which case it was a waste, unless you needed the extra bit for instructions, which is never the case on 16 bit or wider systems.

SDGator
That is just you thinking of 8-bit bytes as fundamental. They are not, systems useing 18, 24, and 36 bit machine words used to be common *and* did not present any problems to the hardware designer.
dmckee
I was referring to two different issues. As long as you have enough bits to cover your instruction set, or machine words, you are fine. Those don't need to be byte multiples. After you've satisfied that requirement, then you need to worry about memory addressing. Usually you access memory in bytes, dwords or owords. If you have a non-byte multiple architecture, you'll need some kind of translator to access memory and caches to grab the extra bits, and the addressing math gets weird. I guess my argument still comes down to convention since you can always define a byte+x addressing scheme.
SDGator
No. Machines that use not-divisible-by-eight-bits words *don't* and *never have* accessed memory in eight bit bytes. The fact that it is only easy to buy memory that accesses in eight bit bytes is a consequence, not a cause. There is nothing fundamental about eight bit bytes. Nothing.
dmckee
You're right...there's nothing fundamental about 8-bit bytes. You can design anything you want. But there's no fundamental reason a commercial company is going to spend the $$'s to bring a product to market that can't talk normally to peripherals, memory, etc. Its pretty much convention now, and there's no sound technical reason to mess with it. Little endian versus big endian is bad enough.
SDGator
+16  A: 

Partially, it's a matter of addressing. Having N bits of address allows you to address 2^N bits of memory at most, and the designers of hardware prefer to utilize the most of this capability. So, you can use 3 bits to address 8-bit bus etc...

DVK
This makes the most sense to me. Having a non-power-of-two number of bits would be a waste of address states.
Andrew Medico
+1  A: 

A common reason is that you can number your bits in binary. This comes in useful in quite a few situations. For instance, in bitshift or rotate operations. You can rotate a 16 bit value over 0 to 15 bits. An attempt to rotate over 16 bits is also trivial: that's equivalent to a rotation over 0 bits. And a rotation over 1027 bits is equal to a rotation over 3 bits. In general, a rotation of a register of width W over N bits equals a rotation over N modulo W, and the operation "modulo W" is trivial when W is a power of 2.

MSalters
A: 

My trusty old HP 32S calculator was 12-bits.

ndim
A: 

Because the space reserved for the address is always a fixed number of bits. Once you have defined the fixed address (or pointer) size then you want to make the best of it, so you have to use all its values until the highest number it can store. The highest number you can get from a multiple of a bit (0 either 1) is always a power of two

Vincent
A: 

May be you can find something out here: Binary_numeral_system

SXLee
A: 

The ICL 1900 were all 24 bit (words). Bet there's not a lot of people remember these. You do ??

Frank
Sorry, I meant when it was emulating the 1900 range, a real 24 bit word machine.
Frank
+1  A: 

The 80186, 8086, 8088 and "Real Mode" on 80286 and later processors used a 20-bit segmented memory addressing system. The 80286 had 24 native address lines and then the 386 and later had either 32 or 64.

Jesse C. Slicer
friggin' near and far pointers. what a gross way to manage memory.
San Jacinto
The near/far thing stunk, but given the available hardware designs and historical constraints, choices were limited.
DaveE
yes, but that doesn't mean i have to LIKE it :)
San Jacinto
The fact that Intel wanted backward compatibility AT ALL COSTS was, I think, too strict of a constraint. This is what allowed Motorola and Power PC to swoop in with superior, yet incompatible, designs. Mac only switched to Intel once it had an architecture/instruction set that it deemed robust enough to base their computer on. Now, mind you, this is from a technical perspective. From a business perspective, I think they made the right moves to keep their market share significant.
Jesse C. Slicer
+1  A: 

Another counter example: the PIC16C8X series microcontrollers have a 14 bit wide instruction set.

pjc50
you beat me to it by seconds! it's worth mentioning that this is a harvard architecture processor and the 14 bit words are for instructions, whereas data memory is a standard 8 bit byte.
rmeador
+2  A: 

As others have pointed out, in the early days, things weren't so clear cut: words came in all sorts of oddball sizes.

But the push to standardize on 8bit bytes was also driven by memory chip technology. In the early days, many memory chips were organized as 1bit per address. Memory for n-bit words was constructed by using memory chips in groups of n (with corresponding address lines tied together, and each chips single data bit contributing to one bit of the n-bit word).

As memory chip densities got higher, manufacturers packed multiple chips in a single package. Because the most popular word sizes in use were multiples of 8 bits, 8-bit memory was particularly popular: this meant it was also the cheapest. As more and more architectures jumped onto the 8 bit byte bandwagon, the price premium for memory chips that didn't use 8 bit bytes got bigger and bigger. Similar arguments account for moves from 8->16, 16->32, 32->64.

You can still design a system with 24 bit memory, but that memory will probably be much more expensive than a similar design using 32 bit memory. Unless there is a really good reason to stick at 24 bits, most designers would opt for 32 bits when its both cheaper and more capable.

Stephen C. Steel
Then along comes DDR3...triple channel memory.
Will Bickford
A: 

We have, just look at PIC microcontrollers.

Szundi
+1  A: 

Many (most?) early pre-microprocessor CPUs have some number of bits per word that are not a power of two.

In particular, Seymour Cray and his team built many highly influential machines with non-power-of-two word sizes and address sizes -- 12 bit, 48 bit, 60 bit, etc.

A surprisingly large number of early computers had 36-bit words, entirely due to the fact that humans have 10 fingers. The Wikipedia "36-bit" article has more details on the relationship between 10 fingers and 36 bits, and links to articles on many other historically important but no longer popular bit sizes, most of them not a power of two.

I speculate that

(a) 8 bit addressable memory became popular because it was slightly more convenient for storing 7-bit ASCII and 4 bit BCD, without either awkward packing or wasting multiple bits per character; and no other memory width had any great advantage.

(b) As Stephen C. Steel points out, that slight advantage is multiplied by economies of scale and market forces -- more 8-bit-wide memories are used, and so economies of scale make them slightly cheaper, leading to even more 8-bit-wide memories being used in new designs, etc.

(c) Wider bus widths in theory made a CPU faster, but putting the entire CPU on a single chip made it vastly cheaper and perhaps slightly faster than any previous multi-part CPU system of any bus width. At first there were barely enough transistors for a 4 bit CPU, then a 8 bit CPU. Later, there were barely enough transistors for a 16 bit CPU, to a huge fanfare and "16 bit" marketing campaign. Right around the time one would expect a 24 bit CPU ...

(d) the RISC revolution struck. The first two RISC chips were 32 bits, for whatever reason, and people had been conditioned to think that "more bits are better", so every manufacturer jumped on the 32 bit bandwagon. Also, IEEE 754-1985 was standardized with 32-bit and 64-bit floating point numbers. There were some 24 bit CPUs, but most people have never heard of them.

(e) For software compatibility reasons, manufacturers maintained the illusion of a 32-bit databus even on processors with a 64 bit front-side bus (such the Intel Pentium and the AMD K5, etc.) or on motherboards with a 4 bit wide bus (LPC bus).

David Cary