0% found this document useful (0 votes)
28 views12 pages

MFC1NS

Uploaded by

prica_adrian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views12 pages

MFC1NS

Uploaded by

prica_adrian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

0.

Seven Segment Display (SSD)

A seven segment display, like you might find it in a calculator, consists in 7


segments that are labeled 'a' through 'g', as it is shown in the figure 1.1. The aim of the
SSD is to show the decimal digits as in the figure 1.2.

Fig. 1.1 Fig. 1.2

The SSD can be extended in order to show the hexadecimal digits, as it is shown
in the figure 1.3.

Fig. 1.3

The SSD takes as an input a 4-bit binary number and produces as output a 7-bit
binary number. A 0 n-th bit at the output turns the n-th segment off and an 1 n-th bit turns
the n-th segment on.

(Hexa) Input Output


decimal digit A B C D a b c d e f g
0 0 0 0 0 1 1 1 1 1 1 0
1 0 0 0 1 0 1 1 0 0 0 0
2 0 0 1 0 1 1 0 1 1 0 1
3 0 0 1 1 1 1 1 1 0 0 1
4 0 1 0 0 0 1 1 0 0 1 1
5 0 1 0 1 1 0 1 1 0 1 1
6 0 1 1 0 1 0 1 1 1 1 1
7 0 1 1 1 1 1 1 0 0 0 0
8 1 0 0 0 1 1 1 1 1 1 1
9 1 0 0 1 1 1 1 1 0 1 1
A 1 0 1 0 1 1 1 0 1 1 1
B 1 0 1 1 0 0 1 1 1 1 1
C 1 1 0 0 1 0 0 1 1 1 1
D 1 1 0 1 0 1 1 1 1 0 1
E 1 1 1 0 1 0 0 1 1 1 0
F 1 1 1 1 1 0 0 0 1 1 1
The table from above is a truth table and it is used to describe the behavior of a
Boolean function. Starting from the truth table, a Boolean function can be determined,
then it can be minimized and, finally, the corresponding combinatorial circuit can be
designed. After reading the first 3 chapters of this course you will be able to design the
combinatorial circuit for a SSD and, generally, to design the combinatorial circuit for any
other practical problem for which a truth table can be established.

1. Number systems
A number system is the totality of rules for number representation using a set of
symbols named digits.
There are two categories of number systems:
 place-value number systems
 additive number systems
In a place-value number system, the order in which the digits are placed dictates their
value. For instance, for the decimal number system, which is a place-value number
systems, the rightmost position in which a symbol can be placed is the units position, the
position to the left of it is the tens position, next is the hundreds position and so on.
Other place-value number systems are binary number system, octal number system,
hexadecimal number system etc.
In an additive number system, the digits have the same value whatever their positions
are. For instance, the roman number system is an additive number system.

Remark Computers use place-value number systems.

Any place-value number system is characterized by its number of digits, named its
base or radix.

Examples
1) The binary number system has the base 2 and its digits are 0 and 1,
called bits, which is short from binary digit. The binary system is used
for representing the two possible states of a bistable device. For
example, a spot on a magnetic disk can be magnetized or not
magnetized, a transistor can be conducting or not conducting, a switch
can be open or closed.
2) The octal number system has the base 8 and its digits are 0, 1, 2, 3, 4, 5,
6 and 7. It was used first and is still used today in the assambly
language.
3) The decimal number system is the most familiar number system, it has
the base 10 and its digits are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
4) The hexadecimal number system has the base 16 and its digits are 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
Hexadecimal number system is used when working directly with
memory addresses.

1.1. The number systems theorem

The number system theorem gives us a theoretical foundation for number


representation in a base b number system, where b is an integer number greater than 1.

Theorem (Integer division theorem) For any a, bZ, b  0, there exist and are unique
the quotient qZ and the remainder rZ such that
a = bq + r and 0  r < b

Theorem (Number systems theorem) Let bZ, b > 1. For any positive integer number
N, there are the numbers n, a0, a1,..., anZ+ , 0ai <b, for 0i<n, 0<an <b, such that
N = anbn + an-1bn-1 + ...+ a1b + a0.
Moreover, these numbers are unique.

Proof. From the Integer division theorem it follows that


N = N0b + a0 and 0  a0 <b.
Obviously, N0 < N, because otherwise we would have
N < Nb  N0b  N0b + a0 = N, which is absurd.
Also, from the Integer division theorem it follows that
N0 = N1b + a1 and 0  a1 <b , N1 < N0 (for the same reason as above).
In this manner, we can determine the following finite inequalities sequence:
N > N0 > N1 > N2.> ... > 0.
Consequently, there is a positive integer number n such that
Nn = 0
or, equivalently,
Nn-1 = 0b + an, with 0 < an <b.
Thus, we obtained:
N = N0b + a0
N0 = N1b + a1
....
Nn-2 = Nn-1 b + an-1
Nn-1 = an
By multiplying these equalities by a power of b (from 0 to n) and then by adding
them together, we obtain:
N = anbn + an-1bn-1 + ...+ a1b + a0.
Now, we will prove that the numbers n, a0, a1,..., an are unique.
Ad absurdum there are the numbers p, c0, c1,..., cp such that
N = cpbp + cp-1bp-1 + ...+ c1b + c0.
If n < p then,
n p
N=  aibi < bn+1  bp   cibi = N, which is absurd.
i 0 i 0
Consequently, n  p. In the same manner, we can prove that p  n. Thus, n = p.
We must prove that ai = ci for 0  i  n.
If n = 0 then a0 = N = c0.
If n > 0, we have:
N = a0 + b(anbn-1 + an-1bn-2 + ...+ a1), 0  a0 <b
and
N = c0 + b(cnbn-1 + cn-1bn-2 + ...+ c1) , 0  c0 <b.
From the Integer division theorem it follows that
a0 = c0 because they are remainders in the integer division
and
anbn-1 + an-1bn-2 + ...+ a1 = cnbn-1 + cn-1bn-2 + ...+ c1 because they are
quotients in the integer division.
Successively, we can deduce that a1 = c1, a2 = c2, ..., an = cn.

Remark a) The number systems theorem proves that there is an one-to-one


correspondence between any positive integer number N and the finite sequence of
nonnegative integer numbers a0, a1,..., an where ai <b for 0  i  n and an > 0.
Consequently, we can write any positive integer number N in the following forms:
N = anan-1...a1a0 = anbn + an-1bn-1 + ...+ a1b + a0.
The sum anbn + an-1bn-1 + ...+ a1b + a0 is referred to as expanded notation.
b) When one uses several bases one writes anan-1...a1a0(b) instead of anan-1...a1a0.

An important consequence of the number systems theorem is the number systems


algorithm, which describes the remainder method to convert a base 10 number into a base
b number.

Number systems algorithm;


begin
read N, b;
i ← 0;
repeat
ai ← N % b;
N ← [N / b];
i ← i + 1;
until N = 0;
collect ai-1, ai-2, ... , a0 the digits of the base b number;
end.

Example Convert 493 into a base 8 number.


Dividing 493 by 8 we obtain the quotient 61 and the remainder 5.
Dividing 61 by 8 we obtain the quotient 7 and the remainder 5.
Dividing 7 by 8 we obtain the quotient 0 and the remainder 7.
The base 8 number is determined by writing the remainders in the reverse order.
So, 493(10) = 755(8) .
1.2. Base b arithmetic

1.2.1. Number comparison

Theorem (Positive integer numbers comparison theorem) Let bZ, b > 1 and a and c
be two base b positive integer numbers, a = amam-1...a1a0(b) , c = cncn-1...c1c0(b) We have
a < c if and only if m < n or m = n and ap < cp where p = max {i | ai  ci}.

Proof. Let a < c.


n n
Ad absurdum m > n. Then c =  c b   (b  1)b = bn+1 -1< bn+1  bm  a, which
i 0
i
i

i 0
i

is absurd. Thus, m  n. If m < n then it is done, otherwise it means that m = n. In this case
it is obvious that ap < cp where p = max {i | ai  ci}.
m m
Reciprocally, if m < n then a =  aibi   (b  1)bi = bm+1 -1< bm+1  bn  c. Thus,
i 0 i 0
a < c.
If m = n and ap < cp where p = max {i | ai  ci}, then
c – a = (cp – ap) bp + (cp-1bp-1 +...+ c0) - (ap-1bp-1 +...+ a0) >
>bp + (cp-1bp-1 +...+ c0) - bp  0. Thus, a < c.

Remark Previous theorem shows us how positive base b numbers can be compared. If
any two numbers, not necessary both positive numbers, need to be compared, then 3
cases might appear:
1. Both of them are positive. In this case use previous theorem.
2. One is a negative number and the other is positive. Obviously the negative
number is smaller than the positive one.
3. Both of them are negative a, c < 0. In this case a > c if and only if -a < -c.

1.2.2. Integer addition

Let bZ, b > 1 and a and c be two base b positive integer numbers,
a = amam-1...a1a0(b) , c = cncn-1...c1c0(b). We need to find the sum s = a + c.
We have a = a0 + a1b + a2b2 + ... + ambm and c = c0 + c1b + c2b2 + ... + cnbn.
Because a0 < b and c0 < b, it follows that a0 +c0 < 2b or, equivalently,
a0 +c0 = r1b + s0, where 0  s0 <b and the carry r1 may be 0 or 1.
More exactly,
if a0 +c0 < b then s0 = a0 +c0 and r1 = 0
if a0 +c0  b then s0 = a0 +c0 – b and r1 = 1.
Consequently,
s = a + c = s0 + (a1 + c1 + r1)b + (a2 + c2)b2 + ....
Obviously,
a1 + c1 + r1 < 2b.
Thus,
a1 + c1 + r1 = r2b + s1, where 0  s1 <b and the carry r2 may be 0 or 1.
In this manner, we can compute any digit of the sum s:
si = (ai + ci + ri )%b, for each i  0,
where r0 = 0,
0, if ai-1  ci-1  ri-1  b
ri =  , for each i > 0.
1, otherwise

Remark 1)If we add two positive integer numbers a and c, each having (m +1) digits,
then the sum s = a + c has:
(m +1) digits if am + cm + rm < b or
(m + 2) digits if am + cm + rm  b. In this case sm+1 = 1.
2) If the two positive integer numbers a and c have different digit numbers then:
if m > n then we consider cn+1 = cn+2 = ...= cm= 0
if m < n then we consider am+1 = am+2 = ...= an= 0

Addition algorithm;
begin
read b, m, am, am-1, ..., a0, n, cn, cn-1, ..., c0;
if m > n then
for i = n +1 to m do ci= 0;
else
if m < n then begin
for i = m +1 to n do ai= 0;
m ← n;
end;
carry ← 0;
for i = 0 to m do begin
si ← (ai + ci + carry)%b; //the remainder in the integer division
carry ← (ai + ci + carry)/b; //the quotient in the integer division
end;
if carry = 1 then
write 1, sm, sm-1, ... , s0 the digits of the sum;
else
write sm, sm-1, ... , s0 the digits of the sum;
end.

Example
''
12345(8) +
34274(8)
46641(8)
1.2.3. Integer subtraction

We need to perform hexadecimal subtraction when working directly with the


contents of memory. There are applications where we have to subtract one memory
address from another, larger memory address.
We can determine the difference d = a – c with the following algorithm, where a,
c are two positive integer base b numbers and the minuend a is greater than the
subtrahend c.

Subtraction algorithm;
begin
read b, m, am, am-1, ..., a0, n, cn, cn-1, ..., c0;
if m > n then
for i = n +1 to m do ci= 0;
for i = 0 to m do
if ai  ci then
di ← ai - c i ;
else
begin
borrow 1 from ai+1;// ai+1 = ai+1-1
di ← b + ai - ci;
end;
while dm = 0 do
m ← m – 1;
write dm, dm-1, ... , d0 the digits of the difference;
end.

Example

A4EC(16) -
34B4(16)
7038(16)

1.2.4. Integer multiplication


The multiplication of two base b numbers a and c consists in the following
operations:
1. Multiplications of a by powers of the base b
2. Multiplications of a by digits of the number c
3. Integers additions
The multiplication of a by a power of b
Let a = amam-1...a1a0(b).
We have abj = ( a0 + a1b + a2b2 + ... + ambm)  bj = a0 bj + a1 bj+1 + a2 bj+2 + ... +
ambm+j = am am 1...a0 00
 0 .
...
j ori

The multiplication of a by a digit of the number c


Let a = amam-1...a1a0(b) = a0 + a1b + a2b2 + ... + ambm and let be an arbitrary digit
cj of c.
Since ai < b for any i = 0, ..., m and cj < b, it follows that ai cj < b2. From the
Integer Division Theorem it follows that there are a quotient q(ai, cj) and a remainder
r(ai, cj) such that
ai cj = b  q(ai, cj) + r(ai, cj), where 0  r(ai, cj) <b and 0  q(ai, cj) <b.
m m m
Thus acj = a c
i 0
i j  bi =  (b  q(a , c )  r (a , c ))  b =  q(a , c )b
i 0
i j i j
i

i 0
i j
i 1
+
m

 r (a , c )b .
i 0
i j
i

Example
123(5)
24(5)
-------
1102
301
-------
4112(5)

1.2.5. Integer division


The division of two base b numbers a and c consists only in already studied operations:
addition, subtractions and multiplications.

Example

2144(5) | 12(5)
12 |132
44
41
34
24
10

Thus 2144(5) = 12(5) 132(5)+ 10(5).


1.3. Conversions between bases

Let N be a base b number. It could be given through one of the following


equivalent three forms:
1. N  an an-1...a1a0 .a-1a- 2...a-m
  
integer portion fractional portion
n n-1
2. N = anb + an-1b + ...+ a1b + a0 + a-1b-1 + ... + a-mb-m
n
3. N a b
i m
i
i

The second form is referred to as the expanded notation for a base b number. A
radix point separates the integer portion from the fractional portion.
We refer to an as the most significant digit of N and to a-m as the least significant
digit of N.

Remark If m = 0 then N is an integer number. If n = 0 then N < b.

Let N be a base b number, N = anbn + an-1bn-1 + ...+ a1b + a0 + a-1b-1 + ... + a-mb-m .
We want to convert it into a base h number.

1.3.1. Substitution method with computations made in the target


base h

We convert each digit ai and the base b into base h. All the computations are made in
the target base h.
ai(b) = ci(h) for any i, -m  i  n
10(b) = x(h).
Thus, N(b) = (cnxn + cn-1xn-1 + ...+ c1x + c0 + c-1x-1 + ... + c-mx-m)(h).

Example For converting 234(5) into a base 2 number, we convert each digit and the
original base into target base 2:
2(5) = 10(2), 3(5) = 11(2), 4(5) = 100(2), 10(5) = 101(2).
Thus, 234(5) = (2*52 + 3*5 + 4)(5) = (10*1012 + 11*101 + 100)(2) =
(10*11001+1111+100)(2) = (110010+1111+100)(2) = 1000101(2).

Particular case
If b = hk then we convert each digit from the base b number into a k –digit base h
number and we juxtapose these numbers.
Example For converting 5436(8) into a base 2 number, we convert each digit into 3-digit
base 2 number because 8 = 23.
5(8) = 101(2) , 4(8) = 100(2) , 3(8) = 011(2) , 6(8) = 110(2).
Thus, 5436(8) = 101100011110(2).

1.3.2. Substitution method with computations made in the original


base b (base multiplication/division method)
This method is also known as base division/ multiplication method. It is used by
computes for providing the results; usually b =2 and h = 10.
Let N(b) = anan-1...a1a0.a-1...a-m(b)= [N](b) + {N}(b),
where [N](b) is the integer portion of N(b) and {N}(b) is the fraction portion of N(b).
For converting [N](b), the integer portion of N(b) into base h, we will use the
Number systems theorem. We can write
[N](b) = cn'hn' + cn'-1hn'-1 + ...+ c1h + c0,
where we do not know the digits cn', cn'-1, ...,c1, c0, but we can determine them by a
sequence of integer divisions by h.
[ N ]( b )  (cn 'h n '1  cn '-1h n '2  ...  c1 )h  c0 , so we can determine c0, which is

[ N1 ]( b )

the remainder in the integer division,


[ N1 ]( b )  (cn 'h n '2  cn '-1h n '3  ...  c2 )h  c1 , so we can determine c1,

[ N 2 ]( b )

.....
[Nn'](b) = cn', so we can determine cn'.

Now we have to convert {N}(b), the fraction portion of N(b) into base h. We can
write
{N}(b) = c-1h-1 + c-2h-2 +... + c-m'h-m',
where we do not know the digits c-1, c-2,...,c-m', but we can determine them by a sequence
of multiplications by h.
{N }( b ) h  c1  c 2 h 1  c- 3h 2  ...  c m 'h  m '1 , so we can determine c-1,
 
{ N 1 }( b )

{N1}( b ) h  c 2  c 3h  ...  c m 'h  m '2 , so we can determine c-2,


1

{ N 2 }( b )

....
{N m '1}( b ) h  c m ' , so we can determine c-m'.
Consequently, N(b) = anan-1...a1a0.a-1...a-m(b) = cn'cn'-1...c1c0.c-1...c-m'(h).

Example Convert 234.128(10) into a base 8 number.


234 = 29* 8 + 2, it follows that c0 = 2.
29 = 3*8 + 5, thus c1 = 5.
3 = 0* 8 + 3, thus c2 = 3.
Consequently, 234(10) = 352(8) .
0.128*8 = 1.024, it follows that c-1 = 1.
0.024*8 = 0.192, thus c-2 = 0.
0.192*8 = 1.536, thus c-3 = 1.
Consequently, 0.128(10) = 0.101(8) and 234.128(10) = 352.101(8).

Particular case
If h = bk then, starting from the radix point to the left and to the right, we group the
base b digits into sequences of length k, if necessary adding insignificant zeros at the end
of the rightmost group after the radix point. Each group can be interpreted as a base h
digit.

Example For converting 1101110111001(2) into a base 8 number, we group the digits
into sequences of length 3 because 8 = 23:
1
101110
111001 = 001
101 110111001 .

We know that 001(2) = 1(8) , 101(2) = 5(8) , 110(2) = 6(8) , 111(2) = 7(8).
Thus, 1101110111001(2) = 15671(8).
Example For converting 10011111.11001(2) into a base 16 number, we group the digits
into sequences of length 4 because 16 = 24:
1001
 1 = 1001
1111.1100 1111.11001000 
We know that 1001(2) = 9(16), 1111(2) = F(16) , 1101(2) = D(16) , 1000(2) = 8(16).
Thus, 10011111.11001(2) = 9F.D8(16).

1.3.3. Substitution method with computations made in a third base


g

This method is usually used when we make hand computations for converting a base
b number into a base h number, where b, h  10. Because base 10 arithmetic is more
familiar to us, we prefer to do all the computations in base 10, so we will use base 10 as
an intermediate base. This method consists of:
1. converting the base b number into a base g number with computations made in
base g, followed by
2. converting the base g number into a base h number with computations made in
base g

Example For converting 111442(5) into a base 8 number, it seems easier to use base 10 as
an intermediate base. First we convert 111442(5) into a base 10 number in the following
manner:
111442(5) = (1*55 + 1*54 +1*53 +4*52 +4*5 +2)(10) = 3997(10).
Now, we need to convert 3997(10) to a base 8 number:
3997 = 499*8 + 5
499 = 62*8 + 3
62 = 7*8 + 6
7 = 0*8 + 7
Thus, 3997(10) = 7635(8) and 111442(5) = 7635(8).

You might also like