How can compilers be used to implement logic gates and IDEs?

  • Thread starter Thread starter pairofstrings
  • Start date Start date
  • Tags Tags
    Logic Logic gates
AI Thread Summary
Compilers are primarily software tools that translate high-level programming languages into machine code, rather than directly implementing logic gates, which are hardware components. Logic functions can be simulated in code, but true logic gates are hardware-based. When starting with a fresh computer without an operating system, the BIOS initializes hardware and allows for software development, often using cross-compiling techniques. Programming simple sequential circuits typically involves designing the circuit for specific functions rather than traditional programming. The evolution of programming languages from machine code to high-level languages has led to modern compilers and IDEs that can even bootstrap themselves.
pairofstrings
Messages
411
Reaction score
7
I want to find out how computer language compilers works from hardware point of view. How logic gates are implemented using compilers? Can anyone suggest me a good reference book or website where I can find this information?
 
Engineering news on Phys.org
pairofstrings said:
I want to find out how computer language compilers works from hardware point of view.
They don't.

Computer language compilers are almost universally software implemented.

How logic gates are implemented using compilers?
They aren't.

The logic functions of logic gates can of course be simulated in computer code (using computer languages and compilers) but the term "logic gate" is usually used for hardware implementations.
 
I am posting this question again because I wasn't clear before in asking my question.
My question is if you are given with a computer in which all hardware components and devices are fixed like in a normal computer then how will you start writing it's software and compile the instructions using any language, let's assume assembly language then how will you compile it. Since the computer you are given with is fresh unit with no Operating systems in it and it just a hardware.
Likewise, if I am given with any sequential circuits how will I program it? Do all the compilers and programming languages are meant to work only on memory devices that is present in the circuit?
I hope I am clear this time with my question.
 
Thankfully, you don't have to. Cross-compiling allows you to compile machine code for one machine on a different machine. 50 years of computer development mean that you no longer have to feed punch cards in real time, program in assembly, or even debug machine code!

Possibly related to your inquiry: the basic, basic pre-operating system in most computers is the BIOS--it initializes the basic hardware and prepares the computer for the operating system to run. And where does the BIOS come from? Nowadays, it's written up on a computer and then burned into the IC at the factory. Once upon a time, it was probably a little more difficult.

Additionally, you don't program (simple) sequential logic circuits: you design the circuit around the function you want it to carry out.
 
Last edited:
MATLABdude said:
Additionally, you don't program (simple) sequential logic circuits: you design the circuit around the function you want it to carry out.
General Array Logic would like it to be known that there are programmable logic devices. :smile:
 
There are plenty of programmable logic devices, and even some that configure themselves on power-up from an EEPROM. That's why I used the (simple) modifier! :smile:
 
While all of the statements in the posts so far are correct, I think they miss the heart of your question. Let me explain it this way.

In the very early days, there were no compilers and no assemblers and all programming was done as string of 1's and 0'. Folks got tired REALLY quickly of writing all those 1's and 0's and the assembler was invented. This was a human readable language with instructions like "add" but there was always what is known as the principle of one to one correspondence. That is, every assembly instruction corresponded exactly to one machine language instruction --- it was just a short-hand for machined code. Assemblers were written in primitive form in machine code and then bootstrapped to more extensive versions.

After a while, folks got really tired of writing hundreds of lines of assembly code to do really simple things, so they decided to drop the principle of one to one correspondence and do a language that was more mathematical in nature with instruction like "a = b + c". These languages were called compilers and they were written in assembly language. Some of them even PRODUCED assembly language which then had to be assembled, others went straight to machine code.

NOW there are, as was mentioned, cross-assemblers and cross-compilers so you never have to write in machine code if you don't want to.
 
The interesting thing about compilers and IDEs is that you can use them to implement themselves.

For example, new versions of Qt C++ are written in Qt C++. Blew my mind when I found out.
 
Jiggy-Ninja said:
The interesting thing about compilers and IDEs is that you can use them to implement themselves.

For example, new versions of Qt C++ are written in Qt C++. Blew my mind when I found out.

Yes, that is called "bootstrapping". The ORIGINAL versions were not written in themselves.
 
Back
Top