Re: a dozen cpu's on a chip



On May 12, 12:30 pm, "Tim Williams" <tmoran...@xxxxxxxxxxx> wrote:
"MooseFET" <kensm...@xxxxxxxxx> wrote in message

news:d42047ca-9997-4adc-b56d-c7165eef9f53@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If we assume a Harvard like processor where the code space is never
written to

Bleh, I hate it already! Here's a perfect example from my own experience:

OPCODE_INC = 40h ; INC AX
OPCODE_DEC = 48h ; DEC AX

SET_X_INC textequ <mov byte ptr cs:incdecx,OPCODE_INC>
SET_X_DEC textequ <mov byte ptr cs:incdecx,OPCODE_DEC>
(and for Y)

The code for the inner loop (containing label incdecx) is identical for all
four directions (+/-X, +/-Y) except for this one opcode. So I have it
change, instead of quadrupling the entire routine, or putting conditionals
inside the loop (gack!).

The IBM360/IBM370 had an easy solution for this. You could exec and
instruction that was held in a register.

You can also simply have N copies of the routine. Since memory is
cheap and the results would be a faster machine, I see it as worth the
extra copies.

I don't know just how often this is done, although I recall MS is fond of
it for some purposes (obfuscated, self-modifying code appears in a few
shady places, like for testing compatibility).

When stupidity will serve as an explanation, you need look no further.

Compressed executables, I
would suppose, have to do this.

Those are decompressed once at load time. This could be done in the
load process. I know that MS does it by building in the code to do
the decompress (eg: format.com) but that would serve as evidence that
it is a bad idea.

Situations like this example are
definitely an efficient place to use Von Neumann architecture.

No, it really isn't. You are better off to have a Harvard that sees
the code space of another processor as its data space. That way the
decompress process can go much faster since you keep the advantages of
the Harvard.


Funny, it also occurs to me that, in protected mode x86 (the above runs in
real mode 808x, BTW), you could put the code in a read-only segment, so
writing to it would throw a page fault, thereby having the same effect.

Except that this means that the data and code transactions still go on
the same bus.


Tim

--
Deep Fryer: A very philosophical monk.
Website @http://webpages.charter.net/dawill/tmoranwms

.


Quantcast