15
“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 1/15

“Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

1/15

Page 2: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

2/15

1.0 Introduction

In 1840 Thomas Fowler, an English self-taught mathematician, invented a mechanical calculator that used, for the first time, the balanced ternary notation to perform calculations. The Balanced Ternary is a variant of the Base-3 notation in which each digit can be expressed as:

• Negative • Zero • Positive

that is: -, 0, + (to Fowler). In 1997 drawings of this machine were found, executed in 1840 by the great mathematician: Augustus De Morgan. In the figure a modern realization printed in 3D based on these drawings.

In 2018 a question arises spontaneously: are we ready to concretely use the balanced ternary? The project illustrated here with the implementation of the “All Ternary Monadic Functions Generator Board“ and, above all, with “Ternary Spacecraft Board” proposes to make a small contribution to the study and to the full understanding of the Ternary Balanced Logic.

Page 3: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

3/15

2.0 Ternary Logic: a "spacecraft" to explore it.

The board design called “Ternary Spacecraft” was born with the aim of providing a tool to explore what will henceforth be referred to as the "Galaxy" of Ternary Logic. It consists of two parts: a hardware one and a software one. Everything started, in the last months, from the following two articles:

• Appunti Logica Ternaria

• Monadic and Diadic Ternary Logic Simulation Results

published on my website https://giuseppetalarico.wordpress.com back in 2014. In the Binary system, all the logic functions with one input and one output (monadic functions) are: 2 ^ 2 = 4, as clearly shown in the table below:

x f0(x) f1(x) f2(x) f3(x) 0 0 1 0 1 1 0 0 1 1

Among the four monadic functions, only one of them, f1 (x), leads to an elementary logic gate commonly used in the design of digital boards: the NOT. The functions with two inputs and one output (dyadic functions) are instead: 2 ^ 4 = 16, as clearly shown in the table below:

x y 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

Among the 16 dyadic functions, six of them lead to usable elementary logic gates: AND [f8 (x, y)], NAND [f7 (x, y)], OR [f14 (x, y)], NOR [f1 (x, y)], XOR [f6 (x, y)], XNOR [f9 (x, y)]. If the logical dyadic functions are implemented with mux then all four monadic functions are used!

Page 4: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

4/15

Things in the ternary system are “slightly” different:

• Number of monadic functions: 3 ^ 3 = 27. • Number of dyadic functions: 3 ^ 9 = 19'683 (incredibly high number!)

It is easy to assume that nobody has ever ventured into the complete exploration of such a large number of functions, also due to the lack, to date, of commercially available components able to operate on three levels. In this galaxy of possible components, most of them have neither a symbol nor a name. The “Ternary Spacecraft”, which can be interfaced with either Arduino or Raspberry or any other system equipped with I2C, allows you to generate and explore, thanks to the use of an oscilloscope:

• the 27 ternary logic gates with one input and one output; • the 19'683 gates with two entrances and one exit.

Ultimately, the card creates a "Programmable Universal Ternary Dyadic Logic Gate". It consists essentially of a 9: 1 mux, made from four Mux 3: 1, of nine Trit generators that feed the nine inputs of the first level mux 3: 1 and two additional Trit generators to realize two possible ternary signals to be sent to the inputs of the dyadic gate. By programming, from time to time, the ternary truth table of the logic gate (inputs of the Mux) it is possible to obtain all the approximately twenty thousand logical gates mentioned above. Eventually, by appropriately programming the input ternary signals, it is possible to display and study the output waveforms (from which to obtain useful information for a possible use of them in the future design of circuit boards in ternary logic). An entire computer can be made with only MUXes. In fact, the latter are able to realize any truth table and therefore any combinational logic function. Moreover, the sequential digital circuits present in each computer are obtained starting from the combinational circuits.

3.0 The Two-way Binary MUX

Let’s start with the operation of a simple 2: 1 binary Mux. It can be compared to a two-position electro-mechanical selector. The "y" output is obtained by manually selecting one of the two possible inputs. In Mux 2: 1 the selection of the input bit, which is output (device output), is obtained through another selection bit "x" (which actually forms the device input). The two bits present at the inputs of the mux "I0", "I1" make the column of a Truth Table with only two lines. Ultimately, a Mux 2: 1 realizes a monadic device, that is with an input and an output, whose operation is regulated by a truth table consisting of a column and two lines.

Page 5: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

5/15

In terms of binary algebra, the output of the mux has the following logical expression:

y = (x * I0) + (x * I1) It is therefore an OR with two inputs, in turn made up of two dyadic AND whose inputs are: x, I0 for the first and x, I1 for the second. A mux can also be made from electronic switches and this is the way used to make the Ternary Spacecraft. As already mentioned, in the monadic binary case all the possible truth tables are four: 2 ^ (Number of Mux Input Bits). Ultimately, by imposing one of the four possible combinations as input to the mux it is possible to obtain one of the following four logical functions:

• Contradiction (always output at "0" whatever the value of the input) • Buffer (Output equal to the input) • Not (Input negation output) • Tautology (always output at "1" whatever the value of the input)

That is, in terms of truth tables:

x f0(x) f1(x) f2(x) f3(x)

0 0 1 0 1 1 0 0 1 1

The function f0 (x) always returns 0 (false) and the function f3 (x) always returns 1 (true), regardless of the value of the input symbol. The function f2 (x) returns the same value as the input symbol and therefore is called the Identity or Buffer function. The function f1 (x) returns the negated of the input value and is the only non-trivial of the four. The function f1 (x) is called NOT (logical negation):

f1(x) = NOT(x)

The binary values of the four truth tables are nothing more than the two-bit binary count from zero to three. The number assigned to each function corresponds to the binary value of the two bits in the table.

Page 6: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

6/15

The order of the columns of the four tables is completely arbitrary, so they can be arranged as follows:

x f-2(x) f-1(x) f0(x) f1(x) 0 0 1 0 1 1 1 1 0 0

The binary values are arranged according to the two's complement notation. The following formula applies to the table as follows:

fi (x) = NOT [f-i-1 (x)] with i in [0,1] This expression leads to formulating an interesting property that applies to the whole table:

"Half of the table is obtained by complementing the other half". This implies that it is enough to study half the functions, the others will simply be the same but complemented. What for the binary system and especially for the monadic functions is more of a curiosity, for the ternary functions its application is definitely more interesting.

3.1 The Binary Mux 4:1 All sixteen possible two-input binary functions are shown in the table below, adopting the two-complement representation. At the top of each column is shown the subscript of the dyadic function: fi (x, y) with i = [- 8.7]

x y -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7

0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0

The following formula applies to the table as follows:

fi (x,y) = NOT[ f-i-1 (x,y) ] con i in [-8,7]

As the highlights also suggest, half the table is obtained complementing, column by column, the other half.

Page 7: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

7/15

Some notable features:

• the function of index -2, that is: f-2 (x, y), is: x OR y • the function of index -8, that is: f-8 (x, y), is: x AND y • the function of index 6, that is: f6 (x, y), is: x XOR y

Furthermore:

• Since f7 (x, y) the NAND function, if x = 1, we have: f7 (1, y) = NOT (y) • Being f1 (x, y) the function NOR, if x = 0, we have: f1 (0, y) = NOT (y) • Since f6 (x, y) the function XOR, if x = 1, we have: f6 (1, y) = NOT (y)

Notice also that:

• f3 (x, y) = NOT (x), for each y • f-4 (x, y) = x, for each y

thus, for what has been said before:

f-4 (x, y) = NOT [f3 (x, y)] = NOT [NOT (x)] = x The mux 4: 1 allows to select (send in "output") a binary value between four, thanks to two inputs (binary signals) of selection "x" and "y" that make up the two true inputs of the dyadic device. The following figure shows the realization of such a device starting from three monadic 2: 1 muxes.

The previous scheme suggests that any binary dyadic function can be obtained starting from two monadic functions. The signal y selects from time to time which of the two monadic functions goes out, while the signal x has already selected which of the two possible monadic binary values, for both mux first level, they will form the inputs of the second level mux. This two-level mux model will come in handy later when we talk about the 9: 1 mux ternary.

Binary Dyadic Gate

Page 8: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

8/15

4.0 The Ternary Mux 3:1 The 3: 1 mux has 3 trit (or 1 Tribble) configuration, a selection Trit and a ternary output (Trit). Its truth table:

a c

1̅ I-

0 I0

1 I+

Page 9: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

9/15

The set of the 27 ternary monadic functions can be represented by the following truth tables, combined in a single one:

The function index, which in decimal would be i = [- 13.13], is here represented with the symbols in balanced eptaventesimal: i = [�̅�, D]. x represents the input Trit, while fi (x) represents the output Trit of the monadic gate. [I +, I0, I-] represents the generic configuration Tribble of the ternary monadic gate (the set of three Trit is called Tribble). In this case, observing the table, one has the following property:

fi (x) = NOT [f-i (x)]

• The index 0 function, called Unknown, divides the table into two. The two parts are the inverted copy of the other (note the colors).

• The index �̅� function is called Contradiction. • The index D function is called Tautology.

All three functions mentioned do not translate into useful devices, but are used in the implementation of dyadic functions with mux! The “Ternary Spacecraft” board has three Monadic outputs:

• MonOut+ • MonOut0 • MonOut-

programmable and each can generate all 27 functions. Eventually, configuring via software, the three mux of the first level with the same value of Tribble, the Dyadic output is downgraded to the Monadic output of the input signal "a", independently from the signal of "b".

X (i=) �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� �̅� 0 1 2 3 4 5 6 7 8 9 A B C D

1̅ 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1 1̅ 0 1

0 1̅ 1̅ 1̅ 0 0 0 1 1 1 1̅ 1̅ 1̅ 0 0 0 1 1 1 1̅ 1̅ 1̅ 0 0 0 1 1 1

1 1̅ 1̅ 1̅ 1̅ 1̅ 1̅ 1̅ 1̅ 1̅ 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1

Page 10: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

10/15

The following is the block diagram of the board:: “All Ternary Monadic Functions Generator“.

The diagram shown above has been submitted to the selection of the Maker Faire Rome 2018.

Page 11: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

11/15

4.1 The Ternary Mux 9:1 The 9: 1 mux has 9 trit (1 Tryte) configuration, two selection Trit and a ternary output (Trit).

The truth table of the ternary 9: 1 MUX is as follows:

a b c=f(a,b)

1̅ 1̅ I--

1̅ 0 I-0

1̅ 1 I-+

0 1̅ I0-

0 0 I00

0 1 I0+

1 1̅ I+-

1 0 I+0

1 1 I++

Page 12: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

12/15

5.0 Ternary Spacecraft Board Block Diagram The following board diagram shows the design and implementation made for the Maker Faire Rome 2018.

Page 13: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

13/15

5.1 Optical Interface with Raspberry Being the “Ternary Spacecraft” a "tweakable" board where to configure and/or display the ternary functions, an optical interface has been added to the design to safeguard the hardware integrity of the Raspberry or of the Arduino connected. Otherwise, an accidental short, even temporary, could have led to the failure of the I/O ports of the aforementioned devices.

5.2 Trit Generators The use of a DG 403, which consists of four analog electronic switches, allows to generate a trit. On the card there are nine Trit Generators to drive the dyadic port, that is to configure the nine ternary inputs of the 9: 1 mux, plus two more for the generation of the real ternary inputs of the dyadic device. Two I/O expansion circuits via the I2C standard interface are used to drive the DG403 selection inputs. Basically, a Bit-Trit decoder is implemented:

Bit Trit

00 0

01 1

11 1̅

5.3 Ternary Dual Mux The Ternary Dual Mux allows the implementation of the "Programmable Universal Ternary Gate" or a 9: 1 mux ternary, through the adoption of four 3: 1 mux ternaries. The scheme is that of two-level muxes.

5.4 Generation of input signals "a" and "b" The Mux 9:1 input signals "a" and "b" can be provided from the two special trit generators on-board or from the outside. The hardware arrangement takes place through two specially made straps. Connecting INPUT_a with Tsignal_a and INPUT_b with Tsignal_b the signals come from within the board and are generated via software.

Page 14: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

14/15

6.0 Ternary-Binary Compatibility If the generation of 1 is blocked by software, the board creates a "Universal Programmable Binary Gate" with which to obtain all 16 dyadic functions and 4 monadic ones. Both in Input and Output the signals assume the two classical values [0,1]. The following figure shows the board "downgrading":

If instead, no "0" is ever generated by software, the board works in binary mode with non-standard levels, the extreme ones of the ternary. This mode has been called "binary mode PM" (PlusMinus).

Page 15: “Ternary Spacecraft Board” for Maker Faire Roma 2018 ... · “Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico 3/15 2.0 Ternary Logic: a "spacecraft" to

“Ternary Spacecraft Board” for Maker Faire Roma 2018 Giuseppe Talarico

15/15

7.0 Ternary Spacecraft Software The configuration and operating software of the board has been totally developed in Python and runs on a Raspberry Pi v2 or v3. It allows you to control both the first boards created: the "All Ternary Monadic Functions Generator Board" and the second called "Ternary Spacecraft".

8.0 Contacts

Official Maker Faire project link:

http://bit.ly/MakerFaire2018

email: [email protected]