home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!doc.ic.ac.uk!uknet!dsbc!jura!pete
- From: pete@jura.uucp (Pete Bevin)
- Newsgroups: comp.arch
- Subject: Re: MINIMUM instruction set
- Message-ID: <pete.180021.12Nov92@sst.icl.co.uk>
- Date: 12 Nov 92 18:25:27 GMT
- References: <1992Nov10.235849.19192@fcom.cc.utah.edu>
- Sender: news@dsbc.icl.co.uk
- Reply-To: pete@sst.icl.co.uk (Pete Bevin)
- Lines: 29
- Nntp-Posting-Host: sst.icl.co.uk
-
- Val Kartchner writes:
- > I've heard that it is possible to implement all programming languages with
- > seven instructions. (Possible does not mean practicle.) Does anyone know
- > what these instructions are? Is it possible to do all operations in less
- > than seven instructions?
-
- You can get away with four instructions in the following (rather
- inefficient) Turing-Machine-equivalent architecture. Allow yourself a
- number of registers, each of which can hold large enough numbers for
- what you want to do. Then, you only need:
-
- Z(register): Zero a register
- S(register): Increment a register (`S' for `successor')
- T(r1, r2): Transfer value from r1 to r2
- J(r1, r2, address): Jump to address if r1 and r2 hold the same
- value.
-
- In fact, you can get away without the T instruction, because T(r1, r2)
- is the same as:
-
- Z(r2)
- loop: J(r1, r2, finished)
- I(r2)
- J(r1, r1, loop)
-
- You wouldn't want to program it, but I guess it's fairly easy to reason
- mathematically about it.
-
- Pete.
-