eli5: How do computers process binary digits as logic, from code?

108 views

eli5: How do computers process binary digits as logic, from code?

In: 0

2 Answers

Anonymous 0 Comments

This is ELI5, not ELIEngineer.

1s and 0s run through processors as moving data around regions of memory. So you might move some data between addresses, add two numbers together, etc.

There are low level assembly languages that allow you to move data from one place to another and do these tasks that don’t require you to, personally, use they 1s and 0s as machine code.

Higher level languages give you shortcut syntax to do a bunch of operations at once. Such as incrementing a variable or looping some code, without requiring you to do the low level mathematical operations one at a time or memorizing memory addresses. You can focus more on the logic of the operations rather than some boring moving of data around in memory and cleaning up after yourself or worrying about touching different regions of memory.

Code at the high level is in “easy” to read syntax that allow you to have it compiled into the low level instructions to do an operation that’s requires several steps at levels below it, all the way down to thousands of binary instructions.

Anonymous 0 Comments

Binary logic works, as the name suggests, in two states: on or off. Any code gets translated into machine code that the processor can understand. The processor has so called “logic gates”. They are pieces of hardware that allow electricity into a bit or cut it off so it can’t get any electricity.

It works similar to the light switches in your house. Power can only get to your light when the switch is on. The logic gates have two switches, but only 1 light.

The AND-gate will turn the light on only if both switches are ‘on’. The OR-gate will turn the light on if at least one switch is turned on. There are more types of switches, but they all work this way. Only in a specific state will the light turn on. otherwise electricity cannot reach it.