nedoPC.org

Community of electronics hobbyists established in 2002

...
Atom Feed | View unanswered posts | View active topics It is currently 20 Jun 2018 06:54



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

Joined: 09 Jan 2003 00:22
Posts: 16600
Location: Colorado
Reply with quote
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 22:17
Profile WWW
Admin
User avatar

Joined: 09 Jan 2003 00:22
Posts: 16600
Location: Colorado
Reply with quote
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 21:52, edited 7 times in total.



31 Aug 2008 00:02
Profile WWW
Admin
User avatar

Joined: 09 Jan 2003 00:22
Posts: 16600
Location: Colorado
Reply with quote
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 21:44, edited 1 time in total.



05 Nov 2008 23:58
Profile WWW
Maniac

Joined: 17 Sep 2012 14:36
Posts: 277
Location: 81.170.128.52
Reply with quote
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 14:05
Profile
Admin
User avatar

Joined: 09 Jan 2003 00:22
Posts: 16600
Location: Colorado
Reply with quote
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 17:44
Profile WWW
Admin
User avatar

Joined: 09 Jan 2003 00:22
Posts: 16600
Location: Colorado
Reply with quote
Post 
moving up

_________________
:eugeek: https://twitter.com/Shaos1973


10 Nov 2012 09:53
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 1 guest


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.