D
D
Denis Karakchiev2014-08-23 21:09:17
Physics
Denis Karakchiev, 2014-08-23 21:09:17

How does the transition from electricity to software take place?

I just really want to understand. In the sense: it's clear that, for example, the current feeds the processor, the processor performs calculations, the processor is pre-programmed for this. But...
How does this transition from electricity to software actually take place? The fact that 1 - there is voltage, 0 - no voltage, again, does not mean anything.
I hope I have explained the question in sufficient detail. Links, poking at tutorials, hitting on the head is also welcome =)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
pi314, 2014-08-24
@Satori_Kanzo

A processor is not just an electronic circuit through which current flows, but a logical or digital circuit. This means that depending on whether or not there is tension in some of its "places", this very "place" is in one of two clearly opposed states. We conditionally accept these states as 1 and 0. Let's call such a "place" a memory cell . Memory - because if nothing else changes in the circuit, then these values ​​\u200b\u200bwill remain there until we turn off the power, and we can always find them out again.
We agreed that with the help of these 1 and 0 we will encode numbers, in the binary system, (and with the help of numbers we will encode everything else - letters, colors, volume level, etc.) Thus,register ), say, 8 such cells (and we remember that for each of them we can say for sure whether it is now 1 or 0; for example, measure the voltage with a voltmeter), we will get 1 byte, in which a number from 0 to 255 like this:
0 - 00000000
1 - 00000001
2 - 00000010
3 - 00000011
etc. up to
255 - 11111111
Next. Because all cells are interconnected in a certain way , then the presence or absence of voltage in one place directly depends on the state of the adjacent place ... something like gears in a watch - if you turn one, one way or another, all the others will turn.
Simplifying somewhat, we can say that three such "certain images" of connecting cells (circuits, or types of logic elements ) are enough to build a processor:
1. If two cells are connected into an inverter circuit , this means that if one of them now has voltage (1), then it is definitely not in the other (0), and vice versa.
2. If three cells are connected in an AND circuit , then in one of them there is voltage (1) only when it is in the other two. And, finally,
3. OR circuit - in one of the three cells there is voltage only if it is in at least one of the two neighboring ones.
All these circuits are built from semiconductors (mainly transistors), and the cells are the places where individual logic elements are connected to each other.
This is where we have already smoothly moved from electricity to logic and numbers, because. using the voltage in different cells, we can uniquely display different numbers, and by combining such elementary logic circuits, we can create the logic of the processor that we need. It remains only to disassemble, but how it all works.
Further, more complex circuits are built from such brick circuits: shift registers, adders, comparators, and, in fact, ALU . It is figuratively called the heart of the processor, but in fact it is its brain. This is how the processor executes the program. Simplifying greatly, its work can be imagined as follows:
There is a certain register in which the operation code is currently located (some encoded number). It determines what exactly the ALU should do now, at this step, for example, add. And there are two more registers in which there are encoded numbers, for example, 2 and 3. These registers are connected to the ALU. In such a situation, the ALU, performing a step, adds the numbers from the data registers (2 and 3) and places the result (5) in the first of them (now there is no longer 2 but 5), and the next instruction in the operation register. So the processor has completed one step of the program and is ready for the next.
Why does it happen this way and not some other way? Because we have combined many different logic elements into a complex circuit with just such logic. They would combine it differently, the logic and behavior of the circuit would be different ... and it would probably be a different processor, with a different architecture, instruction set, etc. And this particular circuit in such a situation will always do just that!
Well, and, finally, it remains to find out, what is this step and what makes the processor perform individual steps?
Makes this whole kitchen spin the clock generator. Here it would be correct to call it a heart. This is such a different circuit, built on a quartz crystal, which does nothing else but gives out 1 then 0 very quickly. the speed at which the processor takes steps. The output of the clock generator is directly connected to the right parts of the entire circuit, and the 1 and 0 issued by it are the very thing that drives the entire circuit, forcing all logic elements to switch along the chain and change the values ​​\u200b\u200bof individual cells according to the logic we set ... and program.
Here, somehow on the fingers you can describe the operation of the processor. Of course, everything inside is orders of magnitude more complicated, there are more circuits and abstractions, millions of transistors, etc., but the general principle of operation of a semiconductor processor is exactly that. And by the way, a semiconductor processor is just one of the ways to build a processor that can run programs. In fact, it can be built from anything. When there were no semiconductors yet, they were built on vacuum tubes, before that - on iron mechanisms driven by motors, or manually, even earlier - from wood ... well, and of course - in the mind and on paper. So, electricity is not even necessary for this at all :)
UPD: A somewhat superficial, but very descriptive article about the circuitry of logical elements on Habré.

S
Sergey, 2014-08-23
@butteff

> The fact that 1 - there is voltage, 0 - there is no voltage, again, does not mean anything.
well fuck now

E
Evgeny Petrov, 2014-08-23
@Petroveg

Why electricity? There are optical computers, for example :)
A couple of centuries ago, the question could sound like this: “How do you get numbers from round circles?”. It's about accounts.

T
throughtheether, 2014-08-23
@throughtheether

A similar question has already been asked . In my opinion, it is more logical to think not about the transition from electricity to the program, but vice versa, from the program to how the processor processes data, that is, very roughly speaking, changes the shape of the "output signal" depending on the shape of the "input signal".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question