Re: Structured Programming using Forth
- From: "rickman" <gnuarm@xxxxxxxxx>
- Date: 5 Apr 2007 05:52:48 -0700
I am probably going to regret replying to your post, but I want to
address one thing. You said several times, that programming the
SeaForth chip is more like assembly language than a high level
language. I think you are ignoring the fact that Forth is
extensible.
I don't agree with that. I don't know what tools they have but if you
are programming in Forth, then it should be a simple matter to
automate the examples you gave so that the programmer does not need to
know anything about them as he works. Changing a literal zero to a
DUP DUP XOR is just a matter of defining a word that is compiled
inline. If I understand the use of the NOPs to fill out a word to
force a particular alignment, that can also be automated as is done in
the tools for the VLIW TI DSPs. Using + and NOT to form - is also
just a matter of defining a word that is compiled inline.
I considered all of this when I was looking at a Forth compiler for a
stack CPU I had designed. Just like there is a flag to indicate that
a given word is immediate, a flag can indicate a word is to be
compiled inline. That is a significant improvment for small
definitions and helps keep the instruction set small.
I used operation usage frequency data from Koopman's book to structure
the instruction set and kept the set to about 37 unique instructions.
In developing the set I had to consider the efficiency of less often
used instruction if not made into opcodes. I realized that it would
be a simple matter to inline code the two or three opcodes required to
do this and the user would not need to know a thing about it.
Likewise I have a very few situations where NOPs would need to be used
to separate literals or to align instructions. Again this is simply
done by the compiler.
So there is nothing unique about the SeaForth chip that precludes the
use of Forth as a high level language.
John Passaniti wrote:
And on top of all this, it appears to me (and I welcome correction from
anyone who knows better) that although the tools used to program the
SEAforth chips are in Forth, that you really aren't programming in what
most would think as Forth. It's more like an assembly language that
just happens to have a Forth flavor. You see this in their preliminary
applications guide, where the user is told about tricks like saving
program memory by replacing a literal zero with a "dup dup xor"
sequence, carefully placing "." (NOP) to generate the most efficient
code, and synthesizing "-" from "+" and "not".
.
- Follow-Ups:
- Re: Structured Programming using Forth
- From: Brad Eckert
- Re: Structured Programming using Forth
- From: John Passaniti
- Re: Structured Programming using Forth
- References:
- Re: Structured Programming using Forth
- From: jcomeau_ictx
- Re: Structured Programming using Forth
- From: Alex McDonald
- Re: Structured Programming using Forth
- From: rickman
- Re: Structured Programming using Forth
- From: Alex McDonald
- Re: Structured Programming using Forth
- From: J Thomas
- Re: Structured Programming using Forth
- From: Paul E. Bennett
- Re: Structured Programming using Forth
- From: John Passaniti
- Re: Structured Programming using Forth
- From: J Thomas
- Re: Structured Programming using Forth
- From: John Passaniti
- Re: Structured Programming using Forth
- From: J Thomas
- Re: Structured Programming using Forth
- From: John Passaniti
- Re: Structured Programming using Forth
- Prev by Date: Re: What is Forth best at?
- Next by Date: Re: What is Forth best at?
- Previous by thread: Re: Structured Programming using Forth
- Next by thread: Re: Structured Programming using Forth
- Index(es):
Relevant Pages
|