Wednesday, September 30, 2009

Bits, Nibbles, Bytes, and Words, Lee Bond N7KC

September 30, 2009 Educational Radio Net, PSRG 71st Session

The digital computer is ubiquitous. These computers are everywhere. Kids have their own and, more than likely, so do the grandparents. Most users are very proficient with the keyboard and blaze through the games, documents, spreadsheets, and whatnot without even a thought of what is going on inside that mysterious box called a computer. I am willing to bet that not one in ten users can define a "bit" and I will further wager that not one in 100 users has a good grasp of computer arithmetic or how the rational coding of bits makes their computer tick.

My task tonight is to lead you down that magic path and explore the idea of the "bit" and how it can be used to represent numbers or events. We will then extend the bit notion into nibbles, bytes, and words. Some of the net participants tonight are likely to be expert in this bit world so, if you quality, think of ways to help me clarify the notion when I break for questions or comments.

Let’s start with our very familiar decimal number system and dissect it in a way that I bet few of you have done. We will concern ourselves only with integers so no fractions are allowed in our discussion. Integers are the numbers 1, 2, 3, etc. that have no fractional part. You may call them whole numbers if you please. Integers can be precisely defined but that would muddy the water a bit so we will dispense with such formalism in favor of simplicity. We will start with the integers 1 through 9 and include the notion of nothingness as in zero.

When we think of the decimal integers we must consider the ordering. For example after nothingness as in zero we think of 1, then 2, then 3, etc. in order through 9. Our standard notion of 9 is that it is ‘bigger’ than 8 and 8 is ‘bigger’ than 7 or 6 or 5, etc. In the following discussion throw ordering out the door. We will not be interested in ordering. In fact we will not even use numbers rather we will choose a collection of identical marbles and call then symbols. So, zero (or nothingness) plus 1 through 9 equals 10 symbols which we represent with 10 marbles.

Unfortunately this forum of ours does not include a chalkboard so we must create a virtual chalkboard in your mind. If it helps then close your eyes and imagine the following: in your mind arrange 6 boxes in a 2 row x 3 column array. Each of the boxes in the top row has 10 identically sized marbles and the row of lower boxes have ‘nothing’ or zero marbles. Just so we do not get marbles in the wrong boxes lets choose black marbles for the rightmost box, brown marbles for the center box, and red marbles for the leftmost box.

Ok, lets do something useful with this scheme. Assume that you are sitting on the back porch looking toward the Cascades and you want to tally lightning strikes. When the first strike occurs you move a black marble from the top right box into the box below. At the next strike you repeat the previous operation and move another black marble from the top right box into the box below. As you notice more and more lightning strikes you move black marbles until you have no more black marbles in the top right box. At this point you have used all of your marbles, so to speak, and you indicate this fact by moving a brown marble into the middle box below then move all of the ‘used’ black marbles back into the top right storage box.

The lightning strikes continue and you move black marbles, one by one, into the lower box until you again run out of marbles. At this point you move a brown marble from the top box into the box below and reload the top box with the black marbles. Eventually you will run out of brown marbles in the top center box so you will move a red marble from the top left box to the box below and reload the top boxes with appropriate black and brown marbles.

The point of this mental exercise is to illustrate that you can tally objects with symbols and that every time you exhaust, or cycle through, your symbol set you just indicate this fact by incrementing the symbol set to the left. You can choose as many symbols as you please. In this example, based on the decimal system with 10 symbols, each box to the left is weighted or "heavier" by 10 with respect to its neighbor to the right. As a result, this 10 symbol scheme goes units, tens, hundreds, thousands, etc. so is very convenient for us mortals. Once you know the weighting you can easily figure out how many lightning strikes you tallied by counting the symbols in each weighted box.

In the interest of time let me assert that you can use a set of 12, or 9 or 8 or 7, etc. symbols and the scheme holds true. Now lets examine the case where we have reduced the set to two symbols. Thinking for a moment you realize that "bi" means two as in binary star or binocular. Could the binary number system be as simple as accounting for just two symbols? The answer is, of course, yes. The beauty of using two symbols in numerical computing is that transistors are very good switches and can be used to represent the two binary states perfectly. A SPST switch normally has two states such that it is either on or off. Open or closed. It is a trivial exercise to arrange a circuit with a mechanical switch such that one switch position results in +5 volts and the other position results in zero volts. The symbols associated with a two state switch are zero and one as in 0 or 1.

Now, in a fashion similar to the decimal box exercise above let’s arrange 8 binary boxes side by side in a row. We know that the state of each of these "binary" boxes can be represented by either a 0 or a 1. Assume that the rightmost box is the, so called, least significant box and that all boxes are in the 0 state. Visually the boxes look like 0000 0000. Now, bump the rightmost box to the 1 state and the visual presentation goes to 0000 0001. Well, the rightmost box has now used all of its symbols so to tally the next event it must return to 0 and the box to the left is bumped from 0 to 1 as in 0000 0010. If you carry this process forward you will eventually achieve 1111 1111 and the next event will change all positions back to 0000 0000. The weighting goes by 2 rather than 10 as in the decimal case so each position to the right is ½ of its left neighbor or each position is twice its neighbor to the right. The sequence is 256, 128, 64, 32, 16, 8, 4, 2, 1. These 8 boxes represent a byte and each of the positions is a binary digit or bit. Two sets of 8 boxes as in 2 bytes or 16 bits represents a binary "word". Half a byte as in 4 bits is a nibble (or nybble to some).

The total number of distinct combinations of 8 bits from 0000 0000 to 1111 1111 is 256 and goes as 2^8. A binary word composed of 16 bits can assume 2^16 or 65,536 distinct combinations. Recall that we are limiting ourselves to positive integers so we are only able to handle numbers up to 65,536. There are schemes to handle signed integers such as 2’s complement arithmetic and to be completely flexible there are floating point schemes which look a lot like scientific notation.

Four binary bits can assume 16 distinct combinations and is the basis of the hexadecimal number system which has symbols 0 through 9 plus A, B, C, D, E, and F. Four binary bits are also used for BCD or binary coded decimal notation by throwing away the six unused states.

How would one go about doing math operations on a computer? Well, microprocessors are very good and quick at adding or subtracting but clumsy when multiplying or dividing. Early microprocessors required many operations or, so called, clock cycles to produce numerical products and it was common to have a math coprocessor standing by to do the heavy lifting. For example, if you want to multiply a number by 10 in the decimal system you just move the decimal point one position to the right. In the binary system you would shift left (x2), shift left again (x4), shift left again (x8), and then add twice to achieve the 10x product. Clearly, there is a lot of time consuming overhead doing math in this fashion. Contemporary microprocessors are constructed with onboard and dedicated numerical processors with slick routines and which unburden the main unit.

If you look at the schematic of any computer one thing will pop out immediately. There are lots of parallel paths connecting the various semiconductor packages. These parallel wire structures are called busses and might be as wide as 16 bits… possibly more… for memory addressing as an example. There is likely a data buss as well. One line generally represents the buss with breakouts at the ends. Each wire handles one bit of data on the data buss.

In summary, the intent of this presentation is to show that symbols can be used to tally events and that recycling symbols will work in any number system. Starting with the familiar decimal number system and showing that symbol manipulation leads handily to the very simple two state, or binary, number system. A bit is a two state binary digit, a nibble is four associated bits, a byte is 2 associated nibbles or 8 bits, and a word is 2 bytes of 16 associated bits. Modern computers are said to have 32 bit words and, in some cases, 64 bit words.

This concludes the set up discussion for bits, nibbles, bytes, and words. Are there any questions or comments with regard to tonight's discussion topic?

This is N7KC for the Wednesday night Educational Radio Net


Doug KD7KKR said...

In the system of bins, for decimal, there should be 9 marbles in each column. The marbles are not symbols. The ten symbols 0 - 9 stand for zero through nine marbles in the upper bin. If you have 10 marbles, you have too many. Before the first count, you have no marbles in the upper bin, which corresponds to the symbol zero. When you begin the tenth count, you already have nine marbles in the upper bin, so you have no marbles in the lower bin. This is how you know to return all the marbles from the upper bin back to the lower bin and move one marble up in the next column, representing 10. You always have one less marble in each column than the base you are using. For binary, you have only one marble in each column, either in the lower bin (0) or the upper bin (1). When you use symbols instead of marbles in bins, you need ten symbols for decimal or two for binary because you need zero as a place holder. When you use bins, the column of bins is the place holder. I was going to suggest comparing the bin system with the system used on an abacus, but it turns out several different systems are used with an abacus, so some have 9 beads per column, some have 10; some have two groups of beads per column, with 4 and 1 beads (the extra bead denoting 5, as in: 0+0, 0+1, 0+2, 0+4, 5+0, 5+1, 5+2, 5+3, 5+4), some have 5 and 2 beads, and can be used for either decimal or hexadecimal.

Doug KD7KKR said...

Since you were talking about eight binary digits, you should not have included nine place values. 256 is the place value for the ninth digit.

Doug KD7KKR said...

Strictly, you are limiting to non-negative integers, also known as unsigned integers. The set of positive integers does not include zero, and is also called the counting numbers, which begins at one. You need zero to have 256 distinct combinations for eight bits, 0 through 255, and 65536 combinations for 16 bits, 0 through 65535.

Anonymous said...

And to be clear, I don’t imagine there's any going back now, nor ought to we. Pandora’s field is officially open and sports activities betting is unlikely to get less authorized around here anytime quickly. Merely shedding money is healthier than shedding money in a way that could invite jail time. That said, it’s price understanding how easy online access to sports activities betting could be be} legitimately harmful for some folks. Betting on video games was sufficient to make you persona non grata in each major sports activities league on this nation as lately as Barack Obama's presidency. Now, the NFL is officially partnered with multiple of} betting services, betting data is proven 카지노사이트 in onscreen graphics throughout video games, and also you can’t sit through a industrial break on gameday without seeing advertisements for betting apps.