2.3 NUMBER CONVERSIONS

Conversions of binary numbers to other number systems, and vice versa, are common in input-output routines. The following sections illustrate the conversion of numbers between number representation systems.

2.3.1 Decimal-to-Binary Conversion

Learning by example would probably be the best way to become familiar with number conversions. The decimal value of a binary number is easily calculated by summing the power terms with nonzero coefficients. Continuous division by 2 obtains the binary form of a decimal number until the final result is equal to zero. The remainder is saved after each division step. The first remainder is the least significant bit (LSB) and the last remainder is the most significant bit (MSB) of the resulting binary number. The following example illustrates decimal-to-binary conversion.

images

Therefore,

images

A conversion is carried out by first dividing the given decimal number by 2. The quotient that results from each division step is again divided by 2 and the remainders are noted in each step. The remainders form the actual binary number. The quotient from the first division step forms the least significant bit (LSB) and the quotient from the last division step forms the most significant bit (MSB).

2.3.2 Decimal-to-Octal Conversion

The same process ...

Get Introduction to Digital Systems: Modeling, Synthesis, and Simulation Using VHDL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.