Digital Circuits/Digital Data

From Wikibooks, open books for an open world
Jump to: navigation, search

Bits[edit]

In a digital circuit, the smallest unit of data is the bit, which derives its name from the phrase binary digit. Any single bit can only exist in one of two possible states. These states are most often represented as either one (1) or zero (0). Other possible representations used are true and false, or off and on, but one and zero are the most common ways to represent the data a bit holds.

In a physical digital circuit, ones and zeros are represented by high and low voltages, respectively. Reasonable voltages within a digital circuit might be 5 volts representing a 1 and zero volts representing a 0. The realities of digital circuits are a bit more complicated than this, but for now this will serve as an adequate abstraction. Understanding how to handle digital information does not require a complete knowledge of how the underlying circuits work.

Bytes[edit]

A single bit has limited use, since it can only represent two states. To overcome this limitation, digital circuit designers use groups of bits to represent data more complex than 1 and 0. If you group two bits together, each bit can take on a 1 or 0 value independent of the other bit. This means that the two bits together can represent four different states, 00, 01, 10 and 11. As you group more bits together you can represent a larger number of states. Three bits can represent eight states and four bits can represent sixteen states. If you have a group of n bits, that group of bits can represent 2n different states.

Early computers used groups of bits of various different sizes, but eventually industry practice converged on the use of groupings of eight bits. Today, a group of eight bits is known as a byte. The term "byte" is a respelling of the word "bite," in order to avoid the problem of a typo causing the two words to be mistaken for one another. If you have ever heard of an eight bit computer, what that means is that the digital circuits within the computer are designed to primarily handle single bytes. One famous instance of an eight bit computer is the original Nintendo Entertainment System.

Nibble[edit]

The value of a byte can be represented using eight digits, like so.

10010110

Even though this is only eight digits, it can be a difficult for a person to read. One way to increase readability is to use some type of spacer or delimiter. We do this all the time with phone numbers (123-555-8765) or social security numbers (XXX-XX-XXXX). A common way to divide a byte is by placing a single space between the two halves of the byte, like so.

1001 0110

When dividing a byte into halves like this, each half is called a nibble (because a nibble is a "small byte"). Few computers handle nibbles independently, although they do exist. Nibbles are usually only a convenient way to represent data organized into bytes.

Word[edit]

Modern computers are built to handle pieces of digital data larger than a byte. These larger units of data are called words. The term word is a bit problematic, because its definition is not as strictly defined as a byte. A word could be any group of bits of a particular size, but most often a word is some number of bytes grouped together. Occasionally there will be a computer part that deals with an unusual word size, like 13 bits, but the most common word sizes are 16 bits, 32 bits and 64 bits.

The three common word sizes are sometimes referred to with specific names. The term word gets reused in this context to specifically mean a 16 bit word. A 32 bit word is called a double word, and a 64 bit word is a quad word. The reuse of the term "word" to mean any group of bits, or specifically a group of 16 bits can be confusing. Most of the time it won't matter too much, but you will have to rely on the specific context to determine which meaning applies.