Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A virtual trinary CPU

108 views
Skip to first unread message

Bjarki Hartjenstein Gunnarsson

unread,
Jan 19, 2014, 7:50:14 AM1/19/14
to
I've started this project, chav, which aims to implement a trinary CPU. I was wondering if anyone would be interested to help me, give me suggestions, criticism or just something. I'd be super grateful and things.
https://github.com/bjarkig/chav

with lovely regards
Bjarki

rick.c...@gmail.com

unread,
Jan 19, 2014, 5:56:28 PM1/19/14
to
Interesting. I came here to ask a particular question and happened across this post. What experience do you have writing emulators?

Best regards,
Rick C. Hodgin

Bjarki Hartjenstein Gunnarsson

unread,
Jan 24, 2014, 11:32:45 AM1/24/14
to
Sorry for the late reply. I've no experience with writing emulators and this project aims to remedy that.

Lynn McGuire

unread,
Jan 24, 2014, 10:41:13 PM1/24/14
to
Yes, no and maybe?
http://en.wikipedia.org/wiki/Setun

Lynn


Rick C. Hodgin

unread,
Jan 25, 2014, 3:16:50 AM1/25/14
to
I am curious ... why base-3? Why not base-4, or a base-10 computer? What are
the advantages? Is it just a theoretical exercise? Do you have some mechanical
reason in silicon to go with base-3?

Bjarki Hartjenstein Gunnarsson

unread,
Jan 25, 2014, 5:30:00 AM1/25/14
to
There is no special reason why I went with base-3, I simply found the subject of an alternate base computer interesting and base-3 was the first thing that came up in my mind. At the end I only look at this project only as an exercise to increasing my (and others) knowledge of CPUs and the low-level stuff without touching a transistor.

glen herrmannsfeldt

unread,
Jan 25, 2014, 11:16:29 AM1/25/14
to
Bjarki Hartjenstein Gunnarsson <bjar...@gmail.com> wrote:

(snip)

> There is no special reason why I went with base-3, I simply
> found the subject of an alternate base computer interesting
> and base-3 was the first thing that came up in my mind.

Symmetric trinary is interesting, in that you avoid the complications
of signed arithmetic. Consider base-3 where the digit values
are {-1, 0, +1}. You can then represent positive or negative
numbers using such digits without the complications of sign
magnitude, digit complement, or radix complement.

The symmetric form works with any odd base, where 3 is the
most convenient, but one could use 5, or 11, or 13.

> At the end I only look at this project only as an exercise
> to increasing my (and others) knowledge of CPUs and the
> low-level stuff without touching a transistor.

Fortran allows for any integer base greater than one.
C pretty much requires binary. (In case you had thought
about HLL compilers for your machine.)

Knuth's MIX processor was designed to allow for either decimal
or binary. I don't remember now if it could be done in trinary.
If it does, that might be a good place to start.

I know even less about MMIX.

-- glen

Kaz Kylheku

unread,
Jan 25, 2014, 12:22:20 PM1/25/14
to
On 2014-01-25, Bjarki Hartjenstein Gunnarsson <bjar...@gmail.com> wrote:
> There is no special reason why I went with base-3, I simply found the subject
> of an alternate base computer interesting and base-3 was the first thing that
> came up in my mind.

Cool. I look forward to when your ternary computer plays its first video of
some cute kittens and then generates a 140 character tweet about it.

Robert Wessel

unread,
Jan 26, 2014, 5:44:12 PM1/26/14
to
There have been a number of ternary computers built, perhaps the most
famous is the Soviet Setun from the 50s, and a couple of follow-ons. A
few links at:

http://en.wikipedia.org/wiki/Ternary_computer

So there is some history out there you may want to dig through.

The biggest problem is that most modern logic processes and available
devices are poorly suited to ternary, although certainly a ternary
version of CMOS is easily imaginable, getting a foundry to build such
a thing would be more difficult. It's also hard to see how a ternary
digit gate would actually be smaller than 1.6 bits worth of binary
gates.

Note that there are certainly areas where non-binary hardware exists,
although it tends to be isolated from the core of the system (for
example multi-level flash, or some modulation schemes for
communications).

BartC

unread,
Jan 27, 2014, 5:18:57 AM1/27/14
to


"Bjarki Hartjenstein Gunnarsson" <bjar...@gmail.com> wrote in message
news:4c09551b-ff58-46e8...@googlegroups.com...
> I've started this project, chav, which aims to implement a trinary CPU. I
> was wondering if anyone would be interested to help me, give me
> suggestions, criticism or just something. I'd be super grateful and
> things.
> https://github.com/bjarkig/chav

You might want to change to the name if you're thinking of distributing it
in the UK, where 'chav' has a specific existing meaning.

Also, although this won't apply as you've already decided to use C, to
perhaps use a language where the type system allows you to create a 3-value
type (a ternary version of Bool). Then you'd be less likely to 'cheat' by
making use of binary modes in places. I assume you're not after efficiency
at this point.

You say that you want to emulate a CPU, which is good because building a
real one is going to be very tricky - most logic parts you can get are going
to be binary. You can emulate ternary by using two binary bits and
disregarding one of the four values, but again I'd regard that as cheating.
But if you are going to try something then I suspect it might involve a
3-level power supply, eg. -5V, 0V and +5V, instead of 0V and +5V,
representing values 0, 1 and 2.


--
Bartc

Kenny McCormack

unread,
Jan 27, 2014, 7:32:04 AM1/27/14
to
In article <gpqFu.106$mk4...@fx04.am4>, BartC <b...@freeuk.com> wrote:
...
>You might want to change to the name if you're thinking of distributing it
>in the UK, where 'chav' has a specific existing meaning.

Heh. That was the first thing I thought upon seeing this thread.
I wonder how many other readers had the same reaction.

But maybe the name is appropriate anyway, in a strange sort of way...

--
Given Bush and his insanely expensive wars (*), that we will be paying for
for generations to come, the only possible response a sensible person need
ever give, when a GOPer/TeaBagger says anything about "deficits", is a
polite snicker.

(*) Obvious money transfers between the taxpayers and Bush's moneyed
interests. Someday, we'll actually figure out a way to have a war where the
money just gets moved around and nobody (on either side) gets injured or
killed. That will be an accomplishment of which we will be justly proud.

Bjarki Hartjenstein Gunnarsson

unread,
Jan 27, 2014, 5:14:51 PM1/27/14
to
As a matter of fact, I named the project after my favourite Little Britain
character: Vicky Pollard, which is undoubtedly a chav.

ec429

unread,
Feb 2, 2014, 1:52:49 PM2/2/14
to
On 25/01/14 16:16, glen herrmannsfeldt wrote:
> Fortran allows for any integer base greater than one.
> C pretty much requires binary. (In case you had thought
> about HLL compilers for your machine.)
Of course, there is always TriIntercal :)
With its tritwise operators of AND, OR, and (of course) BUT.

--
'sane', adj.: see 'unimaginative'
on the web - http://jttlov.no-ip.org
0 new messages