Hacker News new | past | comments | ask | show | jobs | submit login

> You don't need a barrel shifter. You can shift one bit at a time. It's slower, but takes far fewer components.

I think I've finally found someone to ask this question.

How many transistors and space did it take to implement a 8-bit barrel shifter in the 1980s? I found the computing capabilities of 8-bit CPUs in retrocomputers, like the Z80 or 6809, were actually not too bad. With shift-and-add, a lot of computation can be done effectively, but their biggest limitation is the lack of a barrel shifter. Without one, no constant-time bitshift is possible with variable step, you have to shift 1-bit at a time. Performance could be boosted dramatically if a single 8-bit barrel shifter is included, and would open the avenue of a lot of optimization techniques for graphics as well.

Why didn't they include one? Especially when you consider that the Z80 was an "ultimate upgrade" of the Intel 8080, and the 6809 was the "ultimate upgrade" of the 6800.

Was it technical limitations, i.e. even a 8-bit barrel shifter is still too expensive for a 8-bit chip? Or was it that the cost of additional shift instructions decoding/processing is much higher than the barrel shifter itself? Or was it the lack of demand, i.e. it could be done reasonably well with acceptable cost, but simply no commercial reason in the 8-bit era to add one?




I examined the ARM-1's barrel shifter on the die [1]. It takes roughly 10% of the chip so it's a fairly hefty investment.

8-bit chips probably didn't have a barrel shifter because they were very limited in functionality. (I didn't realize how limited until I looked at mainframes of the time.) Functions like multiply and divide are more useful than barrel shifting, and those were missing too. Barrel shifting is sort of a frill. As for the Z80, it was very, very tight on space so it's not surprising the barrel shifter was lacking. It didn't even have an 8-bit ALU; it had a 4-bit ALU that was used twice per operation.

[1] http://www.righto.com/2015/12/reverse-engineering-arm1-ances...


> I examined the ARM-1's barrel shifter on the die. It takes roughly 10% of the chip so it's a fairly hefty investment.

> Functions like multiply and divide are more useful than barrel shifting, and those were missing too.

My thought was that the lack of multiplier/divider can be somewhat compensated by adding a cheaper 8-bit barrel shifter instead. So according to your analysis, apparently even that didn't make economic sense for a 8-bit chip.

Thanks a lot for giving an authoritative assessment, Ken!


Most of the 8-bit microprocessors I'm aware of -- including the Z80 and 6800 -- only had single-bit shift/rotate instructions, which didn't require a barrel shifter. Variable shift instructions were comparatively rare.

Besides, a 32-bit barrel shifter is considerably more complex than an 8-bit one. It's not just four times larger to deal with the wider operands; it also needs another two levels of muxes, making it closer to 6x as complex.


> most of the 8-bit microprocessors only had single-bit shift/rotate instructions

Yes, they don't have a barrel shifter because they don't have variable shift instructions. But unfortunately, you didn't answer the actual question: Why didn't they have it then? As I've already asked, Was it technical/cost limitations? Or was it simply the lack of demand/commercial reasons to add one?




Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: