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


  2. 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
     
    rick.c.hodgin, Jan 19, 2014
    #2
    1. Advertisements

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

    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. 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. (snip)
    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.
    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

    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

    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, Jan 27, 2014
    #9
  10. 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.
     
    Kenny McCormack, Jan 27, 2014
    #10
  11. 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

    Of course, there is always TriIntercal :)
    With its tritwise operators of AND, OR, and (of course) BUT.
    -É™
     
    ec429, Feb 2, 2014
    #12
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.