A virtual trinary CPU

  • Thread starter Bjarki Hartjenstein Gunnarsson
  • Start date
B

Bjarki Hartjenstein Gunnarsson

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
 
R

rick.c.hodgin

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


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
 
B

Bjarki Hartjenstein Gunnarsson

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

Sorry for the late reply. I've no experience with writing emulators and this project aims to remedy that.
 
R

Rick C. Hodgin

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?

Best regards,
Rick C. Hodgin
 
B

Bjarki Hartjenstein Gunnarsson

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?



Best regards,

Rick C. Hodgin

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 thingthat came up in my mind. At the end I only look at this project only as anexercise to increasing my (and others) knowledge of CPUs and the low-levelstuff without touching a transistor.
 
G

glen herrmannsfeldt

(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
 
K

Kaz Kylheku

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.
 
B

BartC

Bjarki Hartjenstein Gunnarsson said:
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.
 
K

Kenny McCormack

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.[/QUOTE]

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.
 
B

Bjarki Hartjenstein Gunnarsson

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.

As a matter of fact, I named the project after my favourite Little Britain
character: Vicky Pollard, which is undoubtedly a chav.
 
E

ec429

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.
-É™
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top