nedoPC.org

Electronics hobbyists community established in 2002
Atom Feed | View unanswered posts | View active topics It is currently 28 Mar 2024 16:02



Reply to topic  [ 82 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next
Ternary VM (TVM) 
Author Message
Reply with quote
Hello All,

I have just started over the ternary Computers(TCs),
and by my understanding of the market, i can say that its
tough to have a actual working model of TCs, what I wish is ,
if we really have to make it popular we should come up with some kind of Virtual Machines for TCs i.e. a TVM, So that people can
actually work on them, much like JVM.

Please post your views.


01 Aug 2008 09:34
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Well, that is sort of what I'm trying to do with Tunguska. It's not a quite a virtual machine, in the java sense; it emulates a complete ternary computer.

The main problem with doing what you propose is speed. Regular binary virtual machines can rely heavily on native instructions (through JIT or whatever) to gain some sort of semblance of speed, but ternary virtual machines must emulate everything.


01 Aug 2008 10:19
Profile
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22412
Location: Silicon Valley
Reply with quote
Do you plan to have support for graphics, windows, networks in your "TVM"?

P.S. I removed duplicate post from "Ternary Hardware" section


01 Aug 2008 16:16
Profile WWW
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
Yes, you're absolutely right. I'm working on prototype of such a virtual machine. Thought my vision slightly different from yours, I myself want to have something like configurable platform, that allow me define many things, such as amount of memory, how many radixes should contain registers and memory values, have number and type of instructions, how should machine perform arithmetics operations (fixed set or radixes, or variable), etc. From user's point of view the machine looks very much like VirtualBox, that also have low level programming tools (editor, compiler, debugger, memory inspector, profiler) and tools to inport binary data to balanced ternary one and of course to export it.


01 Aug 2008 22:31
Profile
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Interesting idea. I think there should be some sort of standardized way of describing any given virtual machine.

What would be really awesome if we could use XML to do it, and have the virtual machine parse it and automatically build itself.

You could probably also implement functionality hooks (say you want your virtual machine to be more of an emulator, like Tunguska) in some lightweight interpreted language, like lua or python.

I think, with some careful design work, it could actually work. Since you can describe pretty much any grammar with a tree structure, you might even be able to describe opcode functionality with it, which would be immensely powerful. You could specify an entire system architecture with nothing but a few hundred lines of easily readable XML code.

Here's an example of what I'm thinking
Code:
<machine>
   <radix>3b</radix>
   <memory max="265720" min="-265720" />

   <register name="A" width="1"> Accumulator </register>
   <register name="C" width="1"> Counter </register>
   <register name="D" width="2"> Address </register>
   <register name="DL" width="1" alias="LOW(D)"/>
   <register name="DH" width="1" alias="HIGH(D)"/>
   
   <instruction name="LDA">
           <operation>
         <store>
            <register>A</register>
            <parameter name="source"/>
         </store>
           </operation>
           <parameter name="source">
         <immediate/>
         <memory/>
         <regitster>C</register>
         <regitster>DH</register>
         <regitster>DL</register>

      </parameter>
   </instruction>

   <instruction name="STA">
           <operation>
         <store>
            <register>A</register>
            <parameter name="source"/>
         </store>
      </operation>
           <parameter name="source">
         <immediate/>
         <memory/>
         <regitster>C</register>
         <regitster>DH</register>
         <regitster>DL</register>

           </parameter>
   </instruction>

   <instruction name="ADD">
           <operation>
         <store>
            <register>A</register>
            <add>
               <register>A</register>
               <parameter name="arg"/>
            </add>
         </store>
      </operation>
           <parameter name="arg">
         <immediate/>
         <memory/>
         <regitster>C</register>
         <regitster>DH</register>
         <regitster>DL</register>
           </parameter>
   </instruction>
  [...]
</machine>


02 Aug 2008 19:56
Profile
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
Reply with quote
I will think about using XML in configuration file, it looks exactly what I need :)


02 Aug 2008 22:30
Profile
Reply with quote
Hello All,

I have just come up with ternary representation of "Trits" and "Trytes" much like a byte but here in 1 Tryte we have 6 Trits. i.e. 729 values(3^6=729).(WKT 1Byte has 8Bits i.e. 2^8)

I will post the link in a day or two once formatting is done.

If any one has specific file format for the data please let me know.

Thanks,
Manoj


04 Aug 2008 03:53
Reply with quote
@ Shaos

I have just started working on the representation of data for "TVM". Once its complete i will start working on Interpreters.


04 Aug 2008 03:59
Reply with quote
@Mbr

Hi

I will be taking care of following:
"how should machine perform arithmetics operations (fixed set or radixes, or variable), etc. From user's point of view the machine looks very much like VirtualBox, that also have low level programming tools (editor, compiler, debugger, memory inspector, profiler) and tools to inport binary data to balanced ternary one and of course to export it."

Thanks,


04 Aug 2008 05:50
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
Quote:
I have just come up with ternary representation of "Trits" and "Trytes" much like a byte but here in 1 Tryte we have 6 Trits. i.e. 729 values(3^6=729).(WKT 1Byte has 8Bits i.e. 2^8)
[...]
If any one has specific file format for the data please let me know.


That's what I'm using in Tunguska. I'm storing it in a plain array of signed shorts (that is, 16 bits per tryte), and compressing it with zlib (which saves a lot of space effective). It isn't very space effective once in the host memory, but it's a lot faster than using bit twiddling to store it more effectively.


04 Aug 2008 09:54
Profile
Reply with quote
That sounds great so I think we have done good amount of homework.
My main intention here is first to come up with a fair architecture, so I am just trying to prepare some standard requirements.

If you can share the representation or help me in preparing a logical representation, it will be great.

Following are the locations for the "Tryte representation"
(Pls try after Aug 5)
http://manojky.net/
or direct link:
http://manojky.net/terPrj/TernaryWithCharC.xml
http://manojky.net/terPrj/TernaryWithCharC.htm
http://manojky.net/terPrj/TernaryCode.htm
Thanks,


04 Aug 2008 11:56
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
I've been representing ternary data with F, U and T; or N 0 and P. So -1,0,1,1 may be written either FUTT or N0PP.

I've also been using balanced nonary for quick represntation of 6-trit wide trytes, where {D, C, B, A, 0, 1, 2, 3, 4} represent {-4, -3, -2, -1, 0, 1, 2, 3, 4}. So, D1B balanced nonary represents -4 * 81 + 9 - 2 = -317 decimal.


04 Aug 2008 14:24
Profile
Reply with quote
The link is up now for

http://manojky.net/
or direct link:
http://manojky.net/terPrj/TernaryWithCharC.xml
http://manojky.net/terPrj/TernaryWithCharC.htm
http://manojky.net/terPrj/TernaryCode.htm

Thanks,


05 Aug 2008 02:00
Reply with quote
Hi,
That's cool, then
How are you doing the addition and subtraction of the trytes ?
b'cause thats where i am stuck now.

Thanks,
Manoj


05 Aug 2008 02:27
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
Reply with quote
I use the host ALU to do arithmetics in tunguska (that is, convert to int, add, convert to tryte). Mostly because it's something like 30 times faster than using an addition algorithm.

I think I used to do it manually in a really old version. It's not that hard to implement, I think what probably is causing your problems is how negative modulo is handled. (See the wikipedia article on the modulo operation)


05 Aug 2008 04:02
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 82 posts ]  Go to page 1, 2, 3, 4, 5, 6  Next

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.