Question How software created and made compatible with hardware

kep55

Distinguished
Dec 31, 2007
876
33
19,040
I asked this question some years back and have yet to get an answer from anyone. It's a two part question on software development.
First, when a new CPU / GPU is designed, how does the internal code get created that enables it to work? Second, when a new program language is created, how does the creator know it will work with certain CPU / GPU / ASIC et cetera? In both cases it's not like building a mechanical device that can be visually inspected at each step to see if the pieces work.
 

kanewolf

Titan
Moderator
New hardware instructions get simulated in software before becoming hardware. Then hardware goes through several iterations of internal validation and rework. There are still sometimes bugs. Just like an Andoid phone can be emulated on an Intel based PC, a new Intel CPU can be emulated on an existing Intel PC. Since Intel and AMD have experience in creating new CPUs or GPUs they have lots of lessons-learned from previous designs.
The second part is because the hardware has published specs of the instructions they support and what each instruction does. This is a compiler or interpreter writer's problem. Taking the new "abstract" language and converting it into the instruction set of the hardware.
 
I asked this question some years back and have yet to get an answer from anyone. It's a two part question on software development.
First, when a new CPU / GPU is designed, how does the internal code get created that enables it to work? Second, when a new program language is created, how does the creator know it will work with certain CPU / GPU / ASIC et cetera? In both cases it's not like building a mechanical device that can be visually inspected at each step to see if the pieces work.

This is what computer science degrees are made for. I know a few people that work with microchip design, both went to school for 6 years at a top engineering school.
One of them in fact worked on what you are asking about, simulating a CPU to test for bugs in software and how the CPU worked before it was actually built.

You can find some basic things in tons of books on programming or hardware design usually in the first few chapters. Just do a web search for "book on designing for blah blah", and see what you find.
 

USAFRet

Titan
Moderator
Best answers I've ever gotten. It still leaves somewhat open how a whole new chip design gets tested, such as going WAY back to Intel's 4004.
The chips aren't made in isolation.
"Here, we made this...you people figure out the code"

The teams work together all the way through the process. From initial whiteboard design to residing in your system.
 

kep55

Distinguished
Dec 31, 2007
876
33
19,040
Thanks for the answers but it still doesn't really get to the crux of the matter. How does the microcode get written so the hardware know what "If X, then Y" means? Whiteboarding, teaming, et cetera are all well and good it don't mean a thing if the chip don't know a thing.
 

USAFRet

Titan
Moderator
Thanks for the answers but it still doesn't really get to the crux of the matter. How does the microcode get written so the hardware know what "If X, then Y" means? Whiteboarding, teaming, et cetera are all well and good it don't mean a thing if the chip don't know a thing.
Layer upon layer of assembly, talking directly to the instruction set built into the chip.

Literally, adjusting the specific registers in the hardware.

18 layers later, you get human readable Excel, and "=sum(A1+B1)"
 
Thanks for the answers but it still doesn't really get to the crux of the matter. How does the microcode get written so the hardware know what "If X, then Y" means? Whiteboarding, teaming, et cetera are all well and good it don't mean a thing if the chip don't know a thing.
CPUs no matter how complex they are are still working on a very simple logic.
It's boolean logic first thought up by a guy born in 1815.
This logic can be implemented by using simple switches and that's basically what transistors are, you can link up several switches so if certain switches on one side are in the on or off position you get a predetermined output (electricity reaching the output point) on the other side,those are called logic gates.

That's what we are still doing with today's CPUs but because of the number of logic gates in modern CPUs switching every switch by hand would be impossible so we use software that does it for us, that software is programmed with all the logic gates and their connections of a specific CPU or in the case of more generic compilers sets of them like sse avx and so on, and we just have to tell it what we want it to do.

If you ever saw a very old sci-fi movie and saw a wall full of blinking lights, that was (supposed to be) a vacuum tube computer, transistors connected in such a way as to do one specific calculation were you had to input the data by hand or in a mechanical way like punched cards