Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: I found a F...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 45 of 53 Topic 3681 of 4325
Post > Topic >>

Re: I found a FORTH stack optimzer, but could use a better version.

by "Rod Pemberton" <do_not_have@[EMAIL PROTECTED] > Jan 12, 2008 at 04:31 AM

"Jenny Brien" <jennifer@[EMAIL PROTECTED]
> wrote in message
news:op.t4r035zcaozhuq@[EMAIL PROTECTED]
> On Fri, 11 Jan 2008 08:34:02 -0000, Rod Pemberton
> <do_not_have@[EMAIL PROTECTED]
> wrote:
> > "Jenny Brien" <jennybrien@[EMAIL PROTECTED]
> wrote in message
> >
news:ab815318-9e67-4709-a479-a5fdae1bd429@[EMAIL PROTECTED]
> >> I'm interested in the minimal set needed to implement the normal
Forth
> >> stack operators.
> >
> > Then these might be of use which use rstack:
> >
> I'm thinking more of minimal hardware requirement in terms of registers
> and opcodes. I know that it's /possible/ to do any manipulation with
just
> the two stacks and a single register, but it's not very efficient.
>

What is your background EE or CS, etc.?  Is this for an existing cpu? new
cpu? virtual machine?

> I'm thinking more of minimal hardware requirement in terms of registers
> and opcodes.

What do you have or are considering so far?  I've been mentioning x86
(80486
or later actually) since that's what I'm currently using.  As shown
throughout this thread, some of the FORTH words map directly to the
instructions of x86 which are somewhat "****table", e.g., more RISC like
than
CISC (push,pop,mov).  While others can be built from those, and probably
only a few require the more "non-****table" x86 CISC instructions.

Although I'm mildy familiar with programming in FORTH, I'm by no means a
FORTH programmer.  I know much more about the internals of FORTH than
programming in it - which is why I've kept asking _you_ questions about
used
words, etc...  And, why I'm a bit surprised no one has referred me to the
c.l.f. FAQ.  Anyway, there is much in this thread, and probably other
c.l.f.
posts searchable via Google Groups.

I've mentioned Koopman a few times in this thread, but without indication
of
familiarity or lack of from you.  Are you familiar with FORTH related
works
of Charles Moore, Leo Brodie, Anton Ertl, Brad Rodriquez, Phil Koopman,
Jim
Brooks, Byte magazine articles?  E.g., have you reviewed Charles Moore's
various cpu's such as the F21? Or, his Machine or Color FORTH for his
cpu's?
I'm sure they did much work trying to find the optimal set of registers
needed for FORTH.  They may have even tried to optimize the FORTH words.
What about Phil Koopman's analysis on FORTH instruction usage?  The
dynamic
instruction frequencies, while out of date, should still be somewhat valid
today.  Are you familiar with a basic FORTH virtual machine as presented
by
Brad Rodriquez in "Moving FORTH", e.g., W, IP, PSP, RSP, UP, and/or X,
TOS?
Differences between "threading" types: STC, DTC, ITC, TTC?  I'm familiar
with much of that, but what I learned of it was many years ago... roughly
'88 and '92 - so I've probably forgotten much - perhaps even some things
critical to this discussion...  But, fortunately, almost all of it is
online
today and I can review.  :-)

Some links related to what we've been discussing:

"A STUDY OF FORTH INSTRUCTION FREQUENCIES" in "Stack Computers" by Phil
Koopman
http://www.ece.cmu.edu/~koopman/stack_computers/sec6_3.html

"Stack Computers" main index
http://www.ece.cmu.edu/~koopman/stack_computers/index.html

Chuck Moore's F21 cpu, MachineFORTH et. al...
http://www.ultratechnology.com/

Brad Rodriquez's "Moving FORTH" series on older FORTH implementations.
http://www.zetetics.com/bj/papers/

Jim Brooks "Fig-FORTH internals"
http://www.jimbrooks.org/web/forth/forthInternals.php

> The fastest code needs at least n+1 registers or stacks to re-sort n
> items. If all were are on the hardware stack to begin with then 2SWAP
> would take 8 moves (pop all to registers, push all back in order),
reduced
> to 6 with the top two items cached. Using a second stack instead of
> multiple registers hurts more than I thought at first; using my rcheme I
> cannot implement 2SWAP in fewer than 13 moves.

Is this for an existing cpu?  If not, then you just renumber or reorder
the
registers using electronic circuitry for a SWAP,ROLL,ROT.  You don't have
to
actually move the values around...  If so, then a fast native ROT or ROLL
would help for 2SWAP.

:2SWAP ROT >R ROT R>;
:2SWAP 3 ROLL 3 ROLL;

For ****fting more than just a few stack items on x86, i.e., you need ROLL
or
more than one ROT - like for 2SWAP, you might consider using one of x86's
underused CISC string instructions, rep movsb, instead of a sequence of
push's, pop's, and mov's.  It requires some overhead to setup, so it's
probably not good for smaller moves... i.e., good for n ROLL, if n is
large
enough.


Rod Pemberton
 




 53 Posts in Topic:
I found a FORTH stack optimzer, but could use a better version.
"Rod Pemberton"  2008-01-06 00:26:01 
Re: I found a FORTH stack optimzer, but could use a better versi
mhx@[EMAIL PROTECTED] (M  2008-01-06 09:22:17 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 04:37:47 
Re: I found a FORTH stack optimzer, but could use a better versi
mhx@[EMAIL PROTECTED] (M  2008-01-06 11:00:53 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 06:10:48 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 06:24:17 
Re: I found a FORTH stack optimzer, but could use a better versi
mhx@[EMAIL PROTECTED] (M  2008-01-06 12:58:34 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:27:20 
Re: I found a FORTH stack optimzer, but could use a better versi
Coos Haak <chforth@[EM  2008-01-06 21:16:07 
Re: I found a FORTH stack optimzer, but could use a better versi
"Ed" <nospam  2008-01-07 17:51:08 
Re: I found a FORTH stack optimzer, but could use a better versi
Albert van der Horst <  2008-01-07 17:22:03 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 13:00:32 
Re: I found a FORTH stack optimzer, but could use a better versi
none <""jan\  2008-01-06 14:07:31 
Re: I found a FORTH stack optimzer, but could use a better versi
mhx@[EMAIL PROTECTED] (M  2008-01-06 15:27:04 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:32:53 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:05:30 
Re: I found a FORTH stack optimzer, but could use a better versi
stephenXXX@[EMAIL PROTECT  2008-01-06 13:42:55 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 06:09:25 
Re: I found a FORTH stack optimzer, but could use a better versi
stephenXXX@[EMAIL PROTECT  2008-01-06 13:46:06 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 18:25:08 
Re: I found a FORTH stack optimzer, but could use a better versi
stephenXXX@[EMAIL PROTECT  2008-01-07 10:58:44 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-07 21:39:25 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-07 22:57:58 
Re: I found a FORTH stack optimzer, but could use a better versi
Albert van der Horst <  2008-01-08 08:13:03 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-08 05:07:03 
Re: I found a FORTH stack optimzer, but could use a better versi
Albert van der Horst <  2008-01-08 18:26:32 
Re: I found a FORTH stack optimzer, but could use a better versi
Alex McDonald <blog@[E  2008-01-08 03:04:52 
Re: I found a FORTH stack optimzer, but could use a better versi
Roelf Toxopeus <these3  2008-01-06 15:24:29 
Re: I found a FORTH stack optimzer, but could use a better
winston19842005 <bjjly  2008-01-06 10:13:11 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:01:26 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:52:02 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 08:54:01 
Re: I found a FORTH stack optimzer, but could use a better versi
Bernd Paysan <bernd.pa  2008-01-06 18:34:43 
Re: I found a FORTH stack optimzer, but could use a better versi
helmwo@[EMAIL PROTECTED]   2008-01-06 10:27:48 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 13:26:05 
Re: I found a FORTH stack optimzer, but could use a better versi
Bernd Paysan <bernd.pa  2008-01-06 23:02:25 
Re: I found a FORTH stack optimzer, but could use a better versi
kenney@[EMAIL PROTECTED]   2008-01-07 09:47:13 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-06 13:43:00 
Re: I found a FORTH stack optimzer, but could use a better versi
Jenny Brien <jennybrie  2008-01-08 14:06:38 
Re: I found a FORTH stack optimzer, but could use a better versi
Bill <bill@[EMAIL PROT  2008-01-08 21:20:47 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-09 04:57:34 
Re: I found a FORTH stack optimzer, but could use a better versi
Jenny Brien <jennybrie  2008-01-10 09:50:29 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-11 03:34:02 
Re: I found a FORTH stack optimzer, but could use a better versi
"Jenny Brien" &  2008-01-11 17:49:07 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-12 04:31:21 
Re: I found a FORTH stack optimzer, but could use a better versi
astrobe <fdubois76@[EM  2008-01-14 09:31:33 
Re: I found a FORTH stack optimzer, but could use a better versi
foxchip <fox@[EMAIL PR  2008-01-19 10:11:10 
Re: I found a FORTH stack optimzer, but could use a better versi
stephenXXX@[EMAIL PROTECT  2008-01-20 15:33:32 
Re: I found a FORTH stack optimzer, but could use a better versi
ygrek <ygrek@[EMAIL PR  2008-01-06 12:31:47 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 17:58:45 
Re: I found a FORTH stack optimzer, but could use a better versi
anton@[EMAIL PROTECTED]   2008-01-06 18:22:00 
Re: I found a FORTH stack optimzer, but could use a better versi
"Rod Pemberton"  2008-01-06 18:18:56 
Re: I found a FORTH stack optimzer, but could use a better versi
ygrek <ygrek@[EMAIL PR  2008-01-07 09:05:18 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:03:35 CST 2008.