eli5- How does coding work on a chip level?

100 viewsEngineeringOther

I’ve always wondered how a program wtitten by a human makes a silicon chip work. The idea that a a chip made from an element responds to a written code to generate outputs is so intriguing to me. So, how does a program make a chip work? Sorry if i sound very naive.

In: Engineering

4 Answers

Anonymous 0 Comments


Your submission has been removed because I have been programmed to think this is a question about computer programming, or specific programming languages, or something similar. These are generally not appropriate for ELI5, and you would get much better results in a subreddit that’s geared towards the specific language you’re asking about, or a general one like /r/programming, /r/programminghelp, etc

If you would like this removal reviewed, please read the [detailed rules](https://www.reddit.com/r/explainlikeimfive/wiki/detailed_rules) first. **If you believe this submission was removed erroneously**, please [use this form](https://old.reddit.com/message/compose?to=%2Fr%2Fexplainlikeimfive&subject=Please%20review%20my%20thread?&message=Link:%20/r/explainlikeimfive/comments/1bev28y/eli5_how_does_coding_work_on_a_chip_level/%0A%0APlease%20answer%20the%20following%203%20questions:%0A%0A1.%20The%20concept%20I%20want%20explained:%0A%0A2.%20List%20the%20search%20terms%20you%20used%20to%20look%20for%20past%20posts%20on%20ELI5:%0A%0A3.%20How%20does%20your%20post%20differ%20from%20your%20recent%20search%20results%20on%20the%20sub:) and we will review your submission. Note that **if you do not fill out the form completely**, your message **will not be reviewed**.

*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/explainlikeimfive) if you have any questions or concerns.*

Anonymous 0 Comments

The source code entered by a programmer goes through a process where it’s translated into machine code – instructions that the CPU understands.

In some languages, the source code is converted into machine code ahead of time via a process called compilation. That machine code is stored as an executable file structured based on the operating system (eg. Portable Executable format for Windows). The program is stored on disk. When the computer receives a particular instruction to load the program, it transfers the machine code from disk to RAM, where it can be accessed by the CPU via electrical signals.

In other languages, the source code is interpreted as machine code at runtime. The program that interprets that code puts the machine code into RAM, and again the CPU accesses it to execute the instructions.

How the CPU gets to the point where it knows to load that data into RAM and/or execute it, is more complicated. Because it’s based upon many layers of abstraction, and following a chain of events like dominos. The CPU is designed to start executing instructions from BIOS/firmware once it’s powered on. From there it eventually loads an operating system, which is just a certain type of program. The OS eventually receives user input to compile a program, store the result to disk, and run it; or load the interpreter form disk, run it, load some source code and execute the required instructions.

Anonymous 0 Comments

This is multiple levels deep.

So first up you have the most basic of all programing.

Logical gates.

These are teeny tiny components the size of some hundresds of atoms at their smallest.

They are arranged such that, for example, if both the inputs are 1 then there is enough current in the system to produce a 1 and if not there isnt enough current and it produces a 0. This is done mainly through the use of very fine tuned resistors.

Next up is microchips.

You can put these gates in a row to make more complex gates and develop very basic functions.

For example there is a specific way to arrange 6 or 7 “AND” (which take input of 1 on both sides to produce a 1) logic gates to make a system that will take 4 inputs and output the value of one of them, selecteded by a 5th and 6th input.

This is what a microchip is

Now full on hardware.

So with these microchips we can repeat the process and arrange them to form for example something that takes in 2 numbers and then adds, subtracts or multiplies them (dividing is super hard actually) based on a 3rd input.

Now binary.

Now that we have a working component, we can feed it predetermined strings of 0 and 1 and it will do what we want.

These strings are MILLIONS of 0 and 1 long so its basically impossible to code in this.


So since 0s and 1s are so hard, chip manufacturers have worked extremely hard to assemble a list of these 0s and 1s that do basic basic stuff like selecting a specific part of the CPUs memory.

Adding 2 values.

Reading a value.

This forms the most basic programming laguange ever, ASSEMBLY.

Were as in other languages you might only need to say “add 1+1” in ASSEMBLY you have to do crazy stuff like

“Select this physical location on the actual CPU”

“Now to that specific location, add the value of this other one”

“Now, read what is the result from the microchip that does addition”

You are telling the PC in almost 0s and 1s what physical wires need to conduct current to do what you want.

This gets converted into ACTUAL 0s and 1s by a program called a “compiler” which was developed by the beautiful people that created ASSEMBLY and who had to suffer through dealing with actual 0s and 1s

High level languages.

And now we arrive at our destination.

High level languages.

These languages are what you normally see people programing in but they are being super sneaky on how they work.

When you finish you project and run your code, what you wrote gets actually turned into Assembly code and then that assembly code is turned into 0s and 1s and those 0s and 1s are fed into the microchip that feeds them into the logic gates that physically conduct the electricity in this huge beautifull extra precise domino effect

Anonymous 0 Comments

Plenty of chips don’t need any programing to work. They are purely hardware, they function because of their architecture, the way the transistors on them are arrayed and connected, and programs use them to process or convert information.

Something like a microprocessor will have onboard programing, either you connect it to a computer to change the program or you can affect it directly, normally by a low computer language like hexadecimal machine code. It works like a miniture computer: takes an input, calls the appropiate parts of it’s stored program to deal with it and generates an output all using circuitry.

The chips are called silicon chips because that’s the main semiconductor used but there are lots of different elements used for doping (making a P or N type semiconductor by adding elements that have extra electrons or holes in a matrix of silicon) or other purposes.