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

In summary: Instead, they were written as a front-end to a compiler that was itself written in a higher level language.
  • #1
pairofstrings
411
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
  • #2
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.
 
  • #3
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.
 
  • #4
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:
  • #5
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:
 
  • #6
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:
 
  • #7
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.
 
  • #8
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.
 
  • #9
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.
 

1. What is a compiler?

A compiler is a type of software that converts human-readable code written in a programming language into a machine-readable form, typically in the form of binary code. This allows the computer to understand and execute the instructions given by the programmer.

2. What is the purpose of a compiler?

The main purpose of a compiler is to translate high-level programming languages, such as Java or C++, into low-level machine code that can be directly executed by a computer's processor. This process makes it easier for programmers to write complex programs without having to worry about the details of the underlying hardware.

3. What are logic gates?

Logic gates are basic building blocks of digital circuits that perform logical operations based on input signals and produce an output signal. They are used to design complex digital circuits, such as processors, memory units, and other electronic devices.

4. What are the different types of logic gates?

There are several types of logic gates, including AND, OR, NOT, NAND, NOR, and XOR gates. Each gate has a specific function and can be combined to perform more complex logical operations.

5. How do compilers and logic gates work together?

Compilers use logic gates to translate high-level programming languages into machine code. The compiler generates a series of logic gate circuits that represent the program's instructions, which are then converted into binary code. This binary code is then executed by the computer's processor, which uses logic gates to perform the necessary operations and produce the desired output.

Similar threads

  • Electrical Engineering
Replies
5
Views
5K
  • Electrical Engineering
Replies
1
Views
1K
Replies
14
Views
2K
  • Electrical Engineering
Replies
16
Views
2K
Replies
6
Views
1K
  • Electrical Engineering
Replies
1
Views
1K
  • Electrical Engineering
Replies
10
Views
3K
  • Programming and Computer Science
Replies
29
Views
2K
  • Electrical Engineering
Replies
23
Views
4K
Replies
6
Views
2K
Back
Top