A virtual trinary CPU

Discussion in 'C Programming' started by Bjarki Hartjenstein Gunnarsson, Jan 19, 2014.

  1. 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
    Bjarki Hartjenstein Gunnarsson, Jan 19, 2014
    #1
    1. Advertising

  2. Bjarki Hartjenstein Gunnarsson

    Guest

    On Sunday, January 19, 2014 7:50:14 AM UTC-5, Bjarki Hartjenstein Gunnarsson wrote:
    > 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
    , Jan 19, 2014
    #2
    1. Advertising

  3. On Sunday, January 19, 2014 10:56:28 PM UTC, Rick C. Hodgin wrote:
    > On Sunday, January 19, 2014 7:50:14 AM UTC-5, Bjarki Hartjenstein Gunnarsson wrote:
    >
    > > 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


    Sorry for the late reply. I've no experience with writing emulators and this project aims to remedy that.
    Bjarki Hartjenstein Gunnarsson, Jan 24, 2014
    #3
  4. Bjarki Hartjenstein Gunnarsson

    Lynn McGuire Guest

    On 1/19/2014 6:50 AM, Bjarki Hartjenstein Gunnarsson wrote:
    > 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


    Yes, no and maybe?
    http://en.wikipedia.org/wiki/Setun

    Lynn
    Lynn McGuire, Jan 25, 2014
    #4
  5. 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
    Rick C. Hodgin, Jan 25, 2014
    #5
  6. On Saturday, January 25, 2014 8:16:50 AM UTC, Rick C. Hodgin wrote:
    > 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.
    Bjarki Hartjenstein Gunnarsson, Jan 25, 2014
    #6
  7. Bjarki Hartjenstein Gunnarsson <> 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
    glen herrmannsfeldt, Jan 25, 2014
    #7
  8. Bjarki Hartjenstein Gunnarsson

    Kaz Kylheku Guest

    On 2014-01-25, Bjarki Hartjenstein Gunnarsson <> 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.
    Kaz Kylheku, Jan 25, 2014
    #8
  9. Bjarki Hartjenstein Gunnarsson

    BartC Guest

    "Bjarki Hartjenstein Gunnarsson" <> wrote in message
    news:...
    > 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
    BartC, Jan 27, 2014
    #9
  10. In article <gpqFu.106$4>, BartC <> 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.
    Kenny McCormack, Jan 27, 2014
    #10
  11. On Monday, January 27, 2014 10:18:57 AM UTC, Bart wrote:
    > "Bjarki Hartjenstein Gunnarsson" <> wrote in message
    >
    > news:...
    >
    > > 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


    As a matter of fact, I named the project after my favourite Little Britain
    character: Vicky Pollard, which is undoubtedly a chav.
    Bjarki Hartjenstein Gunnarsson, Jan 27, 2014
    #11
  12. Bjarki Hartjenstein Gunnarsson

    ec429 Guest

    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
    ec429, Feb 2, 2014
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek Simmons
    Replies:
    0
    Views:
    802
    Derek Simmons
    Aug 1, 2004
  2. Jéjé
    Replies:
    2
    Views:
    399
    Jéjé
    Nov 30, 2005
  3. while_1
    Replies:
    2
    Views:
    629
    Roedy Green
    Jun 25, 2004
  4. Alchemist

    trinary operator - if then else

    Alchemist, Apr 25, 2007, in forum: Python
    Replies:
    4
    Views:
    393
    Nick Craig-Wood
    Apr 25, 2007
  5. pavunkumar

    How , system cpu and user cpu times calculates

    pavunkumar, Feb 27, 2009, in forum: C Programming
    Replies:
    1
    Views:
    353
Loading...

Share This Page