In this project we are trying to build a very simple but functional 3-trit balanced ternary computer. The only building block allowed is a ternary multiplexer based on DG403 analog switches.

══════════════════════════════════════════════════════════ Description of the ternary computer TRIADOR ══════════════════════════════════════════════════════════ General purpose registers trits 2 1 0 (a trit can take -1,0,+1 values) ┌─┬─┬─┐ R1│ │ │ │ \ ├─┼─┼─┤ | Program memory R2│ │ │ │ | trits 4 3 2 1 0 ├─┼─┼─┤ |-- main set ┌─┬─┬─┬─┬─┐ R3│ │ │ │ | of registers a -364│ │ │ │ │ │ ├─┼─┼─┤ | d ├─┼─┼─┼─┼─┤ R4│ │ │ │ / d -363│ │ │ │ │ │ ├─┼─┼─┤ r ├─┼─┼─┼─┼─┤ R5│ │ │ │ \ e -362│ │ │ │ │ │ ├─┼─┼─┤ | s ├─┼─┼─┼─┼─┤ R6│ │ │ │ | s : : : : : : ├─┼─┼─┤ | ├─┼─┼─┼─┼─┤ R7│ │ │ │ | -1 │ │ │ │ │ │ ├─┼─┼─┤ | ├─┼─┼─┼─┼─┤ R8│ │ │ │ | 0 │ │ │ │ │ │ ├─┼─┼─┤ |-- extra registers ├─┼─┼─┼─┼─┤ R9│ │ │ │ | +1 │ │ │ │ │ │ ├─┼─┼─┤ | ├─┼─┼─┼─┼─┤ R10│ │ │ │ | : : : : : : ├─┼─┼─┤ | ├─┼─┼─┼─┼─┤ R11│ │ │ │ | +363│ │ │ │ │ │ ├─┼─┼─┤ | ├─┼─┼─┼─┼─┤ R12│ │ │ │ / +364│ │ │ │ │ │ ├─┼─┼─┤ └─┴─┴─┴─┴─┘ R13│ │ │ │ Special register, └─┴─┴─┘ specifies memory segment for JP ttt ┌─┬─┬─┬─┬─┬─┐ PC │ │ │ │ │ │ │ program counter register (-364..+364) └─┴─┴─┴─┴─┴─┘ ┌─┐ C │ │ borrow/carry flag (+1 borrow, -1 carry) └─┘ Every 3-trit register can take values from -13 to +13: t2*9 + t1*3 + t0 where t0,t1,t2 - trits (-1,0,+1) ═══════════════════════════════════════════════════════════ TRIADOR instruction set ═══════════════════════════════════════════════════════════ (for lisibility we use N,O,P instead of -1,0,+1) ┌───────┬────────┬───────────────────────────────────────┐ │op code│mnemonic│ description │ ├───────┼────────┼───────────────────────────────────────┤ │ NNttt │ EX ttt │ extension commands (work in progress) │ ├───────┼────────┼───────────────────────────────────────┤ │ NOttt │ JP ttt │ unconditional jump to R13*27+ttt │ ├───────┼────────┼───────────────────────────────────────┤ │ NPttt │ SK ttt │ conditional skips of the next command │ ├───────┼────────┼───────────────────────────────────────┤ │ ONttt │ OP ttt │ tritwise unary operation over R1 │ ├───────┼────────┼───────────────────────────────────────┤ │ OOttt │ RR ttt │ copying between registers │ ├───────┼────────┼───────────────────────────────────────┤ │ OPttt │ R1 ttt │ write ttt to the register R1 │ ├───────┼────────┼───────────────────────────────────────┤ │ PNttt │ R2 ttt │ write ttt to the register R2 │ ├───────┼────────┼───────────────────────────────────────┤ │ POttt │ R3 ttt │ write ttt to the register R3 │ ├───────┼────────┼───────────────────────────────────────┤ │ PPttt │ R4 ttt │ write ttt to the register R4 │ └───────┴────────┴───────────────────────────────────────┘ Additional comments: - ttt means a 3-trit number with values from NNN (-13) to PPP (+13) - RR ttt instruction copies a register to/from R1 or performs an increment/decrement over R1 OONNN — copy R1 to R13 OONNO — copy R1 to R12 OONNP — copy R1 to R11 OONON — copy R1 to R10 OONOO — copy R1 to R9 OONOP...Read more »
I am very impressed by your project. I espescialy liked your io board.
I setout to write multiply, I finished but I am doubtfull that it
would work. I really wanted call/return, and unconditional skip.
please put them in your cpu. I am also suprised to find no a in your
alu. Atleast put in add. And another glaring whole is the inability
to write to memory. Just a simple load and store... though a stack
wants to index memory by a register. So my wishlist is call/return
add and write to memory. in detail...
add r1,rn ; r1= r1+rn
skip ; always
call ttt ; the usual, like jp, saving the return address on
; the stack
return ; pc= top of stack, drop the return address from the stack
RM ttt,rn ; memory[r13*27+ttt]= rn
RIdxM ttt,r1,rn ; memory[r13*27+ttt+r1]= rn
simple but addequit. I would implment them in the order listed. Do
you have any thoughts? Please let me know. Oh a halt instruction and
a way to ring a bell would be nice! But adding to the list of features
is always easy. :) Whats hard is leaving them out!
what folllows is my first atempt at a muliply..... and a joke...
-360: oppoo R1 POO / r1=9
-359: oppnn R2 PNN ; r2=5
-358: noooo jp ooo ; trimul
----: ;;; result in r5,6= 45
-357: oppon R1 PON ; r1=8
-356: oppn0 R2 PNO ; r2=6
-355: noooo jp ooo ; trimul
====: ;;; result in r5,6= 42 more or less
-354: nottt jp halt ; jp .
----: ; trimul
000: ooopp RR r4,r1
001: oooon dec r1
002: npopp skg r1
003: xxxxx ret
004: nopoo jp triadd
005: nooop jp oop ; again...
006: ; end
----: ; triadd result r5,6
009: ooonp RR r1,r2
010: oooon dec r1
011: npopp skg r1
012: nopnn jp pnn;ret
013: oopop RR r5,r1
014: oopno RR r1,r6
014: oooop inc r1
015: oopoo RR r6,r1
016: npoon skc -1
npppp skip r4>0
017: nopop JP pop
018: oopnn RR r1,r5
019: oooop inc r1
020: oopop RR r5,r1
021: nopop JP pop