View unanswered posts | View active topics It is currently Fri Apr 19, 2024 4:55 pm



Reply to topic  [ 8 posts ] 
 68000 design choices? 
Author Message

Joined: Thu Jan 17, 2013 4:38 pm
Posts: 53
There seems to be a few "shortcomings" with the 68000 that I wonder if there has been given any further explainations for?
- Word aligned access for long/word. That was abandoned with the 68020. Is the handling of it transistor expensive, or was it 'ideologic'?
- No dbCC.l version. That seems at odds with something you want to be compiler friendly. Not added later either.
- No conditional jump/jsr. Is this not common on other CPUs?
- No pre-increment nor post-decrement. Are these 'mathematically' equivalent and as such superfluous(sp???)? I could imagine a RISC style cpu with 2 destination registers of which one would be basically a pre-increment equivalent "ld #offset,sR,dR1,dR2"
- (a7) is the return address and not free/writeable after a subroutine entry, I guess this is because RTS is basically an "(a7)+" addressing mode instead of "+(a7)". What is most the common way of pushing to the stack, pre or post decrement?
- Potentially odd offset branches. Why didn't they just define that byte/word size branch offsets were shifted once right and as such would span 512byte / 128K offsets?


Wed Apr 27, 2022 11:37 am
Profile

Joined: Wed Nov 20, 2019 12:56 pm
Posts: 92
NorthWay wrote:
There seems to be a few "shortcomings" with the 68000 that I wonder if there has been given any further explainations for?

Interesting questions - I'll offer some answers, but based on gut feeling more than actual evidence! :)
Quote:
- Word aligned access for long/word. That was abandoned with the 68020. Is the handling of it transistor expensive, or was it 'ideologic'?

It's fairly expensive - getting load/store alignment working was one of the most painful parts of 832: https://github.com/robinsonb5/EightThirtyTwo/blob/master/RTL/eightthirtytwo_aligner.vhd
OK, it's a 32-bit rather than 16-bit CPU so there are more permutations to handle, but it's surprisingly difficult for something that sounds so simple! There might have been speed concerns as well as transistor count concerns, too.
Quote:
- No dbCC.l version. That seems at odds with something you want to be compiler friendly. Not added later either.

Agreed - you can't reliably know whether a branch target is within range until link time, so not having a long form to fall back on is a strange omission.
Quote:
- No conditional jump/jsr. Is this not common on other CPUs?

Do other CPUs have the semantic difference between branch and jump? I've always considered that a slightly strange facet of 68k.
Quote:
- No pre-increment nor post-decrement. Are these 'mathematically' equivalent and as such superfluous(sp???)?

I'd guess implementing both was simply considered wasteful so the more useful variant was implemented?
Quote:
- (a7) is the return address and not free/writeable after a subroutine entry, I guess this is because RTS is basically an "(a7)+" addressing mode instead of "+(a7)". What is most the common way of pushing to the stack, pre or post decrement?

Semantically A7 points to the item most recently written to the stack - having it point there rather than the next free entry maximises how far into the stack you can reach with a d8(a7) or d16(a7) - reaching backwards into the free stack area is less useful. So I'd argue that pre-decrement is the more useful variant, and it's what I implemented for 832.
Quote:
- Potentially odd offset branches. Why didn't they just define that byte/word size branch offsets were shifted once right and as such would span 512byte / 128K offsets?

Probably to share some addition logic without having to add extra shifts and multiplexers?


Wed Apr 27, 2022 9:02 pm
Profile

Joined: Sat Feb 02, 2013 9:40 am
Posts: 2095
Location: Canada
My thoughts:
For the dbcc instruction, I think the 68k ALU was only 16-bits wide, reused twice for 32-bit ops. They probably figured it was not worth the extra transistors and state to allow dbcc to handle 32-bit decrements.

Pertaining to post increment and pre-decrement addressing this is the way most stacks work. Since it is possible to get by in most circumstances without pre-increment and post decrement addressing it is not supported.

Conditional jump subroutine is not that common. Usually there are subroutine arguments, set by expressions to evaluate and one wants to branch around the whole mess.

IIRC, the low order bit of the branch displacement is used to indicate long branches, +/- 32k for some versions of the cpu.

The 68k is a favorite of mine despite its idiosyncrasies.

Other things that could be improved: multiply is only 16-bit. Immediate operands for 32-bit instructions must always be 32-bit. There is room in the instruction opcode to code 16-bit immediates for 32-bit ops.

_________________
Robert Finch http://www.finitron.ca


Wed Apr 27, 2022 10:25 pm
Profile WWW

Joined: Thu Jan 17, 2013 4:38 pm
Posts: 53
robfinch wrote:
My thoughts:
For the dbcc instruction, I think the 68k ALU was only 16-bits wide, reused twice for 32-bit ops. They probably figured it was not worth the extra transistors and state to allow dbcc to handle 32-bit decrements.

(This was the intended point of the question, not branch length. Sorry about that.)
But with all the extras they stuffed into the 68020 you would think they would have considered adding it in?
Also, given the potential space saving with less pre/post loop handling I think it is kinda surprising they didn't make both word and longword size versions.

robfinch wrote:
Conditional jump subroutine is not that common. Usually there are subroutine arguments, set by expressions to evaluate and one wants to branch around the whole mess.

Isn't if-then-call-function pretty common occurences in code? It might have been prohibitive for all the addressing modes, but I was for some reason limiting myself to the CC equivalent of "jsr (a0)". As it is you have to branch around the call.
Do other (say x86) architectures only have branch conditionals or do they also have jmp/jsr ones?

Oh, and one last thing: Why is the addressing mode "jsr (a0)" and not "jsr a0"? It's kind of a lie, isn't it?


Thu Apr 28, 2022 10:12 pm
Profile

Joined: Sat Feb 02, 2013 9:40 am
Posts: 2095
Location: Canada
IIRC the x86 does not have conditional jsr. I think the PowerPC has this though.

Quote:
Oh, and one last thing: Why is the addressing mode "jsr (a0)" and not "jsr a0"? It's kind of a lie, isn't it?


I have found that perplexing too. Maybe they were worried the address mode jmp a0 would imply jumping to an instruction in a0 as opposed to using a0 as a memory address. It is a value versus value at semantic. Usually anytime there is a ‘at’ it implies indirection which is usually indicated by enclosing the operand in brackets of some sort. However, some assemblers do not require the brackets because the operand is understood, it cannot be anything else but an indirect access.

_________________
Robert Finch http://www.finitron.ca


Fri Apr 29, 2022 3:07 am
Profile WWW

Joined: Thu Jan 17, 2013 4:38 pm
Posts: 53
Having stared at the lz4 depacker for most of Saturday I also found "exg.b" and "exg.w" to be curiously lacking. I know you have the logical 3-way XOR equivalent, but since it was obviously put in for saving space and cycles I would have expected them to be there, at least for 68020. The encoding has lots of space for it as well.


Sun Feb 26, 2023 6:48 am
Profile

Joined: Thu Dec 05, 2019 7:53 am
Posts: 13
Location: Tokyo, Japan
Things like having only (An)+/-(An) addressing modes, rather than +(An)/(An)+/-(An)/(An)-, gives you obvious savings in logic. But frequently forgotten is also the savings in bits in your instruction fields.

Consider the MOVE instruction:

Code:
    |15|14|13 12|11 10  9| 8  7  6| 5  4  3| 2  1  0|
    | 0| 0| size|  reg   |  mode  |  reg   |  mode  |
    |  |  |     |   destination   |      source     |

The modes are as follows:

Code:
    000    Dn
    001    An
    010   (An)
    011   (An)+
    100  -(An)
    101   (d₁₆,An)
    110   (d₈,An,Xn)
    111   [various, depending on the register bits]

If you were to add two more modes, +(An) and (An)-, you now need four bits to encode your modes, rather than three. Where do you put the extra two bits?

NorthWay wrote:
What is most the common way of pushing to the stack, pre or post decrement?

I don't think either way is predominant over the other in late-'70s and early-'80s microprocessors; it really just depends on what the CPU designers felt was better for their particular design. Both the 6800 and the 6502 postdecrement when they push. Motorola changed that to predecrement-on-push with the 6809 and (obviously) the 68000. Perhaps significantly, the former two do not have addressing modes that index from the stack pointer; the latter two do.

_________________
Curt J. Sampson - github.com/0cjs


Sun May 07, 2023 7:56 pm
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 592
Of all the addressing modes, most really make sense for only load and store.
Want to use (An)+ for a stack machine, you still need to mess around, as divide and subtract/compare
now have reversed sense, using the same amount of code as machine with pop/psh. Threaded code
like FORTH still stays theaded.rather than direct code.

Most of the time you have a frame register for stack offsets.
I think the PDP 6 was the first computer to have stacks,but addressing on them was strange.
PDP 6 -> PDP 10 -> PDP 11 -> 68000


Tue May 09, 2023 7:19 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: SemrushBot and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software