Файл: Digital design with CPLD applications and VHDL (R. Dueck, 2000).pdf

ВУЗ: Не указан

Категория: Не указан

Дисциплина: Не указана

Добавлен: 13.06.2025

Просмотров: 8061

Скачиваний: 6

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

1.4 • Hexadecimal Numbers

13

EXAMPLE 1.7

What is the next hexadecimal number after 999? After 99F? After 9FF? After FFF?

SOLUTION The hexadecimal number after 999 is 99A. The number after 99F is 9A0.

The number after 9FF is A00. The number after FFF is 1000.

EXAMPLE 1.8

List the hexadecimal digits from 19016 to 20016, inclusive.

SOLUTION The numbers follow the counting rules: Use all the digits in one position,

add 1 to the digit one position left, and start over.

For brevity, we will list only a few of the numbers in the sequence:

190, 191, 192, . . . , 199, 19A, 19B, 19C, 19D, 19E, 19F,

1A0, 1A1, 1A2, . . . , 1A9, 1AA, 1AB, 1AC, 1AD, 1AE, 1AF,

1B0, 1B1, 1B2, . . . , 1B9, 1BA, 1BB, 1BC, 1BD, 1BE, 1BF,

1C0, . . . , 1CF, 1D0, . . . , 1DF, 1E0, . . . , 1EF, 1F0, . . . , 1FF, 200

SECTION 1.4A REVIEW PROBLEMS

1.6.List the hexadecimal numbers from FA9 to FB0, inclusive.

1.7.List the hexadecimal numbers from 1F9 to 200, inclusive.

Hexadecimal-to-Decimal Conversion

To convert a number from hex to decimal, multiply each digit by its power-of-16 positional multiplier and add the products. In the following examples, hexadecimal numbers are indicated by a final “H” (e.g., 1F7H), rather than a “16” subscript.

EXAMPLE 1.9

Convert 7C6H to decimal.

SOLUTION

7 162 710 25610 179210

C 161 1210 1610 19210

6 160 610 110 610

199010

EXAMPLE 1.10

Convert 1FD5H to decimal.

SOLUTION

1 163 110 409610 409610

F 162 1510 25610 384010

D 161 1310 1610 20810

5 160 510 110 510

814910

SECTION 1.4B REVIEW PROBLEM

1.8Convert the hexadecimal number A30F to its decimal equivalent.

Decimal-to-Hexadecimal Conversion

Decimal numbers can be converted to hex by the sum-of-weighted-hex-digits method or by repeated division by 16. The main difficulty we encounter in either method is


14

C H A P T E R

1 • Basic Principles of Digital Systems

remembering to convert decimal numbers 10 through 15 into the equivalent hex digits,

A through F.

Sum of Weighted Hexadecimal Digits

This method is useful for simple conversions (about three digits). For example, the decimal

number 35 is easily converted to the hex value 23.

3510 3210 310 (2 16) (3 1) 23H

EXAMPLE 1.11

Convert 17510 to hexadecimal.

SOLUTION

25610 17510 1610

Since 256 162, the hexadecimal number will have two digits.

(11 16) 175 (10 16)

16

1

A

175 (A 16) 175 160 15

16

1

175 ((A 16) (F 1))

A

F

175 (160 15) 0

Repeated Division by 16

Repeated division by 16 is a systematic decimal-to-hexadecimal conversion method that is not limited by the size of the number to be converted.

It is similar to the repeated-division-by-2 method used to convert decimal numbers to binary. Divide the decimal number by 16 and note the remainder, making sure to express it as a hex digit. Repeat the process until the quotient is zero. The last remainder is the most significant digit of the hex number.

EXAMPLE 1.12

Convert 3158110 to hexadecimal.

SOLUTION

31581/16 1973 remainder 13 (D) (LSD)

1973/16

123

remainder

5

123/16

7

remainder 11 (B)

7/16

0

remainder

7 (MSD)

3158110 7B5DH

SECTION 1.4C REVIEW PROBLEM

1.9Convert the decimal number 8137 to its hexadecimal equivalent.

Conversions Between Hexadecimal and Binary

Table 1.4 shows all 16 hexadecimal digits and their decimal and binary equivalents. Note that for every possible 4-bit binary number, there is a hexadecimal equivalent.

Binary-to-hex and hex-to-binary conversions simply consist of making a conversion between each hex digit and its binary equivalent.


1.5 • Digital Waveforms

15

EXAMPLE 1.13

Convert 7EF8H to its binary equivalent.

SOLUTION Convert each digit individually to its equivalent value:

7H 01112

EH 11102

FH 11112

8H 10002

The binary number is all the above binary numbers in sequence:

7EF8H 1111110111110002

The leading zero (the MSB of 0111) has been left out.

SECTION 1.4D REVIEW PROBLEMS

1.10Convert the hexadecimal number 934B to binary.

1.11Convert the binary number 11001000001101001001 to hexadecimal.

1.5Digital Waveforms

K E Y T E R M

Digital waveform A series of logic 1s and 0s plotted as a function of time.

The inputs and outputs of digital circuits often are not fixed logic levels but digital waveforms, where the input and output logic levels vary with time. There are three possible types of digital waveform. Periodic waveforms repeat the same pattern of logic levels over a specified period of time. Aperiodic waveforms do not repeat. Pulse waveforms follow a HIGH-LOW-HIGH or LOW-HIGH-LOW pattern and may be periodic or aperiodic.

Periodic Waveforms

K E Y T E R M S

Periodic waveform A time-varying sequence of logic HIGHs and LOWs that repeats over a specified period of time.

Period (T) Time required for a periodic waveform to repeat. Unit: seconds (s).

Frequency (f ) Number of times per second that a periodic waveform repeats. f 1/T Unit: Hertz (Hz).

Time HIGH (th) Time during one period that a waveform is in the HIGH state.

Unit: seconds (s).

Time LOW (tl) Time during one period that a waveform is in the LOW state.

Unit: seconds (s).

Duty cycle (DC) Fraction of the total period that a digital waveform is in the

HIGH state. DC th/T (often expressed as a percentage: %DC th/T 100%).

Periodic waveforms repeat the same pattern of HIGHs and LOWs over a specified period of time. The waveform may or may not be symmetrical; that is, it may or may not be HIGH and LOW for equal amounts of time.


16

C H A P T E R

1 • Basic Principles of Digital Systems

EXAMPLE 1.14

Calculate the time LOW, time HIGH, period, frequency, and percent duty cycle for

each of the periodic waveforms in Figure 1.5.

FIGURE 1.5

Example 1.14: Periodic Digital Waveforms

How are the waveforms similar? How do they differ?

SOLUTION

a.Time LOW: tl 3 ms Time HIGH: th 1 ms

Period: T tl th 3 ms 1 ms 4 ms Frequency: f 1/T 1/(4 ms) 0.25 kHz 250 Hz

Duty cycle: %DC (th/T) 100% (1 ms/4 ms) 100%

25%

(1 ms 1/1000 second; 1 kHz 1000 Hz.)

b.Time LOW: tl 2 ms Time HIGH: th 2 ms

Period: T tl th 2 ms 2 ms 4 ms Frequency: f 1/T 1/(4 ms) 0.25 kHz 250 Hz

Duty cycle: %DC (th/T) 100% (2 ms/ 4 ms) 100%

50%

c.Time LOW: tl 1 ms Time HIGH: th 3 ms

Period: T tl th 1 ms 3 ms 4 ms

Frequency: f 1/T 1/(4 ms) 0.25 kHz and 250 Hz Duty cycle: %DC (th/T) 100% (3 ms/ 4 ms) 100%

75%

The waveforms all have the same period but different duty cycles. A square waveform,

shown in Figure 1.5b, has a duty cycle of 50%.

Aperiodic Waveforms

K E Y T E R M

Aperiodic waveform A time-varying sequence of logic HIGHs and LOWs that

does not repeat.

An aperiodic waveform does not repeat a pattern of 0s and 1s. Thus, the parameters of time HIGH, time LOW, frequency, period, and duty cycle have no meaning for an aperiodic waveform. Most waveforms of this type are one-of-a-kind specimens. (It is also worth noting that most digital waveforms are aperiodic.)


1.5 • Digital Waveforms

17

Figure 1.6 shows some examples of aperiodic waveforms.

FIGURE 1.6

Aperiodic Digital Waveforms

EXAMPLE 1.15

A digital circuit generates the following strings of 0s and 1s:

a.

0011111101101011010000110000

b.

0011001100110011001100110011

c.

0000000011111111000000001111

d. 1011101110111011101110111011

The time between two bits is always the same. Sketch the resulting digital waveform for each string of bits. Which waveforms are periodic and which are aperiodic?

SOLUTION Figure 1.7 shows the waveforms corresponding to the strings of bits above. The waveforms are easier to draw if you break up the bit strings into smaller groups of, say, 4 bits each. For instance:

a. 0011 1111 0110 1011 0100 0011 0000

All of the waveforms except Figure 1.7a are periodic.

FIGURE 1.7

Example 1.15: Waveforms

Pulse Waveforms

K E Y T E R M S

Pulse A momentary variation of voltage from one logic level to the opposite level and back again.

Amplitude The instantaneous voltage of a waveform. Often used to mean maximum amplitude, or peak voltage, of a pulse.

Edge The part of the pulse that represents the transition from one logic level to the other.

Rising edge The part of a pulse where the logic level is in transition from a LOW to a HIGH.

18

C H A P T E R 1 • Basic Principles of Digital Systems

Falling edge The part of a pulse where the logic level is a transition from a HIGH to a LOW.

Leading edge The edge of a pulse that occurs earliest in time.

Trailing edge The edge of a pulse that occurs latest in time.

Pulse width (tw) Elapsed time from the 50% point of the leading edge of a pulse to the 50% point of the trailing edge.

Rise time (tr) Elapsed time from the 10% point to the 90% point of the rising edge of a pulse.

Fall time (tf ) Elapsed time from the 90% point to the 10% point of the falling edge of a pulse.

Figure 1.8 shows the forms of both an ideal and a nonideal pulse. The rising and falling edges of an ideal pulse are vertical. That is, the transitions between logic HIGH and LOW levels are instantaneous. There is no such thing as an ideal pulse in a real digital circuit. Circuit capacitance and other factors make the pulse more like the nonideal pulse in Figure 1.8b.

Pulses can be either positive-going or negative-going, as shown in Figure 1.9. In a pos- itive-going pulse, the measured logic level is normally LOW, goes HIGH for the duration

1

1

0.5

0

t

0

t

t1

t2

t1

t2

a. Ideal pulse (instantaneous transitions)

b. Nonideal pulse

FIGURE 1.8

Ideal and Nonideal Pulses

FIGURE 1.9

Pulse Edges