Circuit design

20
Circuit design Ruslan Ospanov www.cryptography.kz www.cryptoprotocols.kz 2018

Transcript of Circuit design

Circuit designRuslan Ospanov

www.cryptography.kzwww.cryptoprotocols.kz

2018

Module 1. The basics of Circuit design

1.2 Topic: Number systems and codes.

Summary: Number systems. Base conversions. Computer codes.

Number systems

A number system consists of an ordered set of symbols (digits) with relations defined for addition, subtract, multiplication, and division. The radix of a number system is the total number of digits allowed in the system. Any number in a system can have both an integer (whole) part and a fractional part, separated with a radix point.

Number systems

Positional Notation. As an example, consider a fictional paycheck of $956.81. This number is expressed in positional notation. This means that the position of each digit indicates its relative weight (or significance). Here, this paycheck can be cashed for 9 hundred dollar bills, 5 ten dollars bills, 6 one dollar bills, 8 dimes, and 1 penny.

Number systems

Positional Notation. A positive number, N, can be written in positional notation as: N = (a n-1 a n-2 …a 1 a 0 a -1..a -2 …a -m ) r Here, n represents the number of digits to the left of the radix point, m represents the number of digits to the right of the radix point, and r represents the radix. Using this notation, our paycheck can be expressed as (956.81) 10. In general, we can emit the () r if the radix is known by context.

Number systems

Polynomial Notation. We can also express this amount in polynomial notation. For example, we can express our value of 956.81 as 9 x 10 2 + 5 x 10 1 + 6 x 10 0 + 8 x 10 -1 + 1 x 10 -2 Note that each digit resides in a weighted position and that weight is a power of the radix (10 in this case).

Number systems

Polynomial Notation. We can also express this amount in polynomial notation. For example, we can express our value of 956.81 as 9 x 10 2 + 5 x 10 1 + 6 x 10 0 + 8 x 10 -1 + 1 x 10 -2 Note that each digit resides in a weighted position and that weight is a power of the radix (10 in this case).

Number systems

Important Number Systems.

In the study of digital systems we have a number of important number systems…

Binary - Radix 2 Octal - Radix 8 Decimal- Radix 10 Hexadecimal- Radix 16

Number systems

Important Number SystemsDecimal Binary Octal Hexadecimal

0 0 0 0

1 1 1 1

2 10 2 2

3 11 3 3

4 100 4 4

5 101 5 5

6 110 6 6

7 111 7 7

8 1000 10 8

9 1001 11 9

10 1010 12 A

11 1011 13 B

12 1100 14 C

13 1101 15 D

14 1110 16 E

15 1111 17 F

16 10000 20 10

Base conversions

- Often, you will need to convert numbers from one base into another. - The easiest and most direct way to do this is series substitution. - To convert a number from base A to base B, first form the series representation of the number in base A and the evaluate the series using base B arithmetic.

Base conversions

Series SubstitutionsFor example, to convert (10100)2 to base 10…

N = 1(24)+0(23)+1(22)+0(21)+0(20)

N = (16)10 + 0 + (4)10 + 0 + 0

N = (20)10

And, to convert (1101.011)2 to base 8…

N = 1(23)+1(22)+0(21)+1(20)+0(2-1)+1(2-2)+1(2-3)

N = (10)8 + (4)8 + 0 + (1)8 + 0 + (.2)8 + (.1)8

N = (5.3)8

Base conversions

An alternate method of converting from base A to base B is the radix divide method.(1) Divide (N)A by the desired base B, producing quotient Q1 and remainder R0. R0 is the least significant digit (d0) of the result.

(2) Compute each remaining digit by dividing the quotient Qi by (B)A, producing Qi+1 and remainder Ri, which represents di.

(3) Stop when the quotient Qi+1 = 0.

Base conversionsRadix Divide Method

Converting (234)10 to base 8… 2 9 -------8 / 2 3 4 1 6 ----- 7 4 7 2 --- 2

b0

3 -----8 / 2 9 2 4 --- 5 b1

0 ---8 / 3 0 - 3 b2

Therefore,(234)10 = (352)8

Base conversions

Radix Multiplication Method

Base conversions

General Conversion Algorithms. There are two general conversion algorithms. Algorithm 1: To convert N from base A to base B, use: (a) the series substitution method with base B arithmetic, or (b) the radix divide and/or multiply methods with base A arithmetic.

Base conversions

Algorithm 2: To convert N from base A to base B, use: (a) the series substitution method with base 10 arithmetic to convert N from base A to base 10, and then (b) the radix divide and/or multiply methods with base 10 arithmetic to convert N from base 10 to base B.

Base conversions

Algorithm 1 is more direct, as we simply go from base A to base B. Algorithm 2 goes from base A to base 10 to base B. So, algorithm 2 requires more steps than algorithm 1. However, it is often easier, faster, and less error prone, as all arithmetic is performed in decimal (base 10). Bottom line … do what is easier for you.

Computer codes

- Computer codes are used for internal representation of data in computers- As computers use binary numbers for internal data representation, computer codes use binary coding schemes- In binary coding, every symbol that appears in the data is represented by a group of bits- The group of bits used to represent a symbol is called a byte- As most modern coding schemes use 8 bits to represent a symbol, the term byte is often used to mean a group of 8 bits- Commonly used computer codes are BCD, EBCDIC, and ASCII

Further Reading

Victor P. Nelson, H. Troy Nagle, Bill D. Carrol, J. David Irwin Digital Logic Circuit Analysis and Design,

Prentice Hall, 1995pp.21-77