nedoPC.org

Electronics hobbyists community established in 2002
Last visit was: 15 Jun 2024 21:49
It is currently 15 Jun 2024 21:49



 [ 21 posts ]  Go to page 1, 2  Next
Ternary computer TRINITY-2004 (instruction set) 
Author Message
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Lets name this instruction set as "TRINITY-2004" (year of design)

It can be used as microcode for next generation of TRINITY processor!

1 trit - 3 values (N,O,P or -1,0,+1);
1 triad (3 trits) - 27 values;
1 tryte (6 trits, 2 triads) - 729 values;
1 tradr (9 trits, 3 triads) - 19 683 values;
1 trord (12 trits, 4 triads, 2 trytes) - 531 441 values;
1 truadr (18 trits, 6 triads, 3 trytes, 2 tradrs) - 387 420 489 values;
1 truble (24 trits, 8 triads, 4 trytes, 2 trords) - 282 429 536 481 values;

New words "tradr" and "trord" mean "ternary address" and "ternary word" respectively ;-)
New words "truadr" and "truble" mean "double ternary address" and "double ternary word" respectively :-D

P.S. And "tribble" must be 2 trits (3 tribbles = 1 tryte)


09 Jan 2008 06:35 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Another idea to rename "triad" (half of tryte) to "tribble" (like nibble that is half of byte) :-)


10 Jan 2008 18:40 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Idea about representation of floating point numbers: Lets take "truble" and divide it to 2 parts: 6-trit exponent and 18-trit fraction. By accuracy it is better than 32-bit "float", worse than 64-bit "double" and similar to 36-bit floating number in IBM System/360 from 1964 that had 9-bit sign and exponent and 27-bit fraction. Because of nature of balanced ternary numeric system we don't need "biasing" exponent. Also we don't need separate sign bit - we simply combine it with "hidden" most significant bit of fraction instead and it will be part of full 18-trit fraction. So range of exponent is from -364 to +364 (3^6/2) and fraction from -193710244 to +193710244 (3^18/2 that is max possible integer represented by this floating point format). To simplify formula for calculation number from representation we may simply forget about "fractional" nature of fraction and say F*3^E
8-)
P.S. here ^ means "power"


16 Jan 2008 20:18 WWW
Retired

Joined: 03 Aug 2003 22:37
Posts: 1474
Location: Moscow
So, let's take the representation as a basic representation of fractional numbers for ternary platform.


19 Jan 2008 04:07
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Right now I think that ability to compare normalized floating point numbers as integers is good and to have it we should do "fraction" really fractional (-1 < F < 1): (F*3^18)*3^E = F*3^(18+E). In this case for example to do float from integer 193710244 (PPPPPPPPPPPPPPPPPP) we have to add exponent +18 (OOPNOO): OOPNOOPPPPPPPPPPPPPPPPPP (here fraction is O.PPPPPPPPPPPPPPPPPP). Also to represent 0.5 we will use OOOOOOPPPPPPPPPPPPPPPPPP (error is 0.00000000258).

P.S. But in case of integer "fraction" described in my previous post we still can use normalization as shifting to the left and comparison "normalized" floating point numbers as regular integers...


Last edited by Shaos on 20 Sep 2012 20:43, edited 1 time in total.



19 Jan 2008 15:41 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
I forgot one important feature of balanced ternary numeric system - fractional number may have not zero in integer part of balanced ternary representation! For example P.N is 0.666...


18 Feb 2008 21:17 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Some ideas about characters mapping for 3-trit architecture (copyright by me 2005-2008):

Image

It covers these languages:
1) English
2) Russian
3) Greek
4) Ukranian
5) Belorusian
6) Rusyn
7) Serbian
8) Bulgarian (one character looks little bit different from standard)
9) Macedonian

P.S. Later modification (September 2008):

Image
Here specific Macedonian characters Image were removed and specific Finnish characters Image were added...


Last edited by Shaos on 20 Sep 2012 20:52, edited 7 times in total.



30 Aug 2008 23:02 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Quote:
-4 N: triad from memory addressed by DPn (see below);
-3 O: triad from memory addressed by DPo (see below);
-2 P: triad from memory addressed by DPp (see below);
-1 F: flag register (see below);
0 A: accumulator register;
+1 B: auxiliary register;
+2 L: lower triad of current DP register (see below);
+3 M: middle triad of current DP register (see below);
+4 H: higher triad of current DP register (see below);

Register F is set of 3 flags:
Higher trit: RSF (Result Sign Flag)
Middle trit: DPF (Data Pointer Flag)
Lower trit: BCF (Borrow Carry Flag)

There are 3 9-trit DP (data pointer) registers - DPn, DPo, DPp, available through L/M/H when flag DPF has corresponding value (N, O, P).

So full set of opcodes is:
#NNN (-13) SAN - save register A to register N;
#NNO (-12) SAO - save register A to register O;
#NNP (-11) SAP - save register A to register P;
#NON (-10) SAF - save register A to register F;
#NOO (-9) SPCD - save PC (program counter) to current data pointer;
#NOP (-8) SAB - save register A to register B;
#NPN (-7) SAL - save register A to register L (lower triade of current data pointer);
#NPO (-6) SAM - save register A to register M (middle triade of current data pointer);
#NPP (-5) SAH - save register A to register H (higher triade of current data pointer);
#ONN (-4) RLA - rotate register A to the left through flag BCF;
#ONO (-3) ADD - add register A with B and flag BCF, save result to A and BCF, modify sign flag RSF;
#ONP (-2) RRA - rotate register A to the right through flag BCF;
#OON (-1) LAI # - load register A from immediate triad;
#OOO (0) ADI # - add register A with immediate triad and flag BCF, save result to A and BCF, modify sign flag RSF;
#OOP (1) OPA # - perform unary "tritwise" operation over register A (function set by immediate triad), modify sign flag RSF;
#OPN (2) LDI # # # - load current data pointer by immediate 3 triads (higher, middle, lower);
#OPO (3) JMP # # # - jump to address set by immediate 3 triads (put it to register PC: higher, middle, lower);
#OPP (4) OPB # # # - perform binary "tritwise" operation over registers A and B, save result to A (function set by immediate 3 triad), modify sign flag RSF;
#PNN (5) LAN - load register A from register N;
#PNO (6) LAO - load register A from register O;
#PNP (7) LAP - load register A from register P;
#PON (8) LAF - load register A from register F;
#POO (9) LPCD - load PC (program counter) from current data pointer;
#POP (10) LAB - load register A from register B;
#PPN (11) LAL - load register A from register L (lower triad of current data pointer);
#PPO (12) LAM - load register A from register M (middle triad of current data pointer);
#PPP (13) LAH - load register A from register H (higher triad of current data pointer);


Today I finished full emulator of this command set! A few days ago I designed "user interface" of first prototype my ternary computer. It consists of line of ternary LEDs and line of ternary switches. 9 LEDs always display state of PC, 3 LEDs display ternary data (see below) and 3 more LEDs always display state of accumulator register A. 9 switches set some address, 3 switches set some data and 3 more switches are control ones. So we have totally 15 LEDs and 15 switches. Control switches:

1) input/output ternary switch:
P (top position) - using specified address write data to the memory (data LEDs display this 3-trit data);
O (neutral position) - ignore address and data switches (data LEDs display data from memory address PC);
N (bottom position) - ignore data switches and display data from specified address;

2) subprogram ternary switch:
P (top position) - interrupt main program, save current PC and jump to specified address;
O (neutral position) - do not disturb working program;
N (bottom position) - stop subprogram and restore PC to return to main program;

3) step/run ternary switch:
P (top position) - execute one step of the program;
O (neutral position) - pause mode;
N (bottom position) - run program from current position.

Emulation program is a little bit smaller than 1000 lines of Java-code: http://www.nedopc.org/ternary/java.php?applet=3


Last edited by Shaos on 20 Sep 2012 20:44, edited 1 time in total.



05 Nov 2008 22:58 WWW
Maniac

Joined: 17 Sep 2012 13:36
Posts: 277
Location: 81.170.128.52
That's pretty neat. Just to see it in action, I fed it the values "+0+ -+- 0++ 0-+ ---" and it started performing some sort of operation (it looked like some sort of incrementation).


06 Nov 2008 13:05
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
eudoxie wrote:
That's pretty neat. Just to see it in action, I fed it the values "+0+ -+- 0++ 0-+ ---" and it started performing some sort of operation (it looked like some sort of incrementation).


Image

Easiest way to see it in action is shifting most right switch down and it will run program from memory - OOO in each cell that is ADI 0 command (A=A+1) repeated multiple times:

Image


06 Nov 2008 16:44 WWW
Online
Admin
User avatar

Joined: 08 Jan 2003 23:22
Posts: 22883
Location: Silicon Valley
Post 
moving up

_________________
https://mastodon.social/@Shaos :dj:
https://www.youtube.com/@Shaos1973


10 Nov 2012 08:53 WWW
 [ 21 posts ]  Go to page 1, 2  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

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