1s and 0s for Processors (CPUs)
06/22/2001
How CPU's use Binary Code
- The most basic thing for a CPU, would be to either retrieve data or store data. Because that is a simple "binary choice" between retrieval vs store, that would only require a single bit somewhere in the instruction code. However, taking away one bit from a possible 8-bits available, means we now only have 7 bits left for instruction decode. Of course, we may not need all of those remaining possibilities.
- Now, assume that with the available binary bits "xxxx xxxx", we decide that a "0011 1010" will be assigned for data retrieval, and we also assign that single bit to occur as "0011 1000" for data storage. Note the occurance of that single bit in the second position from the right to represent our choice of retrival vs storage. We could, if we were in charge of this CPU design, assign any particular binary combination we choose.
- Digital circuits could easily be fashioned to trigger on the "0011 10x0" combination, preparing for data retrieval or data storage. The one single bit (identified as the "x") would then trigger the respective action of either data retrieval or data storage, by retrieval if the bit is a "1", and storage if the bit is a "0".
The old joke about "being told to jump", and then "asking how high", could be used to illustrate the next step in our sequence of data retrieval/store.
- We need one or two blocks of binary bits to identify "where" in memory the retrieval or storage of data is in refence to. A block of 8 binary bits will only allow 256 possible address locations, but if we can take advantage of two consecutive 8-bit blocks, that would allow us to select 65,356 possible memory locations. Since these locations do not have to be in any sequential order, and are accessible in any random order, we call this memory access "RAM", as "Random Access Memory".
- Now, suppose that we want to be able to go from one location of our set of instructions to another location, we would need an instruction that would be binary decoded for that command. Since we are assigning our own set of arbitrary codes, we could use "1100 0011" as a GOTO or JUMP command, but we still need to supply "where" we want to go to as a memory address. This could be done in the same fashion as before, where the next block or two of binary bits can identify the necessary memory address to go to.
- If we wanted to do something that would allow us to interface the CPU to the outside world, we would need a binary code for that kind of CPU code. This could be a "0000 00x0", with the "x" again being a selection of either "retieve data" from the interface, or "write data" to the interface. If we used a "1" at the "x" location, it could be decoded as a "retrieve data", and a "0" could be decoded as a "write data". Note especially the common use of that same bit location for a "read" vs "write" control.
More Information
Back to "0's" & "1's" for Processors, "The Basics"
See also CPU's & Operating Systems
Back to Computer Hardware Systems - How a Computer really works