Ternary VM (TVM)
Moderator: haqreu
Ternary VM (TVM)
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.
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.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary VM (TVM)
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.
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.
-
- Admin
- Posts: 23989
- Joined: 08 Jan 2003 23:22
- Location: Silicon Valley
Re: Ternary VM (TVM)
Do you plan to have support for graphics, windows, networks in your "TVM"?
P.S. I removed duplicate post from "Ternary Hardware" section
P.S. I removed duplicate post from "Ternary Hardware" section
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary VM (TVM)
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.
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary VM (TVM)
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
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: Select all
<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>
-
- Retired
- Posts: 1474
- Joined: 03 Aug 2003 22:37
- Location: Moscow
Re: Ternary VM (TVM)
I will think about using XML in configuration file, it looks exactly what I need 

Re: Ternary VM (TVM)
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
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
Re: Ternary VM (TVM)
@ Shaos
I have just started working on the representation of data for "TVM". Once its complete i will start working on Interpreters.
I have just started working on the representation of data for "TVM". Once its complete i will start working on Interpreters.
Re: Ternary VM (TVM)
@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,
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,
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary VM (TVM)
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.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.
Re: Ternary VM (TVM)
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,
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,
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary VM (TVM)
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.
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.
Re: Ternary VM (TVM)
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,
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,
Re: Ternary VM (TVM)
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
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
-
- Maniac
- Posts: 277
- Joined: 17 Sep 2012 13:36
- Location: 81.170.128.52
Re: Ternary VM (TVM)
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)
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)