Finites State Machine (OT?)

Jeffrey C. Dege wrote:

In his sig:

When, therefore, inquiry passes on the mere question of the
weapon and starts to consider the motive, a man who is used arms in
self-defense is not regard is having carried with a homicidal aim.
^^^^^^^^^^^^^

allegly from Marcus Tulius Cicero.

Could you please produce the original Latin - this doesn't parse (as an
English sentence).

Thanks,

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)
 
On Fri, 21 May 2004 21:06:34 +0200, Toon Moene <toon@moene.indiv.nluug.nl> wrote:
Jeffrey C. Dege wrote:

In his sig:

When, therefore, inquiry passes on the mere question of the
weapon and starts to consider the motive, a man who is used arms in
self-defense is not regard is having carried with a homicidal aim.
^^^^^^^^^^^^^

allegly from Marcus Tulius Cicero.

Could you please produce the original Latin - this doesn't parse (as an
English sentence).
THE SPEECH OF M. T. CICERO IN DEFENCE OF TITUS ANNIUS MILO.
M. Tulli Ciceronis pro T. Annio Milone oratio

This, therefore, is a law, O judges, not written, but born with
us,--which we have not learnt or received by tradition, or read, but
which we have taken and sucked in and imbibed from nature herself;
a law which we were not taught but to which we were made,--which we
were not trained in, but which is ingrained in us,--namely, that if
our life be in danger from plots, or from open violence, or from the
weapons of robbers or enemies, every means of securing our safety is
honourable. [11] For laws are silent when arms are raised, and do
not expect themselves to be waited for, when he who waits will have to
suffer an undeserved penalty before he can exact a merited punishment.

Est igitur haec, iudices, non scripta, sed nata lex, quam non
didicimus, accepimus, legimus, verum CX natura ipsa adripuimus,
hausimus, expressimus, ad quam non docti sed facti, non instituti sed
imbuti sumus, ut, si vita nostra in aliquas insidias, si in vim et
in tela aut latronum aut inimicorum incidisset, omnis honesta ratio
esset expediendae salutis. [11] Silent enim leges inter arma nec se
exspectari iubent, cum ei, qui exspectare velit ante iniusta poena
luenda sit quam iusta repetenda.

--
All the great governments of the world---those now existing, as well
as those that have passed away---have been of this character. They have
been mere bands of robbers, who have associated for purposes of plunder,
conquest, and the enslavement of their fellow men. And their laws, as
they have called them, have been only such agreements as they have found
it necessary to enter into, in order to maintain their organizations,
and act together in plundering and enslaving others, and in securing to
each his agreed share of the spoils.

All these laws have had no more real obligation than have the agreements
which brigands, bandits, and pirates find it necessary to enter into
with each other, for the more successful accomplishment of their crimes,
and the more peaceable division of their spoils.

- Lysander Spooner, "Natural Law"
 
On Fri, 21 May 2004 09:59:54 -0700, John Larkin <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:
On a good CPU, with lots of registers, you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.
The CDC6600 had no hardware stack. The calling convention was to begin
every subroutine with a jump to zero and to end every subroutine with
a jump to that jump-to-zero. The calling routine would replace the
jump-to-zero with a jump to the instruction following the call, then
jump to the instruction following the what is no longer a jump-to-zero.

Worked fine, if you could get over your willies about self-modifying code.
For languages in which reentrent function calls were forbidden, anyway.

Like FORTRAN.

It'd be a royal bitch to implement a C compiler on that hardware.

The lack of byte-addressing and the 6-bit character set would see to that.

--
From briefcase then there comes a list of things we must revise.
And all but four within the room are taken by surprise.
And all but four are thinking of their last job with remorse:
The customer, the manager, the doggy and the horse.
 
On 21 May 2004 22:22:17 GMT, jdege@jdege.visi.com (Jeffrey C. Dege)
wrote:

On Fri, 21 May 2004 09:59:54 -0700, John Larkin <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:

On a good CPU, with lots of registers, you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.

The CDC6600 had no hardware stack. The calling convention was to begin
every subroutine with a jump to zero and to end every subroutine with
a jump to that jump-to-zero. The calling routine would replace the
jump-to-zero with a jump to the instruction following the call, then
jump to the instruction following the what is no longer a jump-to-zero.

Worked fine, if you could get over your willies about self-modifying code.
For languages in which reentrent function calls were forbidden, anyway.

Like FORTRAN.

It'd be a royal bitch to implement a C compiler on that hardware.

The lack of byte-addressing and the 6-bit character set would see to that.

The PDP-8 JMS call saved the return address in the first location of
the called routine.


JMS SUBBIE calls the sub,



SUBBIE, 0

..... subroutine code...

JMP I SUBBIE

is the return, an indirect jump through the start of your own
subroutine! It was a paged machine, of course. No stack. Rick Merrill
managed to jam FOCAL-8, a reentrant, stack-oriented, floating-point
language, with editor and all, into 4k x 12 bits of core. I used to do
steamship propulsion system simulations on it.

I think the PDP-8 architecture became the low-end PIC stuff.

The PDP-11 taught me how to think; its architecture was/is beautiful.


John
 
"John Larkin" <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote in
message news:bi1ta0prmin27gqkltveba8oqhigcndcsa@4ax.com...
On 21 May 2004 22:22:17 GMT, jdege@jdege.visi.com (Jeffrey C. Dege)
wrote:

On Fri, 21 May 2004 09:59:54 -0700, John Larkin
jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:

On a good CPU, with lots of registers, you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.

The CDC6600 had no hardware stack. The calling convention was to begin
every subroutine with a jump to zero and to end every subroutine with
a jump to that jump-to-zero. The calling routine would replace the
jump-to-zero with a jump to the instruction following the call, then
jump to the instruction following the what is no longer a jump-to-zero.

Worked fine, if you could get over your willies about self-modifying
code.
For languages in which reentrent function calls were forbidden, anyway.

Like FORTRAN.

It'd be a royal bitch to implement a C compiler on that hardware.

The lack of byte-addressing and the 6-bit character set would see to
that.


The PDP-8 JMS call saved the return address in the first location of
the called routine.


JMS SUBBIE calls the sub,



SUBBIE, 0

.... subroutine code...

JMP I SUBBIE

is the return, an indirect jump through the start of your own
subroutine!
The 1108 etc. had that feature long before Ken Olsen founded DEC. It also
had, what most mainframe systems had, an instruction that branched to a
subroutine and stroed the address of the next instruction in a register (IBM
S/360 had the same thing). This was advantagous as it wasn't self modifying
and a subroutine could simply save the contents of that register in a memory
location if necessary. If it was a leaf routine, it didn't even have to do
that if it didn't need to use that register. If a stack was desired (there
was no hardware stack - again along with most mainframes except of course
the Burroughs large scale systems) you simply by convention used a register
as a stack pointer, so such machines support recursive languages today.

--
- Stephen Fuld
e-mail address disguised to prevent spam
 
In article <e2dsa0dkv2jvvcfmvgdaq65rknnu4t25ga@4ax.com>,
John Larkin <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:

On a good CPU, with lots of registers, you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.
Indeed, for many programs I use a stack only when there is recursion, and
I make sure there is a stack check at one point in the recursive chain.
For statically nested subroutines I pick registers such that arguments
are likely already in the right register, and return registers are where
the caller wants the result. With proper design, and some conventions
for commonly-used idioms, this can be made to work rather well; spill code
is rarely needed. The whole concept of named variables falls largely by
the wayside -- except in the comments, of course, to help the reader keep
track of what is in the registers at relevant points. Most small leaf
subroutines end up using no storage whatsoever -- and that includes most
of the common run-time functions such as string parsing, number conversion
etc. -- it makes it trivial to write re-entrant code.

Michel.
 
On 22 May 2004 01:34:07 GMT, hack@watson.ibm.com (hack) wrote:

In article <e2dsa0dkv2jvvcfmvgdaq65rknnu4t25ga@4ax.com>,
John Larkin <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:

On a good CPU, with lots of registers, you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.

Indeed, for many programs I use a stack only when there is recursion, and
I make sure there is a stack check at one point in the recursive chain.
For statically nested subroutines I pick registers such that arguments
are likely already in the right register, and return registers are where
the caller wants the result. With proper design, and some conventions
for commonly-used idioms, this can be made to work rather well; spill code
is rarely needed. The whole concept of named variables falls largely by
the wayside -- except in the comments, of course, to help the reader keep
track of what is in the registers at relevant points. Most small leaf
subroutines end up using no storage whatsoever -- and that includes most
of the common run-time functions such as string parsing, number conversion
etc. -- it makes it trivial to write re-entrant code.

Michel.
What's a leaf?

John
 
On Fri, 21 May 2004 19:54:49 -0700, John Larkin <jjlarkin@highlandSNIPtechTHISnologyPLEASE.com> wrote:
On 22 May 2004 01:34:07 GMT, hack@watson.ibm.com (hack) wrote:

Most small leaf
subroutines end up using no storage whatsoever

What's a leaf?
The end of a branch on a tree.

If you think of subroutines calling other subroutines as a tree, the
leafs are the subroutines that don't call any other subroutines.

Of course, subroutine calls diagrams aren't really trees, their directed
graphs - a single subroutine can be called from several other places in
the graph - but a certain sloppiness of idiom isn't uncommon.

--
APL is a mistake, carried through to perfection. It is the language of the
future for the programming techniques of the past: it creates a new generation
of coding bums.
-- Edsger W. Dijkstra, SIGPLAN Notices, Volume 17, Number 5
 
Jeffrey C. Dege wrote:
On Fri, 21 May 2004 21:06:34 +0200, Toon Moene <toon@moene.indiv.nluug.nl> wrote:
Jeffrey C. Dege wrote:

In his sig:

When, therefore, inquiry passes on the mere question of the
weapon and starts to consider the motive, a man who is used arms in
self-defense is not regard is having carried with a homicidal aim.
^^^^^^^^^^^^^

allegly from Marcus Tulius Cicero.

Could you please produce the original Latin - this doesn't parse (as an
English sentence).

THE SPEECH OF M. T. CICERO IN DEFENCE OF TITUS ANNIUS MILO.
M. Tulli Ciceronis pro T. Annio Milone oratio

This, therefore, is a law, O judges, not written, but born with
us,--which we have not learnt or received by tradition, or read, but
which we have taken and sucked in and imbibed from nature herself;
a law which we were not taught but to which we were made,--which we
were not trained in, but which is ingrained in us,--namely, that if
our life be in danger from plots, or from open violence, or from the
weapons of robbers or enemies, every means of securing our safety is
honourable. [11] For laws are silent when arms are raised, and do
not expect themselves to be waited for, when he who waits will have to
suffer an undeserved penalty before he can exact a merited punishment.

Est igitur haec, iudices, non scripta, sed nata lex, quam non
didicimus, accepimus, legimus, verum CX natura ipsa adripuimus,
hausimus, expressimus, ad quam non docti sed facti, non instituti sed
imbuti sumus, ut, si vita nostra in aliquas insidias, si in vim et
in tela aut latronum aut inimicorum incidisset, omnis honesta ratio
esset expediendae salutis. [11] Silent enim leges inter arma nec se
exspectari iubent, cum ei, qui exspectare velit ante iniusta poena
luenda sit quam iusta repetenda.

--
All the great governments of the world---those now existing, as well
as those that have passed away---have been of this character. They have
been mere bands of robbers, who have associated for purposes of plunder,
conquest, and the enslavement of their fellow men. And their laws, as
they have called them, have been only such agreements as they have found
it necessary to enter into, in order to maintain their organizations,
and act together in plundering and enslaving others, and in securing to
each his agreed share of the spoils.

All these laws have had no more real obligation than have the agreements
which brigands, bandits, and pirates find it necessary to enter into
with each other, for the more successful accomplishment of their crimes,
and the more peaceable division of their spoils.

- Lysander Spooner, "Natural Law"
-------------------
Absolutely, but the only govt which is finally not evil, is that
one where all have equal voice, and none are plundered by gangs.

Capitalism is a system that breeds bandit gangs that speculate
and connive to enslave the less lucky. It must be done away with!

-Steve
--
-Steve Walz rstevew@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public
 
In article <1isma0dognlr3hvhvhq5r834vqo3o1tioe@4ax.com>,
jjlarkin@highlandSNIPtechTHISnologyPLEASE.com says...
On 19 May 2004 09:16:22 +0200, Ketil Malde <ketil@ii.uib.no> wrote:


The best control structure is a jump. That's all the CPU does.

The best control structure is recursion, preferably structured as
folds and maps.


Oh, that brings up another rule: if, at any point in your code, you
can't pretty-closely estimate your stack usage, find another line of
work.
Having done designs with 8051s, one quickly learned to keep track
of the stack usage *exactly*.

--
Keith
 
They could not grasp why we were wasting time writing functions that
had nothing in them.
Or, classes that do not extend their base class.
Or...

Zero is a very important number.
There are many flavors of 0.
 
In message <e2dsa0dkv2jvvcfmvgdaq65rknnu4t25ga@4ax.com>, John Larkin
<jjlarkin@highSNIPlandTHIStechPLEASEnology.com> writes

<snipped>

On a good CPU, with lots of registers,
you can generally write a
fairly complex embedded program without using stack for anything but
interrupt context saves and subroutine return addresses. I've written
actually-useful programs that use no stack at all. I wrote one PDP-11
program - a boot loader - that used no stack and no memory, just
registers.

On an even better CPU, one with two stacks, you can write a very complex
embedded program without any registers other than status and
initialisation.

I like stacks.

Cheers
--
Keith Wootten
 
Stephen Fuld <s.fuld@PleaseRemove.att.net> wrote:
+---------------
| "John Larkin" <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:
| > JMS SUBBIE calls the sub,
| > SUBBIE, 0
| > .... subroutine code...
| > JMP I SUBBIE
| > is the return, an indirect jump through the start of your own
| > subroutine!
|
| The 1108 etc. had that feature long before Ken Olsen founded DEC. It also
| had, what most mainframe systems had, an instruction that branched to a
| subroutine and stroed the address of the next instruction in a register
| (IBM S/360 had the same thing).
+---------------

The DEC PDP-10 had both of those *and* a stack-oriented call/return!
The "JSR addr" instruction was just like a PDP-8 JMS, except that it
also stored the flags with the saved PC. The "JSP reg, addr" was like
the 1108 instruction you mention, also like the S/360 BAL. ["JSP r1,(r2)"
was "BALR r1, r2".] "PUSHJ reg, addr" was like most modern stack-based
calls, except that you could use *any* register as the stack pointer
[though normally r0 wasn't used, since you couldn't index off of r0].


-Rob

-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
 
In article <77gta01ga41045oo4tc366ql4pj1kpp1ff@4ax.com>,
John Larkin <jjlarkin@highlandSNIPtechTHISnologyPLEASE.com> wrote:

What's a leaf?
A subroutine that doesn't call any other subroutines. I thought this
was standard terminology; if it's IBMese, I apologise.

Michel.
 
On Mon, 24 May 2004 05:05:50 -0500, rpw3@rpw3.org (Rob Warnock) wrote:

Stephen Fuld <s.fuld@PleaseRemove.att.net> wrote:
+---------------
| "John Larkin" <jjlarkin@highSNIPlandTHIStechPLEASEnology.com> wrote:
| > JMS SUBBIE calls the sub,
| > SUBBIE, 0
| > .... subroutine code...
| > JMP I SUBBIE
| > is the return, an indirect jump through the start of your own
| > subroutine!
|
| The 1108 etc. had that feature long before Ken Olsen founded DEC. It also
| had, what most mainframe systems had, an instruction that branched to a
| subroutine and stroed the address of the next instruction in a register
| (IBM S/360 had the same thing).
+---------------

The DEC PDP-10 had both of those *and* a stack-oriented call/return!
The "JSR addr" instruction was just like a PDP-8 JMS, except that it
also stored the flags with the saved PC. The "JSP reg, addr" was like
the 1108 instruction you mention, also like the S/360 BAL. ["JSP r1,(r2)"
was "BALR r1, r2".] "PUSHJ reg, addr" was like most modern stack-based
calls, except that you could use *any* register as the stack pointer
[though normally r0 wasn't used, since you couldn't index off of r0].


-Rob

-----
Rob Warnock <rpw3@rpw3.org
627 26th Avenue <URL:http://rpw3.org/
San Mateo, CA 94403 (650)572-2607
The PDP-11 did

JSR Rn, dest

whence Rn was pushed on the stack (R6 was always the SP) and the
return address was stashed in Rn. The idea was...


code
code
JSR R5, SUBBIE
arg1
arg2
arg3
code ...


so that the sub would use R5 in autoincrement mode to nab the args.
Bad idea! But you could also do JSR PC, dest which just pushed the
return address on the stack. R7 was the PC, incidentally, and was a
general register. You could, for instance

CLR PC
ADD R3, PC
NEG PC

or the famous Land Mine instruction,

MOV -(PC), -(PC)

which copied itself into all of memory, backwards.

The 68K, like most contemporary gadgets, just pushes the return
address.

John
 
On Sat, 22 May 2004 11:47:35 -0400, KR Williams <krw@att.biz> wrote:

In article <1isma0dognlr3hvhvhq5r834vqo3o1tioe@4ax.com>,
jjlarkin@highlandSNIPtechTHISnologyPLEASE.com says...
On 19 May 2004 09:16:22 +0200, Ketil Malde <ketil@ii.uib.no> wrote:


The best control structure is a jump. That's all the CPU does.

The best control structure is recursion, preferably structured as
folds and maps.


Oh, that brings up another rule: if, at any point in your code, you
can't pretty-closely estimate your stack usage, find another line of
work.

Having done designs with 8051s, one quickly learned to keep track
of the stack usage *exactly*.
I'd just as soon cut off my mouse finger as program an 8051!

Someone recently editoralized that semiconductor design and fab is
getting so expensive, only one big-CPU architecture can ultimately
survive. And it will be, basicly, the 8008.

John
 
In article <7c94b0hjv9jbvl7mui54spprs0q1hpnqlb@4ax.com>,
jjlarkin@highSNIPlandTHIStechPLEASEnology.com says...
On Sat, 22 May 2004 11:47:35 -0400, KR Williams <krw@att.biz> wrote:

In article <1isma0dognlr3hvhvhq5r834vqo3o1tioe@4ax.com>,
jjlarkin@highlandSNIPtechTHISnologyPLEASE.com says...
On 19 May 2004 09:16:22 +0200, Ketil Malde <ketil@ii.uib.no> wrote:


The best control structure is a jump. That's all the CPU does.

The best control structure is recursion, preferably structured as
folds and maps.


Oh, that brings up another rule: if, at any point in your code, you
can't pretty-closely estimate your stack usage, find another line of
work.

Having done designs with 8051s, one quickly learned to keep track
of the stack usage *exactly*.

I'd just as soon cut off my mouse finger as program an 8051!
I found it "interesting". We did about 25K lines of code for the
last generation and it worked quite well (FIPS 140 class 4 stuff
too). After getting into the "Harvard" architecture it wasn't
all that bad. The only thing put on the stack was a few
registers and return addresses. Other widgets in the chip made
it rather nice. Of course the last time I touched one was more
than ten years ago. ...though I wouldn't be afraid to use
another variant again today.

Processors are tools. ...nothing more. ...though chain saws
scare me, 8051s... Please!

Someone recently editoralized that semiconductor design and fab is
getting so expensive, only one big-CPU architecture can ultimately
survive. And it will be, basicly, the 8008.
That "someone" is simply stupid. ...likely a journalism major
writing fir EET, or some such.

--
Keith
 
On Mon, 24 May 2004 22:22:15 -0400, KR Williams <krw@att.biz> wrote:
Someone recently editoralized that semiconductor design and fab is
getting so expensive, only one big-CPU architecture can ultimately
survive. And it will be, basicly, the 8008.

That "someone" is simply stupid. ...likely a journalism major
writing fir EET, or some such.
Maybe so. But at a couple of billion dollars a pop, CPUs can get
expensive. Add another bunch of billions for applications support,
maybe.

The argument was that PA-risc and Alpha have already fallen, and Sparc
is in trouble. Itanic isn't looking too good, either.

John
 
In article <2nd5b0tmbfat0isn3cmg3tm5mcjcaal4ah@4ax.com>,
John Larkin <jjlarkin@highlandSNIPtechTHISnologyPLEASE.com> wrote:

Maybe so. But at a couple of billion dollars a pop, CPUs can get
expensive. Add another bunch of billions for applications support,
maybe.
You might want to check your numbers -- while fabs are that expensive,
CPU designs are not necessarily so expensive. In particular, AMD
(currently) and DEC (used to) spend a lot less than that on their
designs. And that's just a piece of the market -- there are other
places where from-scratch designs are done, and I assure you that if
they cost a billion a pop, no one (other than Intel) would do them.

We've always known that stupidly expensive engineering is hard to
fund. Fortunately, not all engineers are stupid.

-- greg
 
On 24 May 2004 13:53:01 GMT in comp.arch, hack@watson.ibm.com (hack)
wrote:

In article <77gta01ga41045oo4tc366ql4pj1kpp1ff@4ax.com>,
John Larkin <jjlarkin@highlandSNIPtechTHISnologyPLEASE.com> wrote:

What's a leaf?

A subroutine that doesn't call any other subroutines. I thought this
was standard terminology; if it's IBMese, I apologise.
ISTM on commonly used stack based machines the difference tends to be
insignificant. Whereas on non-stack machines like IBM 3x0 with
generalized subroutine call conventions, where you have to
(dynamically) allocate a register save area in non-leaf routines,
there's more significance to and awareness of the difference.

--
Thanks. Take care, Brian Inglis Calgary, Alberta, Canada

Brian.Inglis@CSi.com (Brian dot Inglis at SystematicSw dot ab dot ca)
fake address use address above to reply
 

Welcome to EDABoard.com

Sponsor

Back
Top