Maker Pro
Maker Pro

Painless micro program

J

John Larkin

Jan 1, 1970
0
John said:
John Larkin wrote:


[... CDP1802 ...]
Well, the 8051, at least in its original incantation, isn't much
of a screamer either (12 clocks per op, as well).

There's a big difference between 12 cycles of a 12MHz clock and 12
cycles of a 2 MHZ clock. Besides:

Like I said, there isn't much of a difference.



A = B + C

Compiles to something like 16 instructions if A, B and C are
randomly located in the RAM area.

The 8051 is not so different if A, B, and C are randomly located in
external RAM. I'd never use a HLL on such a beast.


MOV DPTR,#B ; 1
MOVX A,@DPTR ; 2
MOV R5,A ; 3
MOV DPTR,#C ; 4
MOVX A,@DPTR ; 5
ADD A,R5 ; 6
MOV DPTR,#A ; 7
MOVX @DPTR,A ; 8

The 8051 took 8. Now lets see if I can remember the 1802 well enough:

LD #LOW(B) ; 1 Data = low 8 of address
PLO R5 ; 2 Put to low 8
LD #HIGH(B) ; 3 Data = high 8 of address
PHI R5 ; 4 Put to high 8
LD #LOW(C) ; 5
PLO R6 ; 6
LD #HIGH(C) ; 7
PHI R6 ; 8
LD #LOW(A) ; 9
PLO R7 ; 10
LD #HIGH(A) ; 11
PHI R7 ; 12
LDN R5 ; 13 Load what R5 points to
SEX R6 ; 14 Do math with what R6 points to
ADD ; 15 Do the math
STD R7 ; 16 Store where R7 points

The instruction count for the 1802 is double that of the 8051 and with
the slower clock speed, the 1802 takes about a billion times longer to
do the same operation.


Impressive! For a 6800-family gadget, it would be

LDAA A
ADDA B
STAA C

And on the 6803, using "LDAD..." (load double etc) would do it for
word operands, using the A and B accumulators as a 16-bit register.

On a PDP-11, it would have been...

MOV.B A, C or just MOV for word data
ADD.B B, C

and the MSP430 is essentially the same, executing the sequence in
about 400 ns. Both machines allow a choice of relative (relocatable)
or absolute addressing. The rumor is that a few guys invented the
PDP-11 architecture one night in Gordon Bell's basement.

On a 68K, it would be three ops, loadreg/add/store, but you'd have
your choice of byte, word, or long.

There weren't many triple-operand machines around, ever.


John
I actually have worked with a machine that used up to 7 operands for a
single instruction. IIRC the instruction was a repeated move selective
replace using different source and destination indexes, different base
address (with a special interpretation for one), a mask value, replace
value, and iteration count.

Yikes!

Some of the CISC-ier machines, like HP 3000 and Vax and the nearly
forgotten, failed 32-bit Intel chip (what was that called?) had
outrageous instructions, like polynomial eval and hairy string ops,
but that was just tons of microcode so doesn't really count, by my
official decree. The 68332 even has a few, like the linear
interpolation thing and hi/lo limit checks.

John
I think the old intel processor you are talking about the i432 "MicroFlame".
iAPX432.

IIRC it was a four or five chip group for the processor (kinda like a 2901
bit slice machine) and about a 11 by 14 board full of TTL logic (kinda like
the old IBM PC or XT).

Three (monstrous) chips for the CPU, IIRC.

Interesting that the chip was sunk by its architectural philosophy. It
was designed near the peak of the Pascal craze, wasn't it? Similar to
the Western Digital p-machine and the HP3000. HP over-reacted and next
did the very risc-y HPPA, which originally didn't even have a
multiply, in the name of intellectual purity.

There seems to be an erratic relationship between instruction
set/memory architectures and market success. Some truly horrible
architectures have been big hits (IBM character-oriented machines,
PDP-8, x86, 8048/51, PIC) and some elegant ones have been hits, too
(S/360, PDP-11, Sparc, PPC). Itanic is still up for grabs, which is
interesting because of how many presumably smart people have invested
how many billions of dollars so far.

John
 
J

joseph2k

Jan 1, 1970
0
krw said:
Three operand opcode machines are fairly common. Any CPU with a
fused multiply-add or dest-src-src instructions will have three
opcodes.
And many of them required one source and the destination to be the same or
even gave no choice for that source and destination. Thus they did not
program like a three operand machine. I was speaking of generalized three
operand instruction set architectures.
 
K

krw

Jan 1, 1970
0
And many of them required one source and the destination to be the same or
even gave no choice for that source and destination. Thus they did not
program like a three operand machine. I was speaking of generalized three
operand instruction set architectures.

So am I. That's why I said dest-src-src rather than dest-src.
Obviously not all instructions are three operand.
 
J

Jasen

Jan 1, 1970
0
The Intel 196 family had three operand opcodes.

I once read a real old book "introduction to computer programming" it
described some sort of prime machine and a language "primus".

It was a base 10 machine addresses were 10 digits wide and it had 1000
of them, the first digit was the op-code, the other 9 were the three
operands, I don't recall a stack.

Bye.
Jasen
 
M

Michael A. Terrell

Jan 1, 1970
0
Jasen said:
I once read a real old book "introduction to computer programming" it
described some sort of prime machine and a language "primus".


Are you talking about "Prime Computer" and "Primos"?
http://en.wikipedia.org/wiki/Prime_Computer We had one of these beasts
at Microdyne for MRP and accounting.

--
Service to my country? Been there, Done that, and I've got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
 
M

MooseFET

Jan 1, 1970
0
Are you talking about "Prime Computer" and "Primos"?http://en.wikipedia.org/wiki/Prime_ComputerWe had one of these beasts
at Microdyne for MRP and accounting.

I kind of liked the idea of "pure functions" they had. I am sort of
surprised that the x86 line didn't end up with a method of enforcing
routines to only read from the passed parameters and produce a
result. It would allow optimizers to do a better job. You wouldn't
have to switch off the short circuiting of boolean evaluation when a
function call was in the statement.
 
J

Jasen

Jan 1, 1970
0
Are you talking about "Prime Computer" and "Primos"?
http://en.wikipedia.org/wiki/Prime_Computer We had one of these beasts
at Microdyne for MRP and accounting.

I'm fairly sure it was "Primus", because I recall thinking "The silly
buggsers have named it after a camp stove!" It wasn't until later that
I discovered Prime had been a computer maker. It's possible that the
book describes a fictional computer modeled on the one you describe.

I can see how a base-10 computer could suited to accounting.

Bye.
Jasen
 
M

Michael A. Terrell

Jan 1, 1970
0
MooseFET said:
I kind of liked the idea of "pure functions" they had. I am sort of
surprised that the x86 line didn't end up with a method of enforcing
routines to only read from the passed parameters and produce a
result. It would allow optimizers to do a better job. You wouldn't
have to switch off the short circuiting of boolean evaluation when a
function call was in the statement.


We had a full time programmer on staff to tweak the software, and the
system was off limits to everyone else. He did add a few reports and
functions to the MRP when I asked, and would download reports to
floppies for me, since it was only allowed from the console terminal.
there was 128 serial ports for the Wyse and other terminals scattered
all over the front office, engineering and production areas.


--
Service to my country? Been there, Done that, and I've got my DD214 to
prove it.
Member of DAV #85.

Michael A. Terrell
Central Florida
 
J

Jasen

Jan 1, 1970
0
I kind of liked the idea of "pure functions" they had. I am sort of
surprised that the x86 line didn't end up with a method of enforcing
routines to only read from the passed parameters and produce a
result.

gcc has pure, I'm not sure that it's actually enforced, I think it's
more of a hint to the optimiser so that it can optimise
It would allow optimizers to do a better job. You wouldn't
have to switch off the short circuiting of boolean evaluation when a
function call was in the statement.

when I put a function call in a boolean statement I rely on the
short-circuiting

char *a;
/* ... */
if ( a && strlen(a)>10 ) /* ... */

Bye.
Jasen
 
F

Frank Raffaeli

Jan 1, 1970
0
I was reading through the instruction set last night. It looks *very*
PDP-11, nice and orthogonal, and things move in the proper direction

MOV.B SRC, DST

unlike certain bass-ackwards machines I could name. And they're
working one level of deferral from what I'm used to,

JMP R5

I mean, how can you jump to a register? That's going to cause me
trouble.

The BIS/BIC/BIT opcodes are pure 11, although they added the AND,
which the PDP-11 didn't have. But they use some weird names, like
getting "branch" and "jump" totally backwards.

Too bad about the multiply. But we'll mostly be squaring (for RMS) and
that can be finnessed.

John

I have a square root routine I implemented as part of an RMS detector
in an MEGA 88 AVR (32-bits in, 16-bits out). I can post it somewhere
if you're interested.

I've used the MSP430 too ... it's generally noisier from an RF POV,
but I've always liked TI for reliability.

Frank Raffaeli
 
J

John Larkin

Jan 1, 1970
0
I have a square root routine I implemented as part of an RMS detector
in an MEGA 88 AVR (32-bits in, 16-bits out). I can post it somewhere
if you're interested.

I've used the MSP430 too ... it's generally noisier from an RF POV,
but I've always liked TI for reliability.

Frank Raffaeli

The square root might come in handy; I'd appreciate it. Please post
somewhere or email to me, jjlarkin atthing highlandtechnology dthing
com. How does it work... Newton?

One can always square root (or divide!) by successive approximation,
if you have a multiply.

John
 
M

MooseFET

Jan 1, 1970
0
On May 27, 3:14 am, "Michael A. Terrell"

{... Prime computers ....]
We had a full time programmer on staff to tweak the software, and the
system was off limits to everyone else. He did add a few reports and
functions to the MRP when I asked, and would download reports to
floppies for me, since it was only allowed from the console terminal.
there was 128 serial ports for the Wyse and other terminals scattered
all over the front office, engineering and production areas.

The one I had experience with was doing scientific computations not
things like MRP. For a while, they were the best deal on processors
that could do floating point.
 
F

Frank Raffaeli

Jan 1, 1970
0
The square root might come in handy; I'd appreciate it. Please post
somewhere or email to me, jjlarkin atthing highlandtechnology dthing
com. How does it work... Newton?

One can always square root (or divide!) by successive approximation,
if you have a multiply.

John

Ok, here is the code. There is a square root routine and a ratio
routine. I used it in an RMS volt-ohm meter about 5 years ago, assy
program on an AVR Mega8.

http://www.aomwireless.com/resources/code/codeutls.htm

Frank Raffaeli
 
Top