Compilers and Logic gates

  • #1

Main Question or Discussion Point

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?
 

Answers and Replies

  • #2
uart
Science Advisor
2,776
9
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
MATLABdude
Science Advisor
1,655
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
309
1
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
MATLABdude
Science Advisor
1,655
4
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
phinds
Science Advisor
Insights Author
Gold Member
2019 Award
16,176
6,176
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
309
1
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
phinds
Science Advisor
Insights Author
Gold Member
2019 Award
16,176
6,176
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.
 

Related Threads on Compilers and Logic gates

  • Last Post
Replies
3
Views
703
  • Last Post
Replies
13
Views
3K
  • Last Post
Replies
4
Views
778
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
2
Views
5K
  • Last Post
Replies
10
Views
587
Replies
9
Views
1K
  • Last Post
Replies
1
Views
946
  • Last Post
2
Replies
25
Views
15K
  • Last Post
Replies
3
Views
2K
Top