CPUs and Forth
- To: misc
- Subject: CPUs and Forth
- From: Jeff Fox <fox@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 20 Jun 2000 23:15:04 -0700
- Organization: UltraTechnology
Dear MISC readers:
Earlier I wrote:
> >The changes to ShBoom made it look good to a C or Java programmer.
> >However if you ask the design engineers who had more experience with
> >Forth they may tell you that those same changes really messed
> >up the chip for Forth. They make all sorts of things that were
> >simple in Forth before very complicated. One of the engineers
> >refered to these changes as "brain damage."
> > ...
and I was asked if I could explain that in a little more detail.
I could provide a list of things that were different and how they
made things more complicated from a Forth point of view. I held
off a little because I could not do as good a job of explaining
it as the engineers who made the changes.
The first would be for instance the automatic handling of
stack overflow and underflow. The original ShBoom had a version
that was many times simpler in hardware and required a percent
more code to support it than the current version. For that
percent of code a lot of effort went into changing the chip
and the change results in other losses.
Chuck understood Forth. Chuck understood what the chip needed
to do to support his software. However it didn't look like it
cleanly supported things that other software required. Things
like C, ANS Forth, and Java that are by definition more complex
than Chuck's idea of Forth.
One Forth programmer told me about a nice article about the
ShBoom and about programming it in Forth. He said that there
were several pages dedicated to all the gory details that
the automatic stack spill and fill had on pick and role and
how complicated the code to supprt pick and roll had become.
He added how he thought it was funny because Chuck would say
that you really NEED to throw out Pick and Roll. The more
you think the chip needs to do the more complicated the
chip must become.
The point is that you can get a very close match between
hardware and software on ShBoom because Chuck had the idea
that Forth is simple and that all you need is a simple chip
to support it. When you change your idea about what Forth
is and move most of the way toward C you suddenly need a
much more complicated chip to support it. It takes a team
of engineers ten years to make the changes and as result
everything is far more complicated. The only thing that
is easier is doing complicated software that demands
complicated hardware to get performance.
If you want Forth (Chuck's definition) you need X to do it.
If you want C or Java or ANS Forth you many need much more.
Now on the more complex chip doing the things that were simple
for Chuck's simple Forth become bigger problems. You start
putting in a lot effort (like pages of explanations of the
problems of implementing pick and roll with the new version
of automatic spill and fill) supporting things that Chuck has
thrown out to make things easier. If you insist on doing things
the complicated way you will need a more complicated chip.
If you then want to do simple things they are not as simple
as they used to be.
Greg Alexander wrote:
> One thing I like about the ShBoom is that its stack has automatic overflow
> handling. Now this is the sort of thing that you would say a Machine
> Forth programmer doesn't really need. I would agree.
We seem to be in sync here.
> But it makes it
> extremely easy to efficiently implement an ANS Forth on top of it, I
(because ANS Forth is halfway to C?) Again I don't disagree. That is
the point I was making. ANS Forth is an order of magitude more
complex than what you need. If you want to (need to) go in that
direction you may find that a chip that is an order of magnitude
more complex with features to support that complexity is what you
need.
> think. When implementing a traditional high-level Forth on the P21 you
> pretty much have to use the stack only as a register, not as the main
> user-level stack. Therefore ANS code on the x21 is going to be 10x bigger
> and slower than machine code on the x21. On the ShBoom, Machine Forth may
> not be as sexy, but at least you can implement the ANS Forth easily and
> without a necessary huge speed loss. I'm not saying this as a defense of
> this tactic: it's certainly not the tactic I intend to use (I got my
> P21!), but it's a very popular tactic and it's something that has made the
> ShBoom a lot more palatable for some people. If they fall in love with
> the PTSC1000 that is not the same as falling in love with the P21, but
> it's a lot better than falling in love with the m68k!!
If you are thinking C, Java, or ANS Forth then you are likely going
to be thinking that you need a lot more than if you are just thinking
of what you need to be most efficient.
I was comparing ShBoom I to ShBoom II. There are other difference
that look good to C or Java or ANS Forth that simply slow things
down if you decide that you don't need that complexity to
start with. Just the change from word addressing to byte
address and the changes that it introduced to the instruction
set resulted in extra machine cycles being added to other
instructions. From a simple Forth point of view we might ask
why we would want to slow down this whole list of instructions
that we use all the time in Forth to support this change? The
answer is quite simple, because it is imporant to C (or Java.)
Things that were fast become slower. Things that were simple
become more complex. But yes, some things that were complex
now become more simple. It really isn't too hard to picture
how making it more complex to make C easier could also make
ANS Forth simpler and simple Forth harder and slower.
> >But VLIW is another technology going in an almost opposite
> >direction to the direction Chuck is going. I realize that
> >by making instructions only 5 bits a 20 bit word can
> >contain multiple instructions so it has a little in common
> >with VLIW but VLIW is one of the most expensive approaches
> >to hardware design.
>
> I think it's great because it gets the real advantages of VLIW, except
> that it's not very large. We're not running 128 or 256-byte buses all
> over our 5-layer PCBs just to fetch an instruction packet in a single
> cycle!
Yes. I agree. MISC has some interesting things in common with
VLIW while being at the opposite end of the complexity spectrum.
I was completely amazed a few months ago when one of the ANS Forth
experts in c.l.f who had been very vocal about all the problems
with Chuck's code and Chuck's chips for many years made the comment
that he chips were really VLIW because they could execute multiple
Forth words in a single cycle due to multiple busses like a Novix.
I was just amazed to realize that after all those years to making
all those corrections to people about what we were doing that he
had never bothered to learn the first thing about it.
Someone corrected his statement and explained that because there
were multiple 5 bit instructions in a word that the instruction
clock could run at four to six times the memory clock without
expensive cache etc. but that it certainly didn't execute
multiple Forth instructions in the same cycle like VLIW or
Novix.
I then just had to laugh at his response which was, "Well if
the chip isn't VLIW then it is completely useless and I have
no interest in it at all." (yeah, like he did before ;-)
But not knowing anything about the chip and not wanting to
know anything about the chip had not slowed him down for many
years in explaining the "truth" about this stuff to other people.
> They aren't going
> to learn anything here unless by dumb luck so trying to lecture at them
> won't do much good.
I realize that the people who just show up to insult people are
not going to listen or learn. But I think we do have mix
of people. Not everyone has been following the list from the
beginner and my have not heard many of the arguments before.
Just in case there are people who have been confused by the
people who come in here just to throw insults I do like to
provide some ballance and a different point of view from someone
who has had some actual experience with this stuff.
I will admit that I do consider unsubsribing from the list
from time to time because it often does get stuck or get
dragged down to a very low level.
> I actually strongly dislike the benchmark world.
Me too. When I did debate in high school I read great book
about how to lie with statistics. It is as if it were the
benchmark bible. very very deceptive stuff in general.
> His big thing is trying to make it into code that he knows
> the compiler will automatically optimize and he's trying to push compiler
> writers to optimize recursion. I'd rather just write what I mean.
I know what you mean. I have confidence that people are still
capable of being smarter than their PCs at this stage of technology
and don't really need to adopt the stance that they need a compiler
that is smarter than they are.
But I hear all the time that this is the goal today, don't think
about any of that stuff and just have faith that the compiler
will be smarter than you and generate optimized code for you.
We are told that we should just have faith that the code in the
canned libraries is going to be efficient and better than code
we could write ourselves. We are told that we need hardware that
is just too complicated for humans to deal with and the only
option is tools that are smarter than we are. We have taken
a very different approach where we enjoy being in control and
being able to think about the problem.
> at all. My own input device is going to be pretty zany on its own and I'm
> seriously contemplating a new style of FORTH user interface that will be
> better for the extremely small display I'll probably end up with.
And you won't need Windows to support it? ;-)
> Actually, there is the joke that goes something like this:
> Windows is a 32-bit front-end
> on a 16-bit hack
> for an 8-bit processor
> ...something about 4-bit...
> made by a 2-bit company
> without 1-bit of sense.
:-)
> >MISC means ROM boot. (the way things boot is your choice.)
>
> heh, I was planning on using SRAM boot since the cost of keeping such a
> low-power design running all the time is so low...but PCs are definitely
> ROM-boot only. You may think you're booting off a hard disk, but I've
> never met a PC where you waited less than 5 seconds for the BIOS to scroll
> by.
Well I don't make a distinction there. On P21 the memory select
pins had funny names. SRAM select was called I/O because Ting
was placing his I/O devices in the SRAM space. On F21 the pins
are named SRAM select and ROM select I think.
But in this case these refer to a 20 bit memory interface with
SRAM timing and an 8 bit boot interface with SRAM (or ROM) timing.
It doesn't matter at all whether you put ROM, FLASH, or SRAM
into this 8 bit boot space.
P21Forth will run on ROMs but it is really defined to run
in non-volatile SRAM. The firsst development system came
with a PCMCIA SRAM card instead of a boot ROM. The ability
to edit BLOCKS is of little value when the thing is in ROM
and useful when using SRAM.
What I was refering to was the idea that MISC must have
a separate 8 bit boot space. It could boot directly from
the 20 bit memory, it could boot from a serial memory,
it could boot from the network, etc. That was the point
I was making.
Putting an SRAM chip in the 8 bit boot ROM space on these
chips is still what I call "booting from ROM" (or at least
the 8 bit ROM boot space.) I was just making the point that
while this method of operation was choosen for most of the
chips Chuck has done that they could also boot from internal
ROM, from a network etc. etc.
> >MISC mainly means cheap. (false. The extremely low power, high
> > performance, and rugged environmental operating characteristics
> > mean that MISC chips have been considered for the most expensive
> > types of applications like spacecraft.)
>
> What spacecraft were you talking about earlier, btw?
iTV was spawned from a fund available to NASA contractors who
wanted to take high technology developed for NASA into the
commercial marketplace. Gary Langford and Joe Zott had been
doing spacecraft design for NASA through SkyWatch and had
submitted designs for various spacecraft that proposed using
Chuck's chips. They got the idea that they chips could also
make very cheap internet appliances and iTV was born.
I go back quite a ways. I was a physics major at U of Iowa when
they built a number of experiments for the deep space probes.
They were the only University putting experiments and equipment
into those missions and I looked over shoulders and asked a lot
of questions. Those were days before Forth chips let alone MISC.
Between that time and when I started working with MISC I sold
a couple of Forth systems to scientists working at NASA and
heard stories from them about the use of Forth on early
spacecraft. They used the silicon on saphire 1802 in those
days because it was low power and could take radiation. They
were strange processors and one of the things that made them
useful was Forth. They were weak so a lot of them were required.
Those early deep space exploring spacecraft were Forth multiprocessing
robots. Forth made em work and they worked remarkably well.
As I say as far as I know Forth is the only thing we have sent
outside of our own solar system (and not because we were trying
to get rid of it either!)
> >MISC hardware is complicated. (MISC hardware is far less complicated
> > than most hardware. The problem is that hardware is complicated
> > to software folks.)
>
> That was really funny to me.
Yes, but I am sure you know what I mean. Many people have been
taught that the whole point of software is to completely hide
the hardware so that programmers wont have to deal with hardware.
They will say that hardware issues should be completely invisible
to a programmer. We have heard it here recently. ;-)
> I went onto comp.arch.fpga a few months ago
I used to read comp.arch, comp.embedded, comp.realtime, comp.lang.forth,
comp.robotics, and comp.robotics.ai.philosophy
eventually I got tired of being called a liar and snake oil
salesman or cultist for trying to tell people things like that
the stuff that gets posted reglarly (such as that 100mhz pentium
will only support 2000 empty loops per second max) are just not
true. I found the majority of the people in those groups
are so used to bloated and inefficient software that they
really believe things like that a Pentium needs 50 thousand
instructions inside of an empty loop.
Most often when we would discuss most anything I would be
talking nano-seconds or micro-seconds and they would be
be talking milli-seconds or seconds. So when they would say
that with a thousand dollar computer they could do such
and such in 20 milliseconds and I would say well we do the
same thing in 20 microseconds or 20 nanoseconds on a machine
costing almost nothing this was pretty hard for them to
grasp. The same thing with replacing megabytes of code
with kilobytes of code. (Well they are related.)
Eventually I decided to not bother telling those people
stuff that they really don't want to consider.
Eventually I put my focus on the MISC mail list because I
figured that the people here would be more informed and
interested in real discussions of this alternate technology.
But I must admit that from time to time I get discouraged
by the number of people who come here just to call names.
I can completely relate to your problems in trying to explain
stuff to people and give them a little education in newsgroups.
It can be very difficult because everyone is an expert and
some of the "experts" just make up whatever supports their
case. I have sometimes sent email and asked people why
they post stuff that they obviously made up. I have been
told that it is what makes the internet fun and that no one
can stop them from doing it.
> I think that some of the people who come onto this list and say "man, MISC
> ROCKS!!...now add a cache and a 32-bit bus so it can actually be
> useful...while you're at it add these three instructions and an
> MMX-compatable FPU!" can come across as mindless sicophants.
I have sympathy for this however. I mean I like the idea of making
a 32 bit version. I can see that cache might be nice for some
things. If you know your problem you might want some special
instruction changes. etc. etc.
When someone says that they want a MISC chip but with FP and
multiply accumulator and matrix multiply circuits and that is
a 32 or 64 bit bus and that is also software compatible with
Intel chips but that they want to also make it 1000x smaller
than Intel chips like other MISC chips I say, "Good luck. I
will impressed if you can do it. So will a lot of other
people. You will revolutionize computing. But it might
be just a bit harder than you think it will be."
> it "Greg's Forth." I think I'm lucky that I learned FORTH from a very
> out-dated webpage on forth.org instead of the ANS standard (which I've
> tried to read, but found unintelligible). I saw that first 10x in plain
Well to be fair, the ANS standard was never intended as tutorial on
Forth let alone a tutorial on how to write good Forth. Like other
standards it aimed for system implementors not end users. As a
result I think understanding the standard is many times more
complicated than understand a real Forth system even one that is
ANS compliant.
> Reminds me of when I thought of FORTH as a scripting language because it
> was so easy to implement a FORTH interpretter in C.
One of my main complaints of ANS is that it is being used to promote
Forth as yet another inefficient scripting language extension to C.
I would hate to see that become Forth's fate. I prefer to think of
it as a systems language than a scripting language. But if your
perspective is that the OS, the compiler and most of the programs
are written in C then about the only place to put Forth is as
a scripting language extension to the C enviroment and most of
the concern about the Forth will really be C interfacing issues.
I think of Forth as providing the OS, the compiler, the programs
and so think of it as needing to be an effient systems language
and don't see that the main issue is making it conform to the
rules of a C environment On the other hand that is the flavor
I get from ANS.
> >The problem is that some people don't realize that it is a joke.
> >In America calling someone a cultist is about as low as one can
> >go. There is nothing worse or more dangerous than cultists, that
> >is the meaning of the word. It carries the strongest of negative
> >connotations. Send in the tanks and flame throwers, it doesn't
> >matter if there are children there, there are also cultists! This
> >is the kind of rhetoric that encourages hate crimes. I would have
> >never thought that computer software would be a target of religious
> >persecution. Many people came to America to practice their religion
> >in peace without persecution. Funny how programming a computer
> >can cause some people to tell others about your religion or that
> >you are really a cultist. Who would have ever guessed that people
> >would behave like that? Interesting phenomonon.
>
> On the one hand I'm annoyed that they are so negative towards us. On the
> other hand, it doesn't really matter.
I have received threats before from people who told me that they
hear about a "dangerous Forth cultist." As I say some people do
take this sort of nonsense seriously.
People can say that we should just ignore people who enjoy
trying to motivate people to perform hate crimes. But we live
in a strange culture where some people have very shallow world
views and actually act out after being motivated by other
people's hate statements.
> I got a lot of harsh words with my
> message of simplicity on comp.arch.fpga, but nobody drove over here and
> shot at my house. And in a very real sense FORTH /is/ a religion.
Are you saying that as long as they aren't shooting at _you_ you
think it is good to encourage them or whip them into a frenzy
with more talk that Forth is a religion? I really don't like to
dignify their attacks with discussions but occasionaly I see
people saying that they like Forth but agree it is a religion...
Perhaps you are saying that it is "your" religion. If so
I will stop saying that I have yet to see anyone claim that
it was their religion. I have see plenty of people claiming
it is my religion. And I have always said that no one has
yet claimed that it was their religion.
Please clarify. Are you being the first person to step up
and say that Forth /is/ your religion? If you are saying
it is "a" religion but not "your" religion then you are
publishing stuff about other people, saying what their
religion really is, calling them liars, saying they have
no real religion etc. As the person most often associated
with such attacks I would prefer to see you explain if
you are talking about yourself or someone else such as me.
It is ok to call it a religion as long as they are not shooting at you?
If calling it a religion gets them to shoot someone else that is ok?
> Not a
> religion like Fortran where backwards-portability and understandability by
> idiots who have know intention of understanding. Not a religion like
> Christianity where your greatness is measured by how blind your faith is.
> With FORTH our religion values not control over people, but control over
> the computer. We don't value blind faith, we value constant open
> questioning -- I know that if I, personally, find another system this
> ridiculously simple, I will seriously consider converting...I'm not any
> more loyal to FORTH now than I was to C back then, I'm still waiting for
> something better to come along (though I have enough experience now that
> I'm not so confident that such will happen). We have an aesthetic sense
> very closely tied to minimalism, simplicity. Aesthetic sense has long
> been a religious issue -- many eastern religions value understanding and
> simplicity in life, whereas many western religions value complicated
> hierarchical governments and blind faith. We are talking very much
> about religious issues -- just because we aren't shooting homosexuals or
> abortion doctors doesn't mean we aren't a religion -- not all religion has
> the same dark history of Christianity or Islam.
But shooting homosexuals, abortion doctors and dangerous cultists
is relgion to some people. I really really wish people could
stay away from the religion, high priest, and cult bullshit.
I am happy to disucss technology, science, hardware, programming,
etc. but I get very very tired of people trying to paint this
as religion. Why whip up the morons looking to protect
society from the dangerous cultists?
The thing I find most insulting about it is that it denies
that we have any real religious belief. It seems to deny that
we have any concept of what religion is. As an ordained minister
and as someone who has done meditation for over fourty years I am
amazed at how many people write things about me telling other
people about my religion. If you haven't gone into a newsgroup
and found people discussing the idea that your "religion"
is a programming language, that you think Chuck Moore is "God",
you cannot appreciate what it is like to be the target of
this sort of thing.
Anyone who states that my religion is Forth is also calling
me a liar, saying I lie about what my religous beliefs and
don't understand the first thing about religion. They may
go on to go from insult to hate by introducing terms like
cultist or sect. Whenever I see myself targeted for this
sort of attack I question wheter there is anything positive
enough that I could add to the group that could make up for the
hate and negativity being introduced.
Jeff Fox