How does binary translate to hardware?

Viewed 23116

I understand how the code is compiled to assembly, and that assembly is a 1:1 replacement with binary codes. Can somebody help me understand how binary is connected to the hardware? How is the binary physically read and run? How does an if statement work in the hardware?

From google searches I'm thinking that maybe my question title should be "how is binary data put on a line of a bus" but I wasn't sure.

Thanks.

14 Answers

I think this is actually a fun question. I would say "here's how to build a computer in a few easy steps".

  • Start with some simple logic circuits, such as AND, OR, NOT, and a flip-flop. A flip-flop is a pair of transistors arranged so that if one is ON, the other is OFF, or vice-versa. That way it can "remember" one bit of information, so you can think of it as a storing a single binary digit. Some input lines can put it in one state or the other, and thus "write" to it.

  • You can store a bigger number by having a bunch of flip-flops, and call it a "register". For example, if you have four flip-flops in a register, there are 16 possible combinations, so you can think of it as holding a number from 0 to 15.

  • Skipping ahead a little bit, you can buy a "memory chip". What that is is a good number of registers, like say 16 of them. It has 4 wires coming in (the "address" wires), and it has 4 wires coming out (the "data" wires). So a number from 0 to 15 can come in as an address, and that selects one of the 16 registers, whose value is presented on the output data wires (thus "reading" it). Another few wires can cause data to come IN on the data wires to cause numbers to be put into ("written") the register.

  • Now suppose you have an external 4-bit register (call it R), and a bit of circuitry, so that it

    1. presents the value in R to the memory address
    2. reads the 4-bit value at that register and moves it into R
    3. and repeats this over and over

Depending on the numbers that have been pre-loaded into the memory, you can see that this thing will cycle around through a series of numeric addresses, because the number at each address determines what the next address will be.

Now, you can embellish this thing in a lot of ways. You can expand the memory to have 5-bits of address (32 registers). Then if one of the address lines is connected to the outside world, it will do different things depending on the outside world. That's a "finite-state-machine".

You can replace the R register with a simple counter, and call it a "program counter". You can take the data coming out of the memory and call it an "instruction", and use some of its bits to read other memory addresses and load a set of arithmetic registers. You can use some to control whether the R register simply increments, or maybe gets a new address stored in it. That's called "jumping".

Of course, this is a very simple computer, but that's roughly how they started out.

When we look at Binary or a programming language we are looking at symbols and words that a human can understand which describe essentially the electrical activity of an electronic system. Ultimately, speed of energy, amount of energy, loss of energy, creation of heat and light, and the CHANGE that the substance which the energy is flowing through undergoes as a result of being energized as well as how that effects the activity of the energy as it flows is understood by a human and manipulated or harnessed with a piece of electronics. One factor in understanding the complex system which is a computer or other device, is knowing what the electricity that's flowing inside of it is doing. To know this we have described one of the electricity's behaviors using the numbers 1 and 0. You must know what a physical element is doing and be able to give a standard description of that in order to keep track of what happens as you change the factors that you think contribute to the control of the element/Substance/Subatomic Particle, the numbers help you to rationalize what happening with particles that you are otherwise unable to see.

So Binary is a visual representation which uses numbers to describe the activity of electricity in piece of hardware. Either their is a flow of charge or their is no flow of charge. The charge is converted to D/C from AC and the activity of the charged particles is stabilized by the clock, the speed of the energy flowing through the circuit, the resistance (which results in a loss of energy and the creation of heat, and the amount of time before a piece of a circuit is de-energized all comes together allowing us to understand and use our understanding of these phenomenon to come up with a unit of measure to standardize the amount of energy flowing per a unit of time. Which further assists us as we try to harness the energy. The rest of the computers components are like a really advanced system of Transistors, capacitors, and resistors that manipulate the charge that flows to and through those components, the components trap the charge temporarily or slow it down until the component reaches a certain energy level and then an arc flash occurs causing the stored energy to energize another component or area of the system with a specific (highly controlled) amount of energy. each digit of binary is a representation of a bit, a bit is an explanation of electrical behavior in a certain electrical component(known from here forward as signal), a byte is 8 pieces of electrical signal. It is generally agreed that you need at least 8 bits of electrical signal in order for the computer to make orderly and practical use of the electricity flowing into it.

In other words electricity is just reduced and energy stabilized in its behavior and then split up and directed through a series of components which need electricity to operate and then the newly energized components do a thing that a human desires for it to do.

SW is not just the SW language it is written in, as say jotted down on a piece of paper. SW takes on physical form as well. At some point the software at the conceptual level crosses over into software at the physical level, and that occurs when a programmer starts typing code into a keyboard in whatever SW language he/she is working. From the moment a keystroke is tapped, it's electrons all the way down...this is the point then, where the interface occurs, in that from the moment a keyboard is tapped the whole business becomes the manipulation of electrons -- as complex, sophisticated and ingenious an endeavor as that may be. Thinking in terms of binary 0's and 1's is just a metaphor for high & low voltage, already a physical manifestation beyond the keystroke. When you type the letter I as the first letter of IF...THEN into a keyboard, the voltages corresponding to 01001001 are placed in the first 8 slots of the registry, through electrical impulses prompted by your physically tapping the I key. From here on out it's electronics.

Related