
Conditional instructions in the ARM1 processor, reverse engineered - ingve
http://www.righto.com/2016/01/conditional-instructions-in-arm1.html
======
kabdib
I really like these chip-level teardowns. It's fantastic to see how the code
you write actually executes.

On the Newton we were short of code space, and with a 4MB ROM it was expensive
(in bytes) to do "long" branches.

The ARM 610 we were using would fault on a "never" condition code (0xF....).
So we replaced thousands of fat function calls each with a single 0xFxxxxxxx
instruction that was dispatched by a simple fault handler; it was fast enough
-- the ARM's exception handling is really good -- and even though ARM Ltd.
wasn't willing to sanction what we were doing with their "undefined behavior"
grey area, they weren't going to change the handling of "NV" on the 610, and
this worked well enough to ship the first few versions of the Newt.

(The 68000 had a similar thing going on; all instructions starting with 0xAxxx
or 0xFxxx would trap, so we used them to compress calls in the ROM on the
Atari ST).

Fortunately memory is a lot less dear these days. (One recent project I was
writing firmware for, I had a conversation that went like:

H/W engineer: "Sorry, but we're going to have to change the amount of memory
the system has."

Me (apprehensive and internally ready to fight): "Okay..."

H/W: "Yeah, to save materials cost, we'll have to double it."

Me: "W00t?")

~~~
pm215
The 610 faulting on NV condition codes is part of a journey of that bit of the
instruction space from the original "really never executed, ie NOP" in the
ARM1 (which just falls out of the implementation) through "this is
unpredictable" (where UNDEF is a permitted implementation and helpful for
flushing out stray applications relying on the old behaviour) until you get to
the ARMv5 architecture, which uses the space for a collection of new
instructions (which can't be conditional). A whole sixteenth of the encoding
space turns out to be just too precious to waste.

~~~
kabdib
No question that 1/16th of the instruction space is precious. I was surprised
that ARM hadn't used it for something, even as early as the ARM610.

