<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="it">
	<id>https://www.raspibo.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GiuliaN</id>
	<title>raspibo - Contributi utente [it]</title>
	<link rel="self" type="application/atom+xml" href="https://www.raspibo.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=GiuliaN"/>
	<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php/Speciale:Contributi/GiuliaN"/>
	<updated>2026-05-04T16:42:19Z</updated>
	<subtitle>Contributi utente</subtitle>
	<generator>MediaWiki 1.35.5</generator>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_7:A_computer_must_be_able_to_compute!&amp;diff=3941</id>
		<title>No more secrets Part 7:A computer must be able to compute!</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_7:A_computer_must_be_able_to_compute!&amp;diff=3941"/>
		<updated>2015-02-09T14:16:27Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We have seen circuits that can be used to select or route signals.&lt;br /&gt;
&lt;br /&gt;
The main function of a computer is (obviously) to perform computations.&lt;br /&gt;
The basic computation is the sum.&lt;br /&gt;
&lt;br /&gt;
We are going to implement a full adder: a circuit that sums three bits&lt;br /&gt;
together and provides two output bits, result and carry.&lt;br /&gt;
In fact, to add two numbers having an arbitrary number of digits we need&lt;br /&gt;
an algorithm to add three digits together. If you remember the algorithm&lt;br /&gt;
to sum two numbers learnt in the elementary school, the sum must proceed&lt;br /&gt;
column by column, right to left, in each column you have&lt;br /&gt;
to add the two digits of both numbers plus the carry resulted in the&lt;br /&gt;
computation of the previous column. You'll get two results in each column:&lt;br /&gt;
the digit of the result and the new carry to be used in the computation&lt;br /&gt;
of the following column.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA  inB  Cin  Cout Out&lt;br /&gt;
 0    0   0     0    0&lt;br /&gt;
 0    0   1     0    1&lt;br /&gt;
 0    1   0     0    1&lt;br /&gt;
 0    1   1     1    0&lt;br /&gt;
 1    0   0     0    1&lt;br /&gt;
 1    0   1     1    0&lt;br /&gt;
 1    1   0     1    0&lt;br /&gt;
 1    1   1     1    1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From a closer look of the table it appears that the output is the count of&lt;br /&gt;
the number of bits set to one in the input, encoded in binary.&lt;br /&gt;
When the inputs are all zero the output is 00, all the configurations where&lt;br /&gt;
there is only one bit set to 1 in the input (001, 010, 100) the output is&lt;br /&gt;
01, if two bits are one (011, 101, 110) the output is 10 and finally when&lt;br /&gt;
all the input bits are set, the output is 11.&lt;br /&gt;
&lt;br /&gt;
The most significant bit of the result has been named Cout, carry out&lt;br /&gt;
as it has to be connected to the Cin input of another full adder in order&lt;br /&gt;
to build a chain of adders able to sum an arbirary number of bits.&lt;br /&gt;
&lt;br /&gt;
[[File:adderchain.jpg]]&lt;br /&gt;
&lt;br /&gt;
We need 9 NAND gates to implement a full adder on out breadboard.&lt;br /&gt;
&lt;br /&gt;
[[File:fulladder.jpg]]&lt;br /&gt;
&lt;br /&gt;
This is the table of the jumpers&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA: AB&lt;br /&gt;
inB: AC&lt;br /&gt;
Cin: EG&lt;br /&gt;
A: BCI&lt;br /&gt;
B: D&lt;br /&gt;
C: D&lt;br /&gt;
D: EF&lt;br /&gt;
E: FGI&lt;br /&gt;
F: H&lt;br /&gt;
G: H&lt;br /&gt;
H: out&lt;br /&gt;
I: JJ Cout&lt;br /&gt;
J: Rcout&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(Rcout is not currently used. It will be later used to implement the&lt;br /&gt;
circuit of an entire ALU)&lt;br /&gt;
&lt;br /&gt;
It is interesting to see how a simple circuit can compute a sum of three&lt;br /&gt;
bits.&lt;br /&gt;
&lt;br /&gt;
Several full adder bradboards can be chained to sum binary numbers.&lt;br /&gt;
Using three boards it is possible to sum numbers from 0 to seven, four&lt;br /&gt;
boards permit to sum numbers in the range zero to fifteen.&lt;br /&gt;
&lt;br /&gt;
[[File:adder4boards.jpg]]&lt;br /&gt;
&lt;br /&gt;
The circuit of the full adder uses two XOR gates to compute the result.&lt;br /&gt;
In fact the result of the sum of two bits (not considering the carry bit)&lt;br /&gt;
is a xor:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inX inY out&lt;br /&gt;
 0   0   0&lt;br /&gt;
 0   1   1&lt;br /&gt;
 1   0   1&lt;br /&gt;
 1   1   0 (and carry=1)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The circuit is implemented as two, two-bit adders in a pipeline.&lt;br /&gt;
&lt;br /&gt;
[[File:adderxor.jpg]]&lt;br /&gt;
&lt;br /&gt;
For what concerns the carry, in the sum of two bits the carry is one&lt;br /&gt;
when both inputs are one, thus it is the reault of an AND gate.&lt;br /&gt;
&lt;br /&gt;
When the two two-bit adders are chaines in a pipeline to sum three bits&lt;br /&gt;
at most one two-bit adder can generate a carry.&lt;br /&gt;
The carry of the full adder is the result of an OR between the carry output&lt;br /&gt;
of the two two-bit adders.&lt;br /&gt;
&lt;br /&gt;
[[File:adderxorcarry.jpg]]&lt;br /&gt;
&lt;br /&gt;
The full adder circuit implemented on the breadboard is the one depicted&lt;br /&gt;
here above, implemented using only NAND gates.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3654</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3654"/>
		<updated>2014-10-22T15:02:52Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift_v2.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out3 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift_v2.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGJ&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BD&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Rightshift_v2.jpg&amp;diff=3653</id>
		<title>File:Rightshift v2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Rightshift_v2.jpg&amp;diff=3653"/>
		<updated>2014-10-22T15:01:57Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Leftshift_v2.jpg&amp;diff=3652</id>
		<title>File:Leftshift v2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Leftshift_v2.jpg&amp;diff=3652"/>
		<updated>2014-10-22T15:01:40Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_C:_Is_it_smaller,_larger_or_overflows%3F&amp;diff=3651</id>
		<title>No more secrets Part C: Is it smaller, larger or overflows?</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_C:_Is_it_smaller,_larger_or_overflows%3F&amp;diff=3651"/>
		<updated>2014-10-22T15:00:58Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The overflow and compare module is provided in two 'flavours'.&lt;br /&gt;
&lt;br /&gt;
The simplest module does not require any breadboard. This module is not able&lt;br /&gt;
and the L bit to the Rcout output of the same to work on signed data. The V and&lt;br /&gt;
L output lines are simply connected respectively to the Cout and Rcout outputs&lt;br /&gt;
of the full adder of the most significant bit.&lt;br /&gt;
&lt;br /&gt;
This is the 'circuit':&lt;br /&gt;
&lt;br /&gt;
[[File:overflow0.jpg]]&lt;br /&gt;
&lt;br /&gt;
The second implementation requires all the NAND gates of a breadboard&lt;br /&gt;
and is able to detect overflows and compute comparisons on signed and&lt;br /&gt;
unsigned numbers.&lt;br /&gt;
There is a specific input 'signed' which determines whether the data&lt;br /&gt;
are to be regarded as signed or unsigned and uses the correct&lt;br /&gt;
overflow detection or comparison algorithm.&lt;br /&gt;
&lt;br /&gt;
It is worth recalling that all the other components of the ALU compute&lt;br /&gt;
sums, subtractions using signed or unsigned numbers anyway, no matters which&lt;br /&gt;
overflow/comparison circuit we are using. The computations are the same,&lt;br /&gt;
input and output data just uses different encodings.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:overflow_v2.jpg]]&lt;br /&gt;
&lt;br /&gt;
and this is the map for jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Signed -&amp;gt; AG&lt;br /&gt;
Rout -&amp;gt; BD&lt;br /&gt;
Cin -&amp;gt; A&lt;br /&gt;
N -&amp;gt; FF&lt;br /&gt;
A -&amp;gt; BC&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; HJ outV&lt;br /&gt;
F -&amp;gt; G&lt;br /&gt;
G -&amp;gt; HI&lt;br /&gt;
H -&amp;gt; IJ&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; outL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Overflow_v2.jpg&amp;diff=3650</id>
		<title>File:Overflow v2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Overflow_v2.jpg&amp;diff=3650"/>
		<updated>2014-10-22T15:00:09Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_A:_A_complete_ALU&amp;diff=3649</id>
		<title>No more secrets Part A: A complete ALU</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_A:_A_complete_ALU&amp;diff=3649"/>
		<updated>2014-10-22T14:59:24Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An ALU is not just an adder, it is a circuit which is able to perform&lt;br /&gt;
several kinds of computations: both Arithmetic and Logic operations.&lt;br /&gt;
Our ALU is able to compute sums, subtractions, comparisons, and/or/not&lt;br /&gt;
bitwise logical operations, sign change, etc.&lt;br /&gt;
&lt;br /&gt;
An ALU has a number of control input line which select the operation,&lt;br /&gt;
two sets of input lines (two buses) for the operands and an output bus&lt;br /&gt;
for the result.&lt;br /&gt;
&lt;br /&gt;
The implementation of our ALU requires three breadboard per bit plus&lt;br /&gt;
two breadboard for zero and overflow detection.&lt;br /&gt;
A complete four-bit ALU then requires 14 breadboards, a three-bit ALU&lt;br /&gt;
just 11. Zero and overflow detection circuits are optional.&lt;br /&gt;
&lt;br /&gt;
Do not skip this section if you don't have so many breadboards or so many&lt;br /&gt;
friends to play with. It is possible to test each block separately and&lt;br /&gt;
use your imagination to envision how the entire structure behaves.&lt;br /&gt;
&lt;br /&gt;
Each bit of our ALU is composed by a three breadboards: a full adder,&lt;br /&gt;
a two-control bits multiplexer and the logical unit. We have already&lt;br /&gt;
presented the two former circuits, the latter one is presented in the&lt;br /&gt;
following part of this chapter.&lt;br /&gt;
&lt;br /&gt;
The block schematics is the following one:&lt;br /&gt;
&lt;br /&gt;
[[File:ALU1bit.jpg]]&lt;br /&gt;
&lt;br /&gt;
Several 1-bit ALUs can be connected/chained together.&lt;br /&gt;
It is possible to add an overflow and a zero check circuits.&lt;br /&gt;
&lt;br /&gt;
[[File:ALU4bit.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The logical unit selects which inputs are used in the computation and&lt;br /&gt;
performs some logical computations: 'and', 'or'.&lt;br /&gt;
&lt;br /&gt;
The schematics of our logical unit is in the following picture:&lt;br /&gt;
&lt;br /&gt;
[[File:logical_v2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is the map of the jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA -&amp;gt; A&lt;br /&gt;
enA -&amp;gt; A&lt;br /&gt;
inB -&amp;gt; B&lt;br /&gt;
enB -&amp;gt; B&lt;br /&gt;
invB -&amp;gt; CE&lt;br /&gt;
A -&amp;gt; GGK&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; DE&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; HHK&lt;br /&gt;
G -&amp;gt; I,outA&lt;br /&gt;
H -&amp;gt; I,outB&lt;br /&gt;
I -&amp;gt; JJ&lt;br /&gt;
J -&amp;gt; outAND&lt;br /&gt;
K -&amp;gt; outOR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This circuit has two data inputs: inA and inB. These inputs get the&lt;br /&gt;
value of two corresponding bits to be processed.&lt;br /&gt;
&lt;br /&gt;
There are three control input bits: enA, enB and invB.&lt;br /&gt;
The prefix 'en' means 'enable': if enA is zero the value of inA is&lt;br /&gt;
ignored, discared, i.e. inA is taken into consideration for the computation&lt;br /&gt;
only when enA is true. When enA is zero the first operand of the full&lt;br /&gt;
adder, of the 'and' operation , of the 'or' operator is zero.&lt;br /&gt;
Similarly enB is the enable bit for inB. When invB is one the value of B&lt;br /&gt;
is negated. So when enB is 1 the input for the second operand of the full&lt;br /&gt;
adder and of the logical operators (and, or) is B, or not B when invB is 1.&lt;br /&gt;
If enB is zero, the input of that second operand has the same value of invB.&lt;br /&gt;
&lt;br /&gt;
So, outA and outB have been pre-processed to be the inputs of the full adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA inB invB outA outB    outAND     outOR&lt;br /&gt;
 0   0   0    0    0        0          0&lt;br /&gt;
 0   0   1    0    1        0          1&lt;br /&gt;
 0   1   0    0    B        0          B&lt;br /&gt;
 0   1   1    0  notB       0        notB&lt;br /&gt;
 1   0   0    A    0        0          A&lt;br /&gt;
 1   0   1    A    1        A          A&lt;br /&gt;
 1   1   0    A    B      AandB      AorB&lt;br /&gt;
 1   1   1    A  notB  Aand(notB)  Aor(notB)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Logical_v2.jpg&amp;diff=3648</id>
		<title>File:Logical v2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Logical_v2.jpg&amp;diff=3648"/>
		<updated>2014-10-22T14:58:38Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: GiuliaN ha caricato una nuova versione di &amp;amp;quot;File:Logical v2.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Logical_v2.jpg&amp;diff=3647</id>
		<title>File:Logical v2.jpg</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Logical_v2.jpg&amp;diff=3647"/>
		<updated>2014-10-22T14:52:56Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=Renzo%27s_Bliki&amp;diff=3646</id>
		<title>Renzo's Bliki</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=Renzo%27s_Bliki&amp;diff=3646"/>
		<updated>2014-10-22T13:58:07Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Insomma... io ho un sacco di cose da dire e da scrivere e non so mai dove metterle in questo magnifico wiki di RaspiBO.&lt;br /&gt;
Soffro di ritenzione comunicativa.&lt;br /&gt;
&lt;br /&gt;
Pertanto attivo qui il mio Bliki: Una specie di Blog creato su di un wiki!&lt;br /&gt;
Mettero' man mano articoli (provvisti di data).&lt;br /&gt;
&lt;br /&gt;
I contenuti sono comunque qui. Se qualche anima gentile poi vorr&amp;amp;agrave; catalogare meglio i contenuti o riscrivere le idee&lt;br /&gt;
in modo migliore... avra' la mia gratitudine.&lt;br /&gt;
&lt;br /&gt;
renzo. Oct 28, 2013.&lt;br /&gt;
&lt;br /&gt;
=== 2014 October ===&lt;br /&gt;
&lt;br /&gt;
October 13: [[Seminar @ Maker Faire: slides and more]]&lt;br /&gt;
&lt;br /&gt;
=== 2014 September ===&lt;br /&gt;
&lt;br /&gt;
September 21: [[Millefori: draw, print, mill and drill your experimental PCBs]]&lt;br /&gt;
&lt;br /&gt;
September 14: [[Gert's VGA board for Raspberry PI B+ using off the shelf components]]&lt;br /&gt;
&lt;br /&gt;
=== 2014 August ===&lt;br /&gt;
&lt;br /&gt;
August 19: [[A new laser cutter/engraver for my Wasp 3D printer]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 11: Is this a divisor or a counter?]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 10: Synchronous memory]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part F: Circuits to remember]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part E: Shift to Multiply and Divide]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part D: Here is the ALU: all together now!]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part C: Is it smaller, larger or overflows?]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part B: Is it zero?]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part A: A complete ALU]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 9: An adder can subtract, too]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 8: More or Less? A trick to process signed numbers]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 7:A computer must be able to compute!]]&lt;br /&gt;
&lt;br /&gt;
August 14: [[No more secrets Part 6: Let us play together]]&lt;br /&gt;
&lt;br /&gt;
=== 2014 June ===&lt;br /&gt;
&lt;br /&gt;
June 10: [[No more secrets Part 5: Mux Demux ]]&lt;br /&gt;
&lt;br /&gt;
=== 2014 May ===&lt;br /&gt;
&lt;br /&gt;
May 27: [[No more secrets Part 4: Encode and Decode... ]]&lt;br /&gt;
&lt;br /&gt;
May 27: [[s2argv-execs: something was missing in libc]]&lt;br /&gt;
&lt;br /&gt;
May 16: [[No more secrets Part 3: A NAND is for everything]]&lt;br /&gt;
&lt;br /&gt;
May 16: [[No more secrets Part 2: Let us build the experimental board]]&lt;br /&gt;
&lt;br /&gt;
May 14: [[No more secrets in your CPU: Part 1]]&lt;br /&gt;
&lt;br /&gt;
May 9: [[Melodic irrationalities]]&lt;br /&gt;
&lt;br /&gt;
=== 2013 November ===&lt;br /&gt;
&lt;br /&gt;
Nov. 1: [[Why Intel Galileo is not my favourite platform]]&lt;br /&gt;
&lt;br /&gt;
=== 2013 October ===&lt;br /&gt;
&lt;br /&gt;
Oct. 7: [[Esperimenti con Intel Galileo]]&lt;br /&gt;
&lt;br /&gt;
=== 2013 August ===&lt;br /&gt;
&lt;br /&gt;
Aug. 13: [[Una stampa 3D per la doccia]]&lt;br /&gt;
&lt;br /&gt;
Aug. 06: [[Cronaca dei miei primi esperimenti di CNC]] (Renzo)&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_11:_Is_this_a_divisor_or_a_counter%3F&amp;diff=3641</id>
		<title>No more secrets Part 11: Is this a divisor or a counter?</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_11:_Is_this_a_divisor_or_a_counter%3F&amp;diff=3641"/>
		<updated>2014-10-20T09:23:49Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The answer is &amp;quot;both&amp;quot;. The circuit presented in this section is, at the&lt;br /&gt;
same time, a circuit to divide a frequency by two and an element to build a&lt;br /&gt;
counter, i.e. a circuit which counts.&lt;br /&gt;
In fact, our circuit will switches its status each time the input value&lt;br /&gt;
goes from one to zero (on the falling edge of the binary signal, in&lt;br /&gt;
technical jargon).&lt;br /&gt;
Here is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:divisor.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ck -&amp;gt; ABEE&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; D&lt;br /&gt;
C -&amp;gt; DF&lt;br /&gt;
D -&amp;gt; CG&lt;br /&gt;
E -&amp;gt; FG&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; BI out&lt;br /&gt;
I -&amp;gt; AH&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit, connect the input ck to the master clock and plug in&lt;br /&gt;
two leds, one to the master clock output and the other to the output (out)&lt;br /&gt;
of our circuit.&lt;br /&gt;
If everything works properly you will see that the led connected to the&lt;br /&gt;
output switches its state, zero to one or one to zero, when the other&lt;br /&gt;
led turns off. So, if the master clock led is flashing at about 1Hz, the&lt;br /&gt;
other led has a frequency of 0.5Hz.&lt;br /&gt;
On the other hand if we take note to the configurations of the two leds&lt;br /&gt;
we will get the following table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
out ck&lt;br /&gt;
0   0&lt;br /&gt;
0   1&lt;br /&gt;
1   0&lt;br /&gt;
1   1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
... then the sequence restarts from its beginning.&lt;br /&gt;
This is a two bit counter, it count from zero up to three and then&lt;br /&gt;
overflows and restarts from zero (wraparound, in technicalese).&lt;br /&gt;
&lt;br /&gt;
Using more breadboards it is possible to implement counters using more&lt;br /&gt;
bits. The divisors must be chained: the LSB of the counter is a master&lt;br /&gt;
clock of a board, connect it to the ck input on the same board and&lt;br /&gt;
you will get the second-LSB of the result. Then connect the out of this board&lt;br /&gt;
to the ck of the following one and so on up to the number of bits of the&lt;br /&gt;
counter. Three breadboards permit to implement a four bit counter.&lt;br /&gt;
&lt;br /&gt;
[[File:chaineddivisor.jpg]]&lt;br /&gt;
&lt;br /&gt;
The first out signal provides divides the frequency of the clock by two,&lt;br /&gt;
and in the same way all the other divisors further divide the resulting&lt;br /&gt;
frequency by two.&lt;br /&gt;
&lt;br /&gt;
The output of this circuit can be visualized by the following table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
o3 o2 o1 o0=ck&lt;br /&gt;
0  0  0  0&lt;br /&gt;
0  0  0  1&lt;br /&gt;
0  0  1  0&lt;br /&gt;
0  0  1  1&lt;br /&gt;
0  1  0  0&lt;br /&gt;
0  1  0  1&lt;br /&gt;
0  1  1  0&lt;br /&gt;
0  1  1  1&lt;br /&gt;
1  0  0  0&lt;br /&gt;
1  0  0  1&lt;br /&gt;
1  0  1  0&lt;br /&gt;
1  0  1  1&lt;br /&gt;
1  1  0  0&lt;br /&gt;
1  1  0  1&lt;br /&gt;
1  1  1  0&lt;br /&gt;
1  1  1  1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A four traces oscilloscope would show the following traces:&lt;br /&gt;
&lt;br /&gt;
[[File:divisoroscilloscope.jpg]]&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_10:_Synchronous_memory&amp;diff=3638</id>
		<title>No more secrets Part 10: Synchronous memory</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_10:_Synchronous_memory&amp;diff=3638"/>
		<updated>2014-10-18T13:34:35Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The computational circuits generate a binary output depending (only) on&lt;br /&gt;
the value of their inputs. These circuits are called combinatorial&lt;br /&gt;
circuit because their output does not depend on the time. Providing them&lt;br /&gt;
with a specific input data configuration, they give the same result.&lt;br /&gt;
Oue ALU is an example of combinatorial circuit: for a given configuration&lt;br /&gt;
ot its input pins (data and control pins) it always generates the sale&lt;br /&gt;
output.&lt;br /&gt;
&lt;br /&gt;
A closer look of a combinatorial circuit would reveal that it need a bit&lt;br /&gt;
of time to converge to its result, the time neede by all the logical gates&lt;br /&gt;
to switch to their new status.&lt;br /&gt;
&lt;br /&gt;
A memory to store the current status is the trick to generate sequential&lt;br /&gt;
circuits. The current status is used by the combinatorial circuits to&lt;br /&gt;
compute the next status which is stored in the memory for the next step.&lt;br /&gt;
&lt;br /&gt;
In order for this circuit to work properly, the status storage circuit&lt;br /&gt;
must be composed by cells able to store the new status and to give the&lt;br /&gt;
old status at the same time, otherwise the output of the current&lt;br /&gt;
computation could be erroneously taken immediately as input of the&lt;br /&gt;
computation itself. So if the combinatorial circuit, for example, adds&lt;br /&gt;
one to the former status, the new value could be taken erroneously as&lt;br /&gt;
input and add two, three, etc. resulting in a unpredictable result.&lt;br /&gt;
It would play like an orchestra without a director.&lt;br /&gt;
&lt;br /&gt;
This is the goal of the master-slave flip-flop (MSFF).&lt;br /&gt;
Here is the schematics of a MSFF. (The reset part is optional. It will be&lt;br /&gt;
described below.)&lt;br /&gt;
&lt;br /&gt;
[[File:msff.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in -&amp;gt; A&lt;br /&gt;
w(ck) -&amp;gt; ABGG&lt;br /&gt;
(notreset -&amp;gt; C)&lt;br /&gt;
A -&amp;gt; BE&lt;br /&gt;
B -&amp;gt; F (or B -&amp;gt; C)&lt;br /&gt;
(C -&amp;gt; DD)&lt;br /&gt;
(D -&amp;gt; F)&lt;br /&gt;
E -&amp;gt; FH&lt;br /&gt;
F -&amp;gt; EI&lt;br /&gt;
G -&amp;gt; HI&lt;br /&gt;
H -&amp;gt; J&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K out&lt;br /&gt;
K -&amp;gt; J&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This circuit is composed by two latches. The first (composed by gates&lt;br /&gt;
E and F) is storing the new value when ck is one, the second (gates J and&lt;br /&gt;
K) copies the value of the first latch when ck drops to zero.&lt;br /&gt;
&lt;br /&gt;
In this way, when ck is one the combinatorial circuit can compute a new&lt;br /&gt;
value which is stored in the first latch. In fact, when ck is one the two&lt;br /&gt;
latches are insulated and can have different values stored. So, status&lt;br /&gt;
changes made by the combinatorial circuit are stored in the first latch&lt;br /&gt;
but cannot be propagated again in the combinatorial circuit as inputs.&lt;br /&gt;
In other words, the input of the combinatorial circuit is stable.&lt;br /&gt;
&lt;br /&gt;
When ck switches to zero the value of the first latch becomes stable and&lt;br /&gt;
is copied in the second latch. When ck is zero, the input in of the&lt;br /&gt;
MSFF is ignored.&lt;br /&gt;
&lt;br /&gt;
The optional circuit composed by gates C and D adds an input pin to reset&lt;br /&gt;
the flip-flop. Our MSFF workd properly when the pin notreset is one, i.e.&lt;br /&gt;
it is connected to the positive rail of the breadboard.&lt;br /&gt;
&lt;br /&gt;
If notreset is temporarily set to zero our MSFF value is reset to zero.&lt;br /&gt;
This pin can be used to force the MSFF to have value zero when the circuit&lt;br /&gt;
is powered up. Without this circuit, a flip-flop, and in general any latch,&lt;br /&gt;
has an initial random value, zero or one, depending on which gate of the&lt;br /&gt;
latch converges first.&lt;br /&gt;
Many circuts can have random initial values, but some do not.&lt;br /&gt;
It is the case, for example, of the program counter, the register which&lt;br /&gt;
stores the address of the next instruction to be executed.&lt;br /&gt;
A register in our CPU is an array of MSFF.&lt;br /&gt;
This register must have a pre-determined value at startup; zero can be&lt;br /&gt;
a good choice.&lt;br /&gt;
&lt;br /&gt;
If we connect the notreset pin to a circuit like the following one:&lt;br /&gt;
&lt;br /&gt;
[[File:resetschematics.jpg]]&lt;br /&gt;
&lt;br /&gt;
our flip-flop will always have out equals to one when the circuit is turned&lt;br /&gt;
on. In fact, at startup notreset will be zero until the capacitor has been&lt;br /&gt;
charged to the one level and then it will be one forever.&lt;br /&gt;
&lt;br /&gt;
To test our MSFF connect the notreset pin to one (or to the circuit above&lt;br /&gt;
if you have implemented it). Then connect two leds at the outputs of gates&lt;br /&gt;
E and J and buttons conencted to in and ck(w).&lt;br /&gt;
Now, decide which value you want to store in our FF. If it is one push the&lt;br /&gt;
button connected to in, otherwise leave it unpushed. Now, keeping the in&lt;br /&gt;
button in that state, push the ck(w) button and keep it pressed for a while&lt;br /&gt;
to better understand how this circuit works. You should see the value&lt;br /&gt;
connected to the E gate chenging its state to assume the same value as in.&lt;br /&gt;
The led connected to the E gate showd the status of the first latch, it has&lt;br /&gt;
been added just for educational purposes, it is not a real output of the&lt;br /&gt;
system. The value of out is shown by the led connected to the J gate,&lt;br /&gt;
this value does not change while ck(w) is one.&lt;br /&gt;
&lt;br /&gt;
When the button connected to ck(w) is released, the value of the first&lt;br /&gt;
latch is copied to the second, so the output led (connected to gate J)&lt;br /&gt;
gets the same status of the other led.&lt;br /&gt;
&lt;br /&gt;
You can also connect the ck(w) the master clock and a third led to the&lt;br /&gt;
output of the clock. You will see that the input provided by the in button&lt;br /&gt;
is copied in the master latch (gates EF) when the clock is one and then to&lt;br /&gt;
the slave latch (JK) when the clock shitches to zero.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_B:_Is_it_zero%3F&amp;diff=3618</id>
		<title>No more secrets Part B: Is it zero?</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_B:_Is_it_zero%3F&amp;diff=3618"/>
		<updated>2014-10-16T16:34:45Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This module checks if the result of a computation is zero or not.&lt;br /&gt;
The output of the circuit is one if all its input lines are zero.&lt;br /&gt;
Viceversa, if one of its input has value one, the output is zero.&lt;br /&gt;
&lt;br /&gt;
It is an implementation of a four inputs NOR gate.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:PartB.png]]&lt;br /&gt;
&lt;br /&gt;
and this is the map for jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
i0 -&amp;gt; AA&lt;br /&gt;
i1 -&amp;gt; BB&lt;br /&gt;
i2 -&amp;gt; EE&lt;br /&gt;
i3 -&amp;gt; FF&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; DD&lt;br /&gt;
D -&amp;gt; I&lt;br /&gt;
E -&amp;gt; G&lt;br /&gt;
F -&amp;gt; G&lt;br /&gt;
G -&amp;gt; HH&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; outnotZ JJ&lt;br /&gt;
J -&amp;gt; outZ&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
notZ output is just for testing. When a led is connected to this line&lt;br /&gt;
the entire circuit is a four inputs OR gate, so the led turns on when&lt;br /&gt;
at least one of the input line is one.&lt;br /&gt;
outZ is the result of a NOR gate so it has the opposite behavior: a led&lt;br /&gt;
diode connected to outZ lits when all the inputs are zero and it get&lt;br /&gt;
turned off as soon as at least one input has the value one.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:PartB.png&amp;diff=3617</id>
		<title>File:PartB.png</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:PartB.png&amp;diff=3617"/>
		<updated>2014-10-16T16:32:50Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3597</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3597"/>
		<updated>2014-10-15T12:33:17Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out3 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGJ&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BD&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3596</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3596"/>
		<updated>2014-10-15T09:05:42Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out3 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGJ&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BDEE&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3595</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3595"/>
		<updated>2014-10-15T08:46:36Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out3 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGI&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BDEE&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3594</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3594"/>
		<updated>2014-10-14T14:26:17Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
I -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out2 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGI&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BDEE&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3593</id>
		<title>No more secrets Part E: Shift to Multiply and Divide</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_E:_Shift_to_Multiply_and_Divide&amp;diff=3593"/>
		<updated>2014-10-14T14:24:32Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a left shift circuit for three bits:&lt;br /&gt;
&lt;br /&gt;
[[File:leftshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; A&lt;br /&gt;
in2 -&amp;gt; BD&lt;br /&gt;
in1 -&amp;gt; EG&lt;br /&gt;
in0 -&amp;gt; JH&lt;br /&gt;
SL -&amp;gt; BEH&lt;br /&gt;
NSL -&amp;gt; ADGJ&lt;br /&gt;
A -&amp;gt; C&lt;br /&gt;
B -&amp;gt; C&lt;br /&gt;
C -&amp;gt; out3&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; out2&lt;br /&gt;
G -&amp;gt; I&lt;br /&gt;
H -&amp;gt; I&lt;br /&gt;
O -&amp;gt; out1&lt;br /&gt;
J -&amp;gt; KK&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit exactly one of the inputs SL or NSL must be set to&lt;br /&gt;
one. When NSL is one the 4 input bits are copied to the outputs.&lt;br /&gt;
When SL is one in0 is copied to out1, in1 to out2, in2 to out2 and out0 is&lt;br /&gt;
zero. If we give to the four input bits the meaning of the binary&lt;br /&gt;
representation of a number, when SL is one the result is the input times&lt;br /&gt;
two. The result is correct both for signed and unsigned numbers provided&lt;br /&gt;
the result can be stored in four bits.&lt;br /&gt;
&lt;br /&gt;
For esample:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
leftshift(3) = leftshift(0011) = 0110 = 6 (both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
leftshift(5) = leftshift(0101) = 1010 = 10 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
leftshift(-3) = leftshift(1101) = 1010 = -6 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to test the circuit in this way: plug four leds on the&lt;br /&gt;
output and connect NSL to one (positive rail). Now set a random input&lt;br /&gt;
configuration, you'll see the same configuration in the pattern of&lt;br /&gt;
leds. Moving the jumper from NSL to SL the led pattern will move (left) and the&lt;br /&gt;
least significant bit will be zero.&lt;br /&gt;
&lt;br /&gt;
A right shift circuit can divide values by two in a similar manner.&lt;br /&gt;
Unfortunately, in this case signed and unsigned numbers must be processed&lt;br /&gt;
in a different way.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:rightshift.jpg]]&lt;br /&gt;
&lt;br /&gt;
and the jumper table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in3 -&amp;gt; AC&lt;br /&gt;
in2 -&amp;gt; DF&lt;br /&gt;
in1 -&amp;gt; GI&lt;br /&gt;
in0 -&amp;gt; J&lt;br /&gt;
SR -&amp;gt; CFI&lt;br /&gt;
NSR -&amp;gt; DGI&lt;br /&gt;
copy3 -&amp;gt; A&lt;br /&gt;
A -&amp;gt; BB&lt;br /&gt;
B -&amp;gt; out3&lt;br /&gt;
C -&amp;gt; E&lt;br /&gt;
D -&amp;gt; E&lt;br /&gt;
E -&amp;gt; out2&lt;br /&gt;
F -&amp;gt; H&lt;br /&gt;
G -&amp;gt; H&lt;br /&gt;
H -&amp;gt; out1&lt;br /&gt;
I -&amp;gt; K&lt;br /&gt;
J -&amp;gt; K&lt;br /&gt;
K -&amp;gt; out0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now the valid configurations for SR, NSR and copy3 are the following ones:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SR NSR copy3&lt;br /&gt;
0   1   1     copy all the inputs in the corrisponding outputs&lt;br /&gt;
1   0   0     shift right for unsigned (the MSB is zero)&lt;br /&gt;
              (also known as logical shift)&lt;br /&gt;
1   0   1     shift right for signed (the MSB is copied)&lt;br /&gt;
              (A.K.A. arithmetic shift)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between a logical shift and an arithmetic shift is the&lt;br /&gt;
management of the Most Significant Bit (MSB, i.e. out3):&lt;br /&gt;
a logical shift resets it to zero while an arithmetic shift copies the&lt;br /&gt;
former value of the MSB, out2 and out3 has always the same value in&lt;br /&gt;
an arithmetic shift.&lt;br /&gt;
In other words, an arithmetic shift keeps the sign bit unchanged.&lt;br /&gt;
&lt;br /&gt;
A logical right shift is a division by two operation for unsigned integers.&lt;br /&gt;
An arithmentic right shift is a division by two only for positive integers&lt;br /&gt;
and for even negative numbers. For odd negative numbers the result is&lt;br /&gt;
rounded downwards, so incorrect.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(any kind of right shift, logical or arithmetic).&lt;br /&gt;
rightshift(3) = leftshift(0110) = 0011 = 3&lt;br /&gt;
(both for unsigned and signed numbers)&lt;br /&gt;
&lt;br /&gt;
logical_rightshift(10) = logical_rightshift(1010) =&lt;br /&gt;
    = 101 = 5 (unsigned only!)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-6) = arithmetic_rightshift(1010) =&lt;br /&gt;
    = 1101 = -3 (signed)&lt;br /&gt;
&lt;br /&gt;
arithmetic_rightshift(-3) = arithmetic_rightshift(1101) =&lt;br /&gt;
    = 1110 = -2 (signed)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A complete and flexible shifter can be implemented using three breadboards.&lt;br /&gt;
&lt;br /&gt;
[[File:completeshifter.jpg]]&lt;br /&gt;
&lt;br /&gt;
The shift control circuit has two control bits sh0 and sh1 supporting&lt;br /&gt;
the following configurations:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 sh0&lt;br /&gt;
0   0   do not shift&lt;br /&gt;
0   1   left shift&lt;br /&gt;
1   0   (logical) right shift&lt;br /&gt;
1   1   arithmetic right shift&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the map for the jumpers:&lt;br /&gt;
&lt;br /&gt;
[[File:shiftcontrol.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sh1 -&amp;gt; AABC outSR&lt;br /&gt;
sh0 -&amp;gt; BDEE&lt;br /&gt;
A -&amp;gt; outNSR&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; outcopy3&lt;br /&gt;
D -&amp;gt; EE outNSL&lt;br /&gt;
E -&amp;gt; outSL&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_A:_A_complete_ALU&amp;diff=3564</id>
		<title>No more secrets Part A: A complete ALU</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_A:_A_complete_ALU&amp;diff=3564"/>
		<updated>2014-10-12T19:32:26Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An ALU is not just an adder, it is a circuit which is able to perform&lt;br /&gt;
several kinds of computations: both Arithmetic and Logic operations.&lt;br /&gt;
Our ALU is able to compute sums, subtractions, comparisons, and/or/not&lt;br /&gt;
bitwise logical operations, sign change, etc.&lt;br /&gt;
&lt;br /&gt;
An ALU has a number of control input line which select the operation,&lt;br /&gt;
two sets of input lines (two buses) for the operands and an output bus&lt;br /&gt;
for the result.&lt;br /&gt;
&lt;br /&gt;
The implementation of our ALU requires three breadboard per bit plus&lt;br /&gt;
two breadboard for zero and overflow detection.&lt;br /&gt;
A complete four-bit ALU then requires 14 breadboards, a three-bit ALU&lt;br /&gt;
just 11. Zero and overflow detection circuits are optional.&lt;br /&gt;
&lt;br /&gt;
Do not skip this section if you don't have so many breadboards or so many&lt;br /&gt;
friends to play with. It is possible to test each block separately and&lt;br /&gt;
use your imagination to envision how the entire structure behaves.&lt;br /&gt;
&lt;br /&gt;
Each bit of our ALU is composed by a three breadboards: a full adder,&lt;br /&gt;
a two-control bits multiplexer and the logical unit. We have already&lt;br /&gt;
presented the two former circuits, the latter one is presented in the&lt;br /&gt;
following part of this chapter.&lt;br /&gt;
&lt;br /&gt;
The block schematics is the following one:&lt;br /&gt;
&lt;br /&gt;
[[File:ALU1bit.jpg]]&lt;br /&gt;
&lt;br /&gt;
Several 1-bit ALUs can be connected/chained together.&lt;br /&gt;
It is possible to add an overflow and a zero check circuits.&lt;br /&gt;
&lt;br /&gt;
[[File:ALU4bit.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The logical unit selects which inputs are used in the computation and&lt;br /&gt;
performs some logical computations: 'and', 'or'.&lt;br /&gt;
&lt;br /&gt;
The schematics of our logical unit is in the following picture:&lt;br /&gt;
&lt;br /&gt;
[[File:logical.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is the map of the jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA -&amp;gt; A&lt;br /&gt;
enA -&amp;gt; A&lt;br /&gt;
inB -&amp;gt; B&lt;br /&gt;
enB -&amp;gt; B&lt;br /&gt;
invB -&amp;gt; CE&lt;br /&gt;
A -&amp;gt; GGK&lt;br /&gt;
B -&amp;gt; CD&lt;br /&gt;
C -&amp;gt; DE&lt;br /&gt;
D -&amp;gt; F&lt;br /&gt;
E -&amp;gt; F&lt;br /&gt;
F -&amp;gt; HHK&lt;br /&gt;
G -&amp;gt; I,outA&lt;br /&gt;
H -&amp;gt; I,outB&lt;br /&gt;
I -&amp;gt; JJ&lt;br /&gt;
J -&amp;gt; outAND&lt;br /&gt;
K -&amp;gt; outOR&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This circuit has two data inputs: inA and inB. These inputs get the&lt;br /&gt;
value of two corresponding bits to be processed.&lt;br /&gt;
&lt;br /&gt;
There are three control input bits: enA, enB and invB.&lt;br /&gt;
The prefix 'en' means 'enable': if enA is zero the value of inA is&lt;br /&gt;
ignored, discared, i.e. inA is taken into consideration for the computation&lt;br /&gt;
only when enA is true. When enA is zero the first operand of the full&lt;br /&gt;
adder, of the 'and' operation , of the 'or' operator is zero.&lt;br /&gt;
Similarly enB is the enable bit for inB. When invB is one the value of B&lt;br /&gt;
is negated. So when enB is 1 the input for the second operand of the full&lt;br /&gt;
adder and of the logical operators (and, or) is B, or not B when invB is 1.&lt;br /&gt;
If enB is zero, the input of that second operand has the same value of invB.&lt;br /&gt;
&lt;br /&gt;
So, outA and outB have been pre-processed to be the inputs of the full adder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
inA inB invB outA outB    outAND     outOR&lt;br /&gt;
 0   0   0    0    0        0          0&lt;br /&gt;
 0   0   1    0    1        0          1&lt;br /&gt;
 0   1   0    0    B        0          B&lt;br /&gt;
 0   1   1    0  notB       0        notB&lt;br /&gt;
 1   0   0    A    0        0          A&lt;br /&gt;
 1   0   1    A    1        A          A&lt;br /&gt;
 1   1   0    A    B      AandB      AorB&lt;br /&gt;
 1   1   1    A  notB  Aand(notB)  Aor(notB)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_9:_An_adder_can_subtract,_too&amp;diff=3559</id>
		<title>No more secrets Part 9: An adder can subtract, too</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_9:_An_adder_can_subtract,_too&amp;diff=3559"/>
		<updated>2014-10-09T14:22:56Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Now we can add positive and negative numbers.&lt;br /&gt;
Do we need a specific circuit to compute subtraction? The answer is again&lt;br /&gt;
&amp;quot;almost no&amp;quot;. All what we need is a circuit able to compute the&lt;br /&gt;
ones' complement of a number, i.e. able to flip all the bit values of a&lt;br /&gt;
number, all the zeros become ones and viceversa.&lt;br /&gt;
&lt;br /&gt;
The trick is the following: if we add the minuend to the ones' complement&lt;br /&gt;
of the subtrahend and we further add one, we get the difference.&lt;br /&gt;
&lt;br /&gt;
We can see this from another point of view, if we add one to the one's&lt;br /&gt;
complement of a number we get its opposite.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0100 is 4&lt;br /&gt;
1011 is the one's complement of 0100&lt;br /&gt;
adding one the result is:&lt;br /&gt;
1100 which is -4&lt;br /&gt;
&lt;br /&gt;
1001 is -7&lt;br /&gt;
0110 is the one's complement of 1001&lt;br /&gt;
adding one the result is:&lt;br /&gt;
0111 which is 7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, the 'trick' adds the opposite of the subtrahend to the minuend.&lt;br /&gt;
&lt;br /&gt;
Not surprisingly the 'trick' works for both signed and unsigned numbers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unsigned&lt;br /&gt;
 4 - 2 = 0100 - 0010 = 0100 + 1101 + 1 = (1)0010 = 2&lt;br /&gt;
10 - 3 = 1010 - 0011 = 1010 + 1100 + 1 = (1)0111 = 7&lt;br /&gt;
13 - 3 = 1101 - 0011 = 1101 + 0100 + 1 = (1)1010 = 10&lt;br /&gt;
signed&lt;br /&gt;
 4 - 2 = 0100 - 0010 = 0100 + 1101 + 1 = (1)0010 = 2&lt;br /&gt;
-3 - 3 = 1101 - 0011 = 1101 + 0100 + 1 = (1)1010 = -6&lt;br /&gt;
-3 -(-3) = 1101 - 1101 = 1101 + 0010 + 1 = (1)0000 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to use a chain of full adders to compute substractions we need:&lt;br /&gt;
* to supply the ones' complement of the second operand&lt;br /&gt;
* to set the Cin of the MSB adder to one (this will be the extra 1 added&lt;br /&gt;
in to the one's complement).&lt;br /&gt;
&lt;br /&gt;
If we set the input lines as just described, the output line provides the&lt;br /&gt;
correct value of the difference.&lt;br /&gt;
&lt;br /&gt;
The same circuit can be used to compare numbers, too.&lt;br /&gt;
In fact if we subtract unsigned numbers, the result is meaningful only when&lt;br /&gt;
the minuend is larger than the subtrahend. In this case the Cout of the&lt;br /&gt;
MSB adder is one, otherwise it is zero.&lt;br /&gt;
So, if we set up the circuit to compute the difference X - Y and we consider&lt;br /&gt;
only the Cout of the MSB: Cout is 1 if X &amp;gt;= Y, Cout is 0 otherwise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
X=10 Y=3&lt;br /&gt;
10 - 3 = 1010 - 0011 = 1010 + 1100 + 1 = (1)0111 Cout is 1: 10 &amp;gt;= 3&lt;br /&gt;
10 - 10 = 1010 - 1010 = 1010 + 0101 + 1 = (1)0000 Cout is 1: 10 &amp;gt;= 10&lt;br /&gt;
3 - 10 = 0011 - 1010 = 0011 + 0101 + 1 = (0)1001 Cout is 0: 3 &amp;lt; 10&lt;br /&gt;
(the result, 9 is wrong, as 3 - 10 cannot be represented as unsigned number!)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to compare signed numbers too, but the situation is a bit&lt;br /&gt;
more complex.  In this case X &amp;lt; Y if the result of a XOR between the signed&lt;br /&gt;
overflow and the value of the MSB of the result is one (the signed overflow&lt;br /&gt;
itself is the result of a XOR between the Cout and the Cin of the MSB).&lt;br /&gt;
&lt;br /&gt;
This definition gives the correct result even in case of overflow of the&lt;br /&gt;
subtraction.&lt;br /&gt;
&lt;br /&gt;
Maybe some examples can help to understand the rule:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=4 B=6 unsigned: 0100 - 0110 = 0100 + 1001 + 1 = (0)1110&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=4 B=6 signed 0100 - 0110 = 0100 + 1001 + 1 = (0)1110&lt;br /&gt;
                              100 +  001 + 1 = (0)110&lt;br /&gt;
overflow=0 MSB=1   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
&lt;br /&gt;
A=10 B=3 unsigned: 1010 - 0011 = 1010 + 1100 + 1 = (1)0111&lt;br /&gt;
Cout=1 so A &amp;gt;= B&lt;br /&gt;
A=-6 B=3 signed 1010 - 0110 = 1010 + 1100 + 1 = (1)0111&lt;br /&gt;
                               010 +  100 + 1 = (0)111&lt;br /&gt;
overflow=1 MSB=0   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
Note that 10 as a signed 4 bit number and -6 as signed number have&lt;br /&gt;
the same representation.&lt;br /&gt;
&lt;br /&gt;
A=12 B=14 unsigned: 1100 - 1110 = 1100 + 0001 + 1 = (0)1110&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=-4 B=-2 signed: 1100 - 1110 = 1100 + 0001 + 1 = (0)1110&lt;br /&gt;
                                 100 +  001 + 1 = (0)110&lt;br /&gt;
overflow=0 MSB=1   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
&lt;br /&gt;
A=7 B=10 unsigned: 0110 - 1010 = 0110 + 0101 + 1 = (0)1100&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=7 B=-6 signed: 0110 - 1010 = 0110 + 0101 + 1 = (0)1100&lt;br /&gt;
                                110 +  101 + 1 = (1)100&lt;br /&gt;
overflow=1 MSB=1   Cout XOR MSB=0 so A&amp;gt;=B&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_9:_An_adder_can_subtract,_too&amp;diff=3558</id>
		<title>No more secrets Part 9: An adder can subtract, too</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_9:_An_adder_can_subtract,_too&amp;diff=3558"/>
		<updated>2014-10-09T14:20:28Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Now we can add positive and negative numbers.&lt;br /&gt;
Do we need a specific circuit to compute subtraction? The answer is again&lt;br /&gt;
&amp;quot;almost no&amp;quot;. All what we need is a circuit able to compute the&lt;br /&gt;
ones' complement of a number, i.e. able to flip all the bit values of a&lt;br /&gt;
number, all the zeros become ones and viceversa.&lt;br /&gt;
&lt;br /&gt;
Thr trick is the following: if we add the minuend to the ones' complement&lt;br /&gt;
of the subtrahend and we further add one, we get the difference.&lt;br /&gt;
&lt;br /&gt;
We can see this from another point of view, if we add one to the one's&lt;br /&gt;
complement of a number we get its opposite.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0100 is 4&lt;br /&gt;
1011 is the one's complement of 0100&lt;br /&gt;
adding one the result is:&lt;br /&gt;
1100 which is -4&lt;br /&gt;
&lt;br /&gt;
1001 is -7&lt;br /&gt;
0110 is the one's complement of 1001&lt;br /&gt;
adding one the result is:&lt;br /&gt;
0111 which is 7&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, the 'trick' adds the opposite of the subtrahend to the minuend.&lt;br /&gt;
&lt;br /&gt;
Not surprisingly the 'trick' works for both signed and unsigned numbers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unsigned&lt;br /&gt;
 4 - 2 = 0100 - 0010 = 0100 + 1101 + 1 = (1)0010 = 2&lt;br /&gt;
10 - 3 = 1010 - 0011 = 1010 + 1100 + 1 = (1)0111 = 7&lt;br /&gt;
13 - 3 = 1101 - 0011 = 1101 + 0100 + 1 = (1)1010 = 10&lt;br /&gt;
signed&lt;br /&gt;
 4 - 2 = 0100 - 0010 = 0100 + 1101 + 1 = (1)0010 = 2&lt;br /&gt;
-3 - 3 = 1101 - 0011 = 1101 + 0100 + 1 = (1)1010 = -6&lt;br /&gt;
-3 -(-3) = 1101 - 1101 = 1101 + 0010 + 1 = (1)0000 = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to use a chain of full adders to compute substractions we need:&lt;br /&gt;
* to supply the ones' complement of the second operand&lt;br /&gt;
* to set the Cin of the MSB adder to one (this will be the extra 1 added&lt;br /&gt;
in to the one's complement).&lt;br /&gt;
&lt;br /&gt;
If we set the input lines as just described, the output line provides the&lt;br /&gt;
correct value of the difference.&lt;br /&gt;
&lt;br /&gt;
The same circuit can be used to compare numbers, too.&lt;br /&gt;
In fact if we subtract unsigned numbers, the result is meaningful only when&lt;br /&gt;
the minuend is larger than the subtrahend. In this case the Cout of the&lt;br /&gt;
MSB adder is one, otherwise it is zero.&lt;br /&gt;
So, if we set up the circuit to compute the difference X - Y and we consider&lt;br /&gt;
only the Cout of the MSB: Cout is 1 if X &amp;gt;= Y, Cout is 0 otherwise.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
X=10 Y=3&lt;br /&gt;
10 - 3 = 1010 - 0011 = 1010 + 1100 + 1 = (1)0111 Cout is 1: 10 &amp;gt;= 3&lt;br /&gt;
10 - 10 = 1010 - 1010 = 1010 + 0101 + 1 = (1)0000 Cout is 1: 10 &amp;gt;= 10&lt;br /&gt;
3 - 10 = 0011 - 1010 = 0011 + 0101 + 1 = (0)1001 Cout is 0: 3 &amp;lt; 10&lt;br /&gt;
(the result, 9 is wrong, as 3 - 10 cannot be represented as unsigned number!)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to compare signed numbers too, but the situation is a bit&lt;br /&gt;
more complex.  In this case X &amp;lt; Y if the result of a XOR between the signed&lt;br /&gt;
overflow and the value of the MSB of the result is one (the signed overflow&lt;br /&gt;
itself is the result of a XOR between the Cout and the Cin of the MSB).&lt;br /&gt;
&lt;br /&gt;
This definition gives the correct result even in case of overflow of the&lt;br /&gt;
subtraction.&lt;br /&gt;
&lt;br /&gt;
Maybe some examples can help to understand the rule:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
A=4 B=6 unsigned: 0100 - 0110 = 0100 + 1001 + 1 = (0)1110&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=4 B=6 signed 0100 - 0110 = 0100 + 1001 + 1 = (0)1110&lt;br /&gt;
                              100 +  001 + 1 = (0)110&lt;br /&gt;
overflow=0 MSB=1   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
&lt;br /&gt;
A=10 B=3 unsigned: 1010 - 0011 = 1010 + 1100 + 1 = (1)0111&lt;br /&gt;
Cout=1 so A &amp;gt;= B&lt;br /&gt;
A=-6 B=3 signed 1010 - 0110 = 1010 + 1100 + 1 = (1)0111&lt;br /&gt;
                               010 +  100 + 1 = (0)111&lt;br /&gt;
overflow=1 MSB=0   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
Note that 10 as a signed 4 bit number and -6 as signed number have&lt;br /&gt;
the same representation.&lt;br /&gt;
&lt;br /&gt;
A=12 B=14 unsigned: 1100 - 1110 = 1100 + 0001 + 1 = (0)1110&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=-4 B=-2 signed: 1100 - 1110 = 1100 + 0001 + 1 = (0)1110&lt;br /&gt;
                                 100 +  001 + 1 = (0)110&lt;br /&gt;
overflow=0 MSB=1   Cout XOR MSB=1 so A&amp;lt;B&lt;br /&gt;
&lt;br /&gt;
A=7 B=10 unsigned: 0110 - 1010 = 0110 + 0101 + 1 = (0)1100&lt;br /&gt;
Cout=0 so A &amp;lt; B&lt;br /&gt;
A=7 B=-6 signed: 0110 - 1010 = 0110 + 0101 + 1 = (0)1100&lt;br /&gt;
                                110 +  101 + 1 = (1)100&lt;br /&gt;
overflow=1 MSB=1   Cout XOR MSB=0 so A&amp;gt;=B&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_6:_Let_us_play_together&amp;diff=3541</id>
		<title>No more secrets Part 6: Let us play together</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_6:_Let_us_play_together&amp;diff=3541"/>
		<updated>2014-10-08T11:11:56Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The circuits presented in the previous sections can be implemented on a&lt;br /&gt;
single breadboard. In this section we will see how to connect several&lt;br /&gt;
breadboards together to build larger, more complex circuits.&lt;br /&gt;
&lt;br /&gt;
If you have two bradboard, or you meet a friend of yours who likes this&lt;br /&gt;
booklet and has another breadboard, it is possible to build a complete two&lt;br /&gt;
control bit demux.&lt;br /&gt;
&lt;br /&gt;
Build the two demux circuit illustrated in the previous section on&lt;br /&gt;
both breadboards and then connect them together as illustrated here below.&lt;br /&gt;
&lt;br /&gt;
[[File:demux2boards.jpg]]&lt;br /&gt;
&lt;br /&gt;
Only one of the demux(es) in boardA is actually used.&lt;br /&gt;
When both c0 and c1 have value 0 then in is copied to out00,&lt;br /&gt;
and so on as it is summarized in the following table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c1 c0&lt;br /&gt;
 0  0  in is copied to out00&lt;br /&gt;
 0  1  in is copied to out01&lt;br /&gt;
 1  0  in is copied to out10&lt;br /&gt;
 1  1  in is copied to out11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To build a three control bit demux (eight output lines) more breadboards&lt;br /&gt;
(or more friends) are needed. The following picture shows how four&lt;br /&gt;
breadboards all set up as two demux circuits (as seen in the previous&lt;br /&gt;
chapter) can be connected to form a three control bit demux.&lt;br /&gt;
&lt;br /&gt;
[[File:demux4boards.jpg]]&lt;br /&gt;
&lt;br /&gt;
Three breadboards can be used to build a three control bit decoder.&lt;br /&gt;
The first board must be configured as a twi bit decoder and both the others&lt;br /&gt;
as demux (2x1bit demux).&lt;br /&gt;
All you need is then to connect the boards as follows:&lt;br /&gt;
&lt;br /&gt;
[[File:decoder3boards.jpg]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
in0 in1 in2 Enabled output&lt;br /&gt;
 0   0   0  out00 muxA&lt;br /&gt;
 0   0   1  out01 muxA&lt;br /&gt;
 0   1   0  out10 muxA&lt;br /&gt;
 0   1   1  out11 muxA&lt;br /&gt;
 1   0   0  out00 muxB&lt;br /&gt;
 1   0   1  out01 muxB&lt;br /&gt;
 1   1   0  out10 muxB&lt;br /&gt;
 1   1   1  out11 muxB&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An eight input/three output lines priority encoder requires three&lt;br /&gt;
breadboards, two of them configured as four inputs/2 outputs priority&lt;br /&gt;
encoders while the third needs a custom circuit to combine the&lt;br /&gt;
partial results.&lt;br /&gt;
&lt;br /&gt;
[[File:prioencoder3boards.jpg]]&lt;br /&gt;
&lt;br /&gt;
The V output bit of the highest 4/2 prio encoder is the new most significant&lt;br /&gt;
bit of the output. This v bit drives two 1-bit mutexes. When V of the&lt;br /&gt;
highest priority encoder, its out1 and out0 output are copied to the global&lt;br /&gt;
out1 and out0 results. If V is false, the output value of the lowest&lt;br /&gt;
priority encored are copied instead.&lt;br /&gt;
The global V (valid) bit output is one when at least one V bit of the&lt;br /&gt;
2 bit encoders is one, in fact it is the result of an OR gate.&lt;br /&gt;
&lt;br /&gt;
If you have many boards (or many friends), it is possible to build a&lt;br /&gt;
sixteen data/four control bit multiplex using five breadboard, all&lt;br /&gt;
set up as four inputs/two control bits boards.&lt;br /&gt;
The following schematics shows how to connect the boards:&lt;br /&gt;
&lt;br /&gt;
[[File:mux5boards.jpg]]&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_5:_Mux_Demux&amp;diff=3523</id>
		<title>No more secrets Part 5: Mux Demux</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_5:_Mux_Demux&amp;diff=3523"/>
		<updated>2014-10-07T08:37:18Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: /* The Demux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The MUX (or Selector) ==&lt;br /&gt;
&lt;br /&gt;
The Multiplexer (also called Mux or Selector by closer friends) is a circuit which has n control inputs, 2^n data inputs and one output.&lt;br /&gt;
&lt;br /&gt;
The control input decides which data input is copied into the output all the other inputs are simply ignored.&lt;br /&gt;
&lt;br /&gt;
In my mind a Mux is similar to a track switch on a railroad. More specifically it reminds the switching system for the trains leaving a station. There are plenty of platforms in the station and the switches must be set up for the departing train to guarantee the routing to the railroad to the next station&lt;br /&gt;
&lt;br /&gt;
[[File:railswitch1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The truth table for a mux having two control inputs is the following&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c1  c0  in0 in1 in2 in3 out&lt;br /&gt;
0   0   0   x   x   x    0&lt;br /&gt;
0   0   1   x   x   x    1&lt;br /&gt;
0   1   x   0   x   x    0&lt;br /&gt;
0   1   x   1   x   x    1&lt;br /&gt;
1   0   x   x   0   x    0&lt;br /&gt;
1   0   x   x   1   x    1&lt;br /&gt;
1   1   x   x   x   0    0&lt;br /&gt;
1   1   x   x   x   1    1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(where x means for any value of this input, both 0 and 1)&lt;br /&gt;
&lt;br /&gt;
The circuit is the following:&lt;br /&gt;
&lt;br /&gt;
[[File:mux.png|400px]]&lt;br /&gt;
&lt;br /&gt;
And this is the file for the jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c0: AACF&lt;br /&gt;
c1: HHJ&lt;br /&gt;
in0: B&lt;br /&gt;
in1: C&lt;br /&gt;
in2: E&lt;br /&gt;
in3: F&lt;br /&gt;
A: BE&lt;br /&gt;
B: D&lt;br /&gt;
C: D&lt;br /&gt;
D: I&lt;br /&gt;
E: G&lt;br /&gt;
F: G&lt;br /&gt;
G: J&lt;br /&gt;
H: I&lt;br /&gt;
I: K&lt;br /&gt;
J: K&lt;br /&gt;
K: out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each configuration of in0 and in1 the corresponding input will be copied to the output.&lt;br /&gt;
To test this circuit, plug in a led to the output gate (K) and set both c0 and c1 to 0, now the led is turned on and off by setting on and off in0. In other words, in0 is copied on out.&lt;br /&gt;
Any input on in1, in2 or in3 does not change the value of out. Now if you set c0 to 1, in1 is copied to out. Now the values at in0 in1 and in3 are irrelevant, while the led turns on and off when the input at in1 changes. Similarly when c0 and c1 are 1 0, in2 is copied and when&lt;br /&gt;
c0 and c1 are 1, 1 is the turn of in3.&lt;br /&gt;
&lt;br /&gt;
== The Demux ==&lt;br /&gt;
&lt;br /&gt;
A demultiplexer is the opposite of a mux. It takes one data input and n control inputs and 2^n output lines.&lt;br /&gt;
The input is copied on the output line addressed by the control input.&lt;br /&gt;
&lt;br /&gt;
A demux is conceptually similar to a railroad switching system, this time the one that the trains&lt;br /&gt;
use entering a station. A train coming from a railroad is routed to a specific track to&lt;br /&gt;
reach a specific platform where people can get on and off.&lt;br /&gt;
&lt;br /&gt;
[[File:railswitch2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Unfortunately it needs 14 nand gates to create a two control inputs demux circuits, two more than those available on out breadboard.&lt;br /&gt;
However, It is possible to build two 1 control bit demuxes.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
[[File:demux.png|400px]]&lt;br /&gt;
&lt;br /&gt;
This is the table to set up the jumpers on the breadboard:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c0: AAD&lt;br /&gt;
in0: BD&lt;br /&gt;
c1: FFI&lt;br /&gt;
in1: GI&lt;br /&gt;
A: B&lt;br /&gt;
B: CC&lt;br /&gt;
C: out00&lt;br /&gt;
D: EE&lt;br /&gt;
E: out01&lt;br /&gt;
F: G&lt;br /&gt;
G: HH&lt;br /&gt;
H: out10&lt;br /&gt;
I: JJ&lt;br /&gt;
J: out11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit plug in 4 leds to the output lines and connect four buttons to its inputs.&lt;br /&gt;
If you push and release the button connected to in0, out00 will turn on and off in the same manner. Now push and keep pressed the button connected to c0. The value of in0 will be copied on out01, I mean now the led on out01 instead of out00.&lt;br /&gt;
The same experiment can be done using in1 and c1 as inputs and out10, out11 as outputs.&lt;br /&gt;
&lt;br /&gt;
If you have two breadboards (or a friend has one) and you have both build this circuit it is possible to plug the two boards together and get a 2 control bits (four data outputs) demultiplexer (plus a spare 1bit demux).&lt;br /&gt;
Connect out00 and out01 of the first board to in0 and in1 of the second and&lt;br /&gt;
connect c0 and c1 together.&lt;br /&gt;
The input of in0 of the first board will be routed on out00, out01, out10 and out11 depending on&lt;br /&gt;
the value given to in0 of the first board and in0-in1 of the second.&lt;br /&gt;
&lt;br /&gt;
The next chapter will describe in details how the circuits implemented on several breadboard can be connected to obtain more complex circuits.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_5:_Mux_Demux&amp;diff=3487</id>
		<title>No more secrets Part 5: Mux Demux</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_5:_Mux_Demux&amp;diff=3487"/>
		<updated>2014-10-06T08:48:00Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The MUX (or Selector) ==&lt;br /&gt;
&lt;br /&gt;
The Multiplexer (also called Mux or Selector by closer friends) is a circuit which has n control inputs, 2^n data inputs and one output.&lt;br /&gt;
&lt;br /&gt;
The control input decides which data input is copied into the output all the other inputs are simply ignored.&lt;br /&gt;
&lt;br /&gt;
In my mind a Mux is similar to a track switch on a railroad. More specifically it reminds the switching system for the trains leaving a station. There are plenty of platforms in the station and the switches must be set up for the departing train to guarantee the routing to the railroad to the next station&lt;br /&gt;
&lt;br /&gt;
[[File:railswitch1.jpg]]&lt;br /&gt;
&lt;br /&gt;
The truth table for a mux having two control inputs is the following&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c1  c0  in0 in1 in2 in3 out&lt;br /&gt;
0   0   0   x   x   x    0&lt;br /&gt;
0   0   1   x   x   x    1&lt;br /&gt;
0   1   x   0   x   x    0&lt;br /&gt;
0   1   x   1   x   x    1&lt;br /&gt;
1   0   x   x   0   x    0&lt;br /&gt;
1   0   x   x   1   x    1&lt;br /&gt;
1   1   x   x   x   0    0&lt;br /&gt;
1   1   x   x   x   1    1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
(where x means for any value of this input, both 0 and 1)&lt;br /&gt;
&lt;br /&gt;
The circuit is the following:&lt;br /&gt;
&lt;br /&gt;
[[File:mux.png|400px]]&lt;br /&gt;
&lt;br /&gt;
And this is the file for the jumpers:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c0: AACF&lt;br /&gt;
c1: HHJ&lt;br /&gt;
in0: B&lt;br /&gt;
in1: C&lt;br /&gt;
in2: E&lt;br /&gt;
in3: F&lt;br /&gt;
A: BE&lt;br /&gt;
B: D&lt;br /&gt;
C: D&lt;br /&gt;
D: I&lt;br /&gt;
E: G&lt;br /&gt;
F: G&lt;br /&gt;
G: J&lt;br /&gt;
H: I&lt;br /&gt;
I: K&lt;br /&gt;
J: K&lt;br /&gt;
K: out&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For each configuration of in0 and in1 the corresponding input will be copied to the output.&lt;br /&gt;
To test this circuit, plug in a led to the output gate (K) and set both c0 and c1 to 0, now the led is turned on and off by setting on and off in0. In other words, in0 is copied on out.&lt;br /&gt;
Any input on in1, in2 or in3 does not change the value of out. Now if you set c0 to 1, in1 is copied to out. Now the values at in0 in1 and in3 are irrelevant, while the led turns on and off when the input at in1 changes. Similarly when c0 and c1 are 1 0, in2 is copied and when&lt;br /&gt;
c0 and c1 are 1, 1 is the turn of in3.&lt;br /&gt;
&lt;br /&gt;
== The Demux ==&lt;br /&gt;
&lt;br /&gt;
A demultiplexer is the opposite of a mux. It takes one data input and n control inputs and 2^n output lines.&lt;br /&gt;
The input is copied on the output line addressed by the control input.&lt;br /&gt;
&lt;br /&gt;
A demux is conceptually similar to a railroad switching system, this time the one that the trains&lt;br /&gt;
use entering a station. A train coming from a railroad is routed to a specific track to&lt;br /&gt;
reach a specific platform where people can get on and off.&lt;br /&gt;
&lt;br /&gt;
[[File:railswitch2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Unfortunately it needs 14 nand gates to create a two control inputs demux circuits, two more than those available on out breadboard.&lt;br /&gt;
However, It is possible to build two 1 control bit demuxes.&lt;br /&gt;
&lt;br /&gt;
This is the circuit:&lt;br /&gt;
[[File:demux.png|400px]]&lt;br /&gt;
&lt;br /&gt;
This is the table to set up the jumpers on the breadboard:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
c0: AAD&lt;br /&gt;
in0: BD&lt;br /&gt;
c1: FFI&lt;br /&gt;
in1: GH&lt;br /&gt;
A: B&lt;br /&gt;
B: CC&lt;br /&gt;
C: out00&lt;br /&gt;
D: EE&lt;br /&gt;
E: out01&lt;br /&gt;
F: G&lt;br /&gt;
G: HH&lt;br /&gt;
H: out10&lt;br /&gt;
I: JJ&lt;br /&gt;
J: out11&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit plug in 4 leds to the output lines and connect four buttons to its inputs.&lt;br /&gt;
If you push and release the button connected to in0, out00 will turn on and off in the same manner. Now push and keep pressed the button connected to c0. The value of in0 will be copied on out01, I mean now the led on out01 instead of out00.&lt;br /&gt;
The same experiment can be done using in1 and c1 as inputs and out10, out11 as outputs.&lt;br /&gt;
&lt;br /&gt;
If you have two breadboards (or a friend has one) and you have both build this circuit it is possible to plug the two boards together and get a 2 control bits (four data outputs) demultiplexer (plus a spare 1bit demux).&lt;br /&gt;
Connect out00 and out01 of the first board to in0 and in1 of the second and&lt;br /&gt;
connect c0 and c1 together.&lt;br /&gt;
The input of in0 of the first board will be routed on out00, out01, out10 and out11 depending on&lt;br /&gt;
the value given to in0 of the first board and in0-in1 of the second.&lt;br /&gt;
&lt;br /&gt;
The next chapter will describe in details how the circuits implemented on several breadboard can be connected to obtain more complex circuits.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_4:_Encode_and_Decode...&amp;diff=3456</id>
		<title>No more secrets Part 4: Encode and Decode...</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_4:_Encode_and_Decode...&amp;diff=3456"/>
		<updated>2014-10-01T15:43:06Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Actually it is the reverse way round, let us decode first and encode then.&lt;br /&gt;
&lt;br /&gt;
== A decoder ==&lt;br /&gt;
&lt;br /&gt;
A decoder is a circuit having n input lines and 2^n (2 elevated to the n-th&lt;br /&gt;
power) output lines.&lt;br /&gt;
&lt;br /&gt;
Each output is true for a specific configuration of the input.&lt;br /&gt;
&lt;br /&gt;
We will implement a 2/4 decoder, i.e. a decoder having 2 inputs and&lt;br /&gt;
four outputs.&lt;br /&gt;
&lt;br /&gt;
This is its truth table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IN1 IN0 OUT0 OUT1 OUT2 OUT3&lt;br /&gt;
0   0   1    0    0    0&lt;br /&gt;
0   1   0    1    0    0&lt;br /&gt;
1   0   0    0    1    0&lt;br /&gt;
1   1   0    0    0    1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The circuit to implement the decoder is the following:&lt;br /&gt;
&lt;br /&gt;
[[File:decoder.png|600px]]&lt;br /&gt;
&lt;br /&gt;
And this is the table you can use to set up the jumpers on your&lt;br /&gt;
breadboard:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IN0-&amp;gt;BBEI&lt;br /&gt;
IN1-&amp;gt;AAGI&lt;br /&gt;
A-&amp;gt;CE&lt;br /&gt;
B-&amp;gt;CG&lt;br /&gt;
C-&amp;gt;DD&lt;br /&gt;
D-&amp;gt;out0&lt;br /&gt;
E-&amp;gt;FF&lt;br /&gt;
F-&amp;gt;out1&lt;br /&gt;
G-&amp;gt;HH&lt;br /&gt;
H-&amp;gt;out2&lt;br /&gt;
I-&amp;gt;JJ&lt;br /&gt;
J-&amp;gt;out3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To test this circuit, connect a led on each output line.&lt;br /&gt;
Initially the led on out0 is on, the others off.&lt;br /&gt;
In fact out0 is 1 when the input configration is 0,0.&lt;br /&gt;
Now connect in0, in1 or both to the positive line. These configuration&lt;br /&gt;
should turn on the leds at out1, out2 and out3, respectively, one at&lt;br /&gt;
at a time.&lt;br /&gt;
&lt;br /&gt;
== A priority Encoder ==&lt;br /&gt;
&lt;br /&gt;
An encoder is the reverse circuit of a decoder: it has 2^n input lines and&lt;br /&gt;
n output lines.&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;normal&amp;quot; encoder should permit only input configurations in which exactly&lt;br /&gt;
one input line is one, the others being zero.&lt;br /&gt;
A 4/2 encoder has the following truth table:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IN3 IN2 IN1 IN0 OUT1 OUT0&lt;br /&gt;
0   0   0   1    0    0&lt;br /&gt;
0   0   1   0    0    1&lt;br /&gt;
0   1   0   0    1    0&lt;br /&gt;
1   0   0   0    1    1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Any other input configuration should not be permitted.&lt;br /&gt;
&lt;br /&gt;
A priority encoder is an extension of an encoder.&lt;br /&gt;
It has 2^n input, n+1 output lines: n of them are the input encoding and&lt;br /&gt;
one is the valid configuration bit (V) which is one if at least 1 bit in input&lt;br /&gt;
is one.&lt;br /&gt;
Each bit represents a priority, when the input configuration is valid (V is 1)&lt;br /&gt;
the output is the highest priority bit which is 1 encoded in binary.&lt;br /&gt;
&lt;br /&gt;
A truth table can help to understand this concept.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IN3 IN2 IN1 IN0 OUT1 OUT0 V&lt;br /&gt;
0   0   0   0    0    0   0&lt;br /&gt;
0   0   0   1    0    0   1&lt;br /&gt;
0   0   1   0    0    1   1&lt;br /&gt;
0   0   1   1    0    1   1&lt;br /&gt;
0   1   0   0    1    0   1&lt;br /&gt;
0   1   0   1    1    0   1&lt;br /&gt;
0   1   1   0    1    0   1&lt;br /&gt;
0   1   1   1    1    0   1&lt;br /&gt;
1   0   0   0    1    1   1&lt;br /&gt;
1   0   0   1    1    1   1&lt;br /&gt;
1   0   1   0    1    1   1&lt;br /&gt;
1   0   1   1    1    1   1&lt;br /&gt;
1   1   0   0    1    1   1&lt;br /&gt;
1   1   0   1    1    1   1&lt;br /&gt;
1   1   1   0    1    1   1&lt;br /&gt;
1   1   1   1    1    1   1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the IN2 is 1 and none of the input having higher priority than IN2&lt;br /&gt;
(i.e. IN3) is 1, the output is 1 0 (2 coded in binary).&lt;br /&gt;
If IN0, IN1 or IN3has the highest priority &amp;quot;1&amp;quot; in the configuration the output&lt;br /&gt;
is 0 0, 0 1 or 1 1 (the encoding of 0,1 or 3)  respectively.&lt;br /&gt;
&lt;br /&gt;
This is the circuit and the mapping for the jumpers&lt;br /&gt;
&lt;br /&gt;
[[File:priencoder.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
IN3-&amp;gt;AA&lt;br /&gt;
IN2-&amp;gt;BB&lt;br /&gt;
IN1-&amp;gt;FFD&lt;br /&gt;
IN0-&amp;gt;GG&lt;br /&gt;
A-&amp;gt;CE&lt;br /&gt;
B-&amp;gt;CD&lt;br /&gt;
C-&amp;gt;II out1&lt;br /&gt;
D-&amp;gt;E&lt;br /&gt;
E-&amp;gt;out0&lt;br /&gt;
F-&amp;gt;H&lt;br /&gt;
G-&amp;gt;H&lt;br /&gt;
H-&amp;gt;JJ&lt;br /&gt;
I-&amp;gt;K&lt;br /&gt;
J-&amp;gt;K&lt;br /&gt;
K-&amp;gt;outV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the circuit works properly, in its starting state, i.e. when all inputs are 0, all&lt;br /&gt;
outputs should be 0.&lt;br /&gt;
As usual connect led diodes on the output lines.&lt;br /&gt;
The output bit V should be 1 when any of the input is one (it works&lt;br /&gt;
as a 4 inputs OR gate).&lt;br /&gt;
Try then some configurations from the table above and you'll see the&lt;br /&gt;
right encoding appears on the output leds.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_2:_Let_us_build_the_experimental_board&amp;diff=2891</id>
		<title>No more secrets Part 2: Let us build the experimental board</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_Part_2:_Let_us_build_the_experimental_board&amp;diff=2891"/>
		<updated>2014-05-26T20:53:26Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Ingredients ==&lt;br /&gt;
&lt;br /&gt;
* #1 Standard Breadboard (63 rows, 5+5 holes for row, power and ground rails&lt;br /&gt;
on both sides)&lt;br /&gt;
* #25 BC547 transistors&lt;br /&gt;
* #24 10Kohm 1/4W resistors (colors: brown=1 black=0 orange=10^3 gold=5%)&lt;br /&gt;
* #14 330ohm 1/4W resistors (colors: orange=3 orange=3 brown=10^1 gold=5%)&lt;br /&gt;
* #4 led diodes (Red, 5mm are okay)&lt;br /&gt;
* #2 electrolyctic capacitors 10uF (microfarad) 16V&lt;br /&gt;
* #1 5V power supply (the tool uses at most 250mA) (instead of a power supply you may consider using a battery holder for three or four AA batteries, everything should work at 4.5 or 6V).&lt;br /&gt;
* #1 set of jumpers for breadboards.&lt;br /&gt;
* #23 0.3&amp;quot; jumpers&lt;br /&gt;
&lt;br /&gt;
A piece of old multi pair telephone wire can be used to create the&lt;br /&gt;
jumpers, both the 0.3&amp;quot; wide and the longer ones to build the experiments.&lt;br /&gt;
&lt;br /&gt;
Tools needed: cable cutter or a pair of strong scissors. If you have a wire&lt;br /&gt;
stripper it is useful, although not strictly needed.&lt;br /&gt;
&lt;br /&gt;
[[File:Board.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
If you like, it is clearer during the experiments to provide the inputs&lt;br /&gt;
using buttons instead of moving jumpers. In order to build a keypad for the&lt;br /&gt;
input you need:&lt;br /&gt;
* #1 another breadboard (maybe smaller than the one above, I'm using a 30&lt;br /&gt;
rows one)&lt;br /&gt;
* #5 or more buttons for breadboards&lt;br /&gt;
* #5 jumpers (which can be created using the old telephone cable).&lt;br /&gt;
&lt;br /&gt;
[[File:Keypad.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
The board(s) implements:&lt;br /&gt;
* #1 1Hz master clock&lt;br /&gt;
* #11 NAND gates&lt;br /&gt;
* ... and #5 buttons on the second board&lt;br /&gt;
&lt;br /&gt;
=== How to build the master clock ===&lt;br /&gt;
&lt;br /&gt;
Schematics of the unit (already discussed in &lt;br /&gt;
[[No_more_secrets_in_your_CPU:_Part_1]]|Part1):&lt;br /&gt;
&lt;br /&gt;
[[File:Clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
For this unit you will need:&lt;br /&gt;
* #3 transistors&lt;br /&gt;
* #3 330ohm resistors (orange-orange-brown)&lt;br /&gt;
* #2 10Kohm resistors (brown-black-orange)&lt;br /&gt;
* #2 10uF capacitors&lt;br /&gt;
* #4 0.3&amp;quot; jumpers&lt;br /&gt;
&lt;br /&gt;
[[File:clock1hz.jpg|600px]]&lt;br /&gt;
&lt;br /&gt;
Fold the pins of the resistors and trim their length 10 about 1cm as&lt;br /&gt;
illustrated below:&lt;br /&gt;
&lt;br /&gt;
[[File:resistorx.png|100px]][[File: resistorsnapshot.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
Resistors are not polarized (provided that the pins are connected&lt;br /&gt;
in the right positions of the breadboard, you don't need to pay&lt;br /&gt;
attention on which end is which).&lt;br /&gt;
&lt;br /&gt;
BC547 transistors are not cylindrical, they are flat on one side&lt;br /&gt;
(usually there is the sign BC547 on that flat side).&lt;br /&gt;
In order to recognize the three pins of a transitor (collector, base and&lt;br /&gt;
emitter) you have to keep the transistor having the flat face towards you:&lt;br /&gt;
in this position the three pins are C,B,E collector, base and emitter.&lt;br /&gt;
(This is specific for BC547, other transistors may have different pin&lt;br /&gt;
assignment).&lt;br /&gt;
&lt;br /&gt;
[[File: bc547pins.png|100px]] [[File: bc547snapshot.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
Electrolytic Capacitors are polarized. The negative lead is normally marked&lt;br /&gt;
by a  white stripe having multiple minus signs on it (&amp;quot;- - - &amp;quot;).&lt;br /&gt;
&lt;br /&gt;
This figure shows how to insert the components on the breadboard.&lt;br /&gt;
&lt;br /&gt;
[[File: electrolytic.png|100px]] [[File: electrolyticsnapshot.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
Install all the components and jumpers on the Breadboard as shown in this picture:&lt;br /&gt;
&lt;br /&gt;
[[File: clockbreadboard.png|400px]]&lt;br /&gt;
&lt;br /&gt;
When all the components and the jumpers have been put on the breadboard,&lt;br /&gt;
the circuit can be tested.&lt;br /&gt;
Plug the power supply to the + and - rails on both sides (you can add&lt;br /&gt;
jumpers to connect + and - of one side to the correspondent rails on the&lt;br /&gt;
other). The blue rail should be connected to the negative, the red one to&lt;br /&gt;
the positive.&lt;br /&gt;
&lt;br /&gt;
[[File: jumpersbb.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Now plug a led diode to the master clock's output: push the longest&lt;br /&gt;
pin of the diode (its anode) in a hole of the output row and its shortest&lt;br /&gt;
pin (the cathode) to a hole of the minus rail.&lt;br /&gt;
Does it blink? I hope so. If it does your master clock is working, if it&lt;br /&gt;
not blinking double check the position of all the components and jumpers.&lt;br /&gt;
&lt;br /&gt;
[[File: ledx.png|100px]] [[File: ledsnapshot.jpg|200px]]&lt;br /&gt;
&lt;br /&gt;
=== How to build the 11 NAND gates ===&lt;br /&gt;
&lt;br /&gt;
Schematics of the unit (already discussed in &lt;br /&gt;
[[No_more_secrets_in_your_CPU:_Part_1]]|Part1):&lt;br /&gt;
&lt;br /&gt;
[[File: nandschem.png|400px]]&lt;br /&gt;
&lt;br /&gt;
[[File: nandsnapshot.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
For each gate you'll use:&lt;br /&gt;
* #2 transistors&lt;br /&gt;
* #2 10Kohm resistors&lt;br /&gt;
* #1 330ohm resistor&lt;br /&gt;
* #2 0.3&amp;quot; jumpers&lt;br /&gt;
 &lt;br /&gt;
Insert the components as depicted (row numbers refer to the first&lt;br /&gt;
NAND gate). Trim the pins of resistors before mounting them and&lt;br /&gt;
pay attention to install trasistors in the correct direction. &lt;br /&gt;
&lt;br /&gt;
[[File: nandbb.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The same pattern should be repeated for all the other NAND gates.&lt;br /&gt;
The first row of each gate is 8,13,18,23,28,33,38,43,48,53,58.&lt;br /&gt;
For some gates the hole of the positive rail for the 330 ohm resistor&lt;br /&gt;
or the hole of the negative row for the jumper are not aligned.&lt;br /&gt;
Choose the closest available hole of the rail.&lt;br /&gt;
&lt;br /&gt;
The following table maps each gate to the row numbers of its inputs and&lt;br /&gt;
output.&lt;br /&gt;
&lt;br /&gt;
  Gate In1 In2 Out&lt;br /&gt;
  CLK  --  --   7&lt;br /&gt;
  A     9  11   8&lt;br /&gt;
  B    14  16  13&lt;br /&gt;
  C    19  21  18&lt;br /&gt;
  D    24  26  23&lt;br /&gt;
  E    29  31  28&lt;br /&gt;
  F    34  36  33&lt;br /&gt;
  G    39  41  38&lt;br /&gt;
  H    44  46  43&lt;br /&gt;
  I    49  51  48&lt;br /&gt;
  J    54  56  53&lt;br /&gt;
  K    59  61  58&lt;br /&gt;
&lt;br /&gt;
The circuit is complete. For the experiments we'll name the NAND gates&lt;br /&gt;
using the letters of the alphabeth, A to K.&lt;br /&gt;
The experiments will be carried out by adding jumpers to interconnect&lt;br /&gt;
the gates and the master clock in a specific topology.&lt;br /&gt;
All the inputs and outputs of the gates are connected to rows of the&lt;br /&gt;
right-hand side of the breadborad, so it is possible to set up the&lt;br /&gt;
experimental circuits by connecting the right rows on this side.&lt;br /&gt;
&lt;br /&gt;
No other transistors, resistors, capacitors need to be further installed or&lt;br /&gt;
existing components moved in order to build one by one the components&lt;br /&gt;
of a CPU.&lt;br /&gt;
&lt;br /&gt;
It is time to test the gates. Please test all of them because an error,&lt;br /&gt;
a misfunctioning component or a false contact may prevent complex circuits&lt;br /&gt;
from working properly.&lt;br /&gt;
&lt;br /&gt;
For each gate: plug a led diode between the gate's output (the longest pin,&lt;br /&gt;
i.e. its anode) and a hole of a negative rail (here plug the shortest pin&lt;br /&gt;
of the led, its cathode).&lt;br /&gt;
The led should be on. Now use two jumpers to connect both inputs of the&lt;br /&gt;
gate to the positive rail. The led should turn off when both jumpers are&lt;br /&gt;
connected.&lt;br /&gt;
Now you can move the led and the jumpers to test the next gate.&lt;br /&gt;
Should all of them work properly? If yes, be brave of you.&lt;br /&gt;
You can move to the next stage and start experimenting on how these 11 NAND&lt;br /&gt;
gates can work as signal routers, do computations, memorize, count and much more.&lt;br /&gt;
&lt;br /&gt;
=== How to build the keypad (optional) ===&lt;br /&gt;
&lt;br /&gt;
It is convenient to have a keypad to provide input to the circuits.&lt;br /&gt;
Here is mine:&lt;br /&gt;
&lt;br /&gt;
[[File:Keypad.jpg|300px]]&lt;br /&gt;
&lt;br /&gt;
If you want to build one, take the second breadboard and connect one end of&lt;br /&gt;
each the button to the positive rail.&lt;br /&gt;
&lt;br /&gt;
Then connect the positive rail of the keypad to the positive rail of the&lt;br /&gt;
main experimental breadboard.&lt;br /&gt;
&lt;br /&gt;
The pin of each button which has not been connected to the positive rail&lt;br /&gt;
can be used to provide an input bit to a circuit.&lt;br /&gt;
&lt;br /&gt;
For example you can take the pin of two buttons and connect them to a NAND&lt;br /&gt;
gate. When you push both buttons, a led installed on the NAND gate's output turns off.&lt;br /&gt;
&lt;br /&gt;
=== A short note for real Electronic Engineers ===&lt;br /&gt;
&lt;br /&gt;
I am a computer scientist, not an electronic engineer and this is an&lt;br /&gt;
educational tool.&lt;br /&gt;
I know that the design of real TTL and CMOS gates is quite different,&lt;br /&gt;
from an electronic, not logical, point of view.&lt;br /&gt;
The goal of this tool is to create a simple educational playground based on&lt;br /&gt;
cheap and off-the-shelf components.&lt;br /&gt;
BC547 are very common (at least in Europe (*)), while multiemitter transistors for&lt;br /&gt;
TTL or typeN and typeP MOSFET for CMOS are less common.&lt;br /&gt;
&lt;br /&gt;
Each gate of the experimental board always drains about 13mA to work. The&lt;br /&gt;
current raises to 15mA when the output is zero.  I am perfectly aware that&lt;br /&gt;
these are huge values for the current to drive each gate but in this way it&lt;br /&gt;
is possible to use a led diode as a logic probe.&lt;br /&gt;
&lt;br /&gt;
(*) Many NPN transistors can be used instead of BC547. I have not tested it personally,&lt;br /&gt;
but I am confident that 2N2222 should work. 2N2222 is a very common NPN transistor in the US.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Lednotv2.png&amp;diff=2849</id>
		<title>File:Lednotv2.png</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Lednotv2.png&amp;diff=2849"/>
		<updated>2014-05-19T09:28:26Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: GiuliaN ha caricato una nuova versione di &amp;amp;quot;File:Lednotv2.png&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2848</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2848"/>
		<updated>2014-05-19T09:25:09Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:TransistorFingerv2.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:Ledv2.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:Lednotv2.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other always at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is much slower than the clocks of our personal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Lednotv2.png&amp;diff=2847</id>
		<title>File:Lednotv2.png</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Lednotv2.png&amp;diff=2847"/>
		<updated>2014-05-19T09:24:40Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2846</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2846"/>
		<updated>2014-05-19T09:22:34Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:TransistorFingerv2.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:Ledv2.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:lednot.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other always at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is much slower than the clocks of our personal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:Ledv2.png&amp;diff=2845</id>
		<title>File:Ledv2.png</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:Ledv2.png&amp;diff=2845"/>
		<updated>2014-05-19T09:21:54Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2844</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2844"/>
		<updated>2014-05-19T09:19:48Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:TransistorFingerv2.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:led.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:lednot.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other always at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is much slower than the clocks of our personal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=File:TransistorFingerv2.png&amp;diff=2843</id>
		<title>File:TransistorFingerv2.png</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=File:TransistorFingerv2.png&amp;diff=2843"/>
		<updated>2014-05-19T09:18:36Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2838</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2838"/>
		<updated>2014-05-16T13:39:13Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:transistorfinger.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:led.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:lednot.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other always at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is much slower than the clocks of our personal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2837</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2837"/>
		<updated>2014-05-16T13:25:21Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:transistorfinger.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:led.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:lednot.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other always at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is muc slower than the clocks of out perconal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
	<entry>
		<id>https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2836</id>
		<title>No more secrets in your CPU: Part 1</title>
		<link rel="alternate" type="text/html" href="https://www.raspibo.org/wiki/index.php?title=No_more_secrets_in_your_CPU:_Part_1&amp;diff=2836"/>
		<updated>2014-05-16T11:49:24Z</updated>

		<summary type="html">&lt;p&gt;GiuliaN: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the first of a set of postings.&lt;br /&gt;
I am writing here, on my BLiki, the draft of a booklet about Computer Architecture&lt;br /&gt;
in the spirit of &amp;quot;Making&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
This booklet describes an educational tool created to reveal the secrets of&lt;br /&gt;
the basic elements of digital computers.&lt;br /&gt;
&lt;br /&gt;
This is a picture of the &amp;quot;tool&amp;quot;, just to whet your appetite.&lt;br /&gt;
&lt;br /&gt;
[[File: nms1.jpg|400px]]&lt;br /&gt;
&lt;br /&gt;
Nothing magic happens in the processor of your computers, it is just a&lt;br /&gt;
matter of circuits an commutation of electric currents.&lt;br /&gt;
Everything works using an elementary switching device: the transistor.&lt;br /&gt;
&lt;br /&gt;
A transistor is an electronic component which is able to drive a high&lt;br /&gt;
current on the basis of a low control current. It is basically an&lt;br /&gt;
amplifier. The control pin is the base (B), the reference gate is the&lt;br /&gt;
emitter(E), the output gate is the collector(C).&lt;br /&gt;
&lt;br /&gt;
[[File:transistor.png]]&lt;br /&gt;
&lt;br /&gt;
The low control current flowing between the base and the emitter, enables&lt;br /&gt;
a high current between the collector and the emitter.&lt;br /&gt;
For NPN transistors, the ones we use, these currents are positive (the&lt;br /&gt;
potential, or voltage of the Base and Collector is higher than the&lt;br /&gt;
potential of the Emitter).&lt;br /&gt;
The symbol of a NPN transistor has the arrow of the emitter pointing&lt;br /&gt;
outwards. There are other transistors named PNP, having the inwards arrow&lt;br /&gt;
in their symbol. PNP transistors use negative currents instead of positive&lt;br /&gt;
currents.&lt;br /&gt;
&lt;br /&gt;
For our purposes we will use our transistors as binary switches. In fact a&lt;br /&gt;
current of 0.5mA (almost) saturate a transistor of the type used in our&lt;br /&gt;
experiemental tool (BC547).&lt;br /&gt;
A transistor behaves like a remotely controlled finger pushing a button.&lt;br /&gt;
When a current flows through the transistor's base the finger pushes the&lt;br /&gt;
button, otherwise it keeps it released.&lt;br /&gt;
&lt;br /&gt;
[[File:transistorfinger.png]]&lt;br /&gt;
&lt;br /&gt;
Let us consider this circuit:&lt;br /&gt;
&lt;br /&gt;
[[File:led.png]]&lt;br /&gt;
&lt;br /&gt;
The current flows through the resistor and the led diode which turns on.&lt;br /&gt;
The resistor in this circuit limits the current so that the diode cannot be&lt;br /&gt;
damaged.&lt;br /&gt;
&lt;br /&gt;
Let us add a button to the previous circuit in this way:&lt;br /&gt;
&lt;br /&gt;
[[File:lednot.png]]&lt;br /&gt;
&lt;br /&gt;
If you push the button, the current flows through the button where the&lt;br /&gt;
resistence is null instead of passing through the diode. As a consequence,&lt;br /&gt;
the led turns off.&lt;br /&gt;
If we use two buttons connected as depicted here below (in series), the led&lt;br /&gt;
diode turns off when both buttons get pushed.&lt;br /&gt;
&lt;br /&gt;
[[File:nednand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
We have said that a transistor may work as a remotely controlled finger&lt;br /&gt;
which pushes a button, so we can redesign the circuits about using&lt;br /&gt;
transistors in lieu of buttons.&lt;br /&gt;
&lt;br /&gt;
As we will see almost all the components of a CPU (a processor) can be&lt;br /&gt;
built using a large number of these circuits. More precisely the circuit&lt;br /&gt;
using two transistors is a basic brick that can can be used to build all the&lt;br /&gt;
others.&lt;br /&gt;
&lt;br /&gt;
[[File:tnotnand.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The circuit on the left, having one input and one transistor, is a NOT&lt;br /&gt;
gate. It negates its input: when its input is connected to the positive pin&lt;br /&gt;
of the power supply (+ 5V) the output is 0V. If there is a led connected it&lt;br /&gt;
is off. Viceversa if the input is connected to the negative pin (0V), or&lt;br /&gt;
left not connected, the output is 5V, the led is on. We will call 0V as&lt;br /&gt;
the logical state 0 and the logical state 1 is +5V.&lt;br /&gt;
&lt;br /&gt;
The logical table of a NOT gate is:&lt;br /&gt;
  IN OUT&lt;br /&gt;
  0  1&lt;br /&gt;
  1  0&lt;br /&gt;
&lt;br /&gt;
The second circuit is a Not AND, usually abbreviated as NAND.&lt;br /&gt;
Its logical table is:&lt;br /&gt;
  IN1 IN2 OUT&lt;br /&gt;
  0   0   1&lt;br /&gt;
  0   1   1&lt;br /&gt;
  1   0   1&lt;br /&gt;
  1   1   0&lt;br /&gt;
&lt;br /&gt;
In fact, in plain English the semantics of the conjunction &amp;quot;and&amp;quot; is that a&lt;br /&gt;
sentence consisting of two statements connected by an &amp;quot;and&amp;quot; is true if&lt;br /&gt;
both statements are true, it is false otherwise.&lt;br /&gt;
Our logic gate returns exactly the opposite result of an &amp;quot;and&amp;quot;, if returns&lt;br /&gt;
1 when an &amp;quot;and&amp;quot; returns 0 and viceversa. It is a Not AND, the negation of&lt;br /&gt;
an AND.&lt;br /&gt;
Almost all (say all but one) circuits of a modern computer can be built&lt;br /&gt;
using NANDS.&lt;br /&gt;
&lt;br /&gt;
For example, if the two inputs of a NAND gate are connected together the&lt;br /&gt;
circuit has the effect of a NOT. In this case, in fact, either both inputs&lt;br /&gt;
have value 1 or both value 0. Our &amp;quot;remotely controlled fingers&amp;quot; are tied&lt;br /&gt;
together so either both buttons are pushed or none. So, it is not necessary&lt;br /&gt;
to have a specific circuit for a NOT.&lt;br /&gt;
&lt;br /&gt;
However, one relevant circuit cannot be built using NANDs: the master&lt;br /&gt;
clock.&lt;br /&gt;
A computer includes a lot of components able to perfom computations,&lt;br /&gt;
activate/deactivate functions. route data, store data etc. but all these&lt;br /&gt;
elements need a director.&lt;br /&gt;
Like an orchestra, a processor requires a component which provides all the&lt;br /&gt;
instruments/elements with a rhythm, a pace so that the result can be&lt;br /&gt;
either a synphony or a computation and not a chaos.&lt;br /&gt;
Every element has to perform its task in a synchronized manner.&lt;br /&gt;
Our director, however, has not a complex score to follow, it simply&lt;br /&gt;
generates a square wave, a coninuous sequence of 0 and 1 one following the&lt;br /&gt;
other qlways at the same pace or frequency.&lt;br /&gt;
When the advertisement of a computer says that it runs at one two or three&lt;br /&gt;
GHz (giga herts) it means that its director's stick goes up and down one,&lt;br /&gt;
two or three billion times per second.&lt;br /&gt;
&lt;br /&gt;
This is the circuit of our master clock:&lt;br /&gt;
&lt;br /&gt;
[[File:clock.png|600px]]&lt;br /&gt;
&lt;br /&gt;
The circuit has been drawn to show the similitudes with our previous&lt;br /&gt;
circuits. If we forget for a moment the two capacitors, the circuit&lt;br /&gt;
configuration of the first transistor on the left (T1) is a NOT circuit.&lt;br /&gt;
It has its input forced to the value 1, then its output without the&lt;br /&gt;
capacitors would be 0.&lt;br /&gt;
Still watching the circuit without the capacitors, the other part&lt;br /&gt;
of the circuit would behave in a similar manner.&lt;br /&gt;
The base of the transistor in the middle (T2) is connected to 1 so a current&lt;br /&gt;
can flow through its emitter and then throw the base-emitter junction&lt;br /&gt;
of the transistor of the right (T3). As a consequence, both transistors&lt;br /&gt;
&amp;quot;close&amp;quot; their circuits, thus the output and the collector of the transistor&lt;br /&gt;
in the middle are at logical level zero.&lt;br /&gt;
&lt;br /&gt;
The capacitors work as small batteries. When the output at the collector of T1&lt;br /&gt;
transistor is 0v, the capacitor at the base of T2 is charging.&lt;br /&gt;
Thic capacitor requires a lot of current to start charging and then&lt;br /&gt;
the current decreases as its tends to complete its charge. As a consequence&lt;br /&gt;
at the beginning of the charge process the potential at the base of&lt;br /&gt;
the transistor is close to zero and then it slowly&lt;br /&gt;
reaches 5 volts.&lt;br /&gt;
When the potential at the base of T2 is 0, T2 and T3 are open, but after&lt;br /&gt;
a while, when the current reaches a certain level,  they switch.&lt;br /&gt;
When T2 and T3 close, the potential at the collector of T2 drops to zero&lt;br /&gt;
volts causing the other capacitor to start charging.&lt;br /&gt;
The current needed to charge this capacitor force the potential at the base&lt;br /&gt;
of T1 to 0v. T1 opens the circuit. The output at the collector of T1 goes&lt;br /&gt;
to one, i.e. 5v. The other capacitor is discharging.&lt;br /&gt;
After a while, when the capacitor on the left reaches a certain level of&lt;br /&gt;
charge T1 flips and closes its circuit. The output at its collector&lt;br /&gt;
returns to 0v and the cycle can be repeated from the beginning.&lt;br /&gt;
&lt;br /&gt;
So, why we need T3?&lt;br /&gt;
The output at the collector of T2 would be very different from a square&lt;br /&gt;
wave. In fact, due to the current flowing through the capacitor the rising edge&lt;br /&gt;
of the wave would be very slow.&lt;br /&gt;
When T2 has just begun to switch, at the beginning of the rising edge, the&lt;br /&gt;
current is enough to force T3 to switch completely.&lt;br /&gt;
When our remotely controlled finger is still lightly touching T2, T2's&lt;br /&gt;
finger gives a strong push to T3.&lt;br /&gt;
&lt;br /&gt;
This is a snapshot of my portable oscilloscope.&lt;br /&gt;
&lt;br /&gt;
[[File: oscilloscope.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
The top trace (blue) is taken at the collector of T2, the second trace&lt;br /&gt;
(yellow) is taken at the collector of T1 while the third (pink) is the&lt;br /&gt;
trace of a logical analyzer connected to the output (collector of T3).&lt;br /&gt;
As you can see the rising edge are quite smooth in the blue and pink&lt;br /&gt;
traces, not square waves at all.&lt;br /&gt;
These two traces show how T1 and T2 continue to swing between their two&lt;br /&gt;
states open/close.&lt;br /&gt;
T3 makes the rising edge steeper. It is not a perfect square wave,&lt;br /&gt;
but nothing is perfect in electronics.&lt;br /&gt;
&lt;br /&gt;
The values of the components have been chosen to have a clock beating&lt;br /&gt;
at a frequency around 1Hz, i.e.  1 cycle per second.&lt;br /&gt;
It is muc slower than the clocks of out perconal computers, tablets or&lt;br /&gt;
portable phones,  but the idea is the same.&lt;br /&gt;
The purpose of this educational tool is to show how all the basic&lt;br /&gt;
components of a CPU work. Phenomena changing at the rate of 1Hz or less&lt;br /&gt;
can be easily observated by humans.&lt;br /&gt;
Our master clock frequency in not exactly 1Hz and can slightly change&lt;br /&gt;
during the time. In fact, the values of the components are subject to&lt;br /&gt;
a tolerance and can vary due to the temperature.&lt;br /&gt;
Real master clocks use the electrical obscillations of a quartz crystal&lt;br /&gt;
to provide a square wave at a quite stable frequency.&lt;/div&gt;</summary>
		<author><name>GiuliaN</name></author>
	</entry>
</feed>