What do low level logic gates, multiplexers, and decoders correlate to in high level languages?

375 Views Asked by At

What are the purposes of/when are logic gates, multiplexers, and decoders used at the machine level?

For example, I would guess that logic gates are probably used at the machine level when a programmer uses an if statement in a high level language.

But what about multiplexers and decoders? What kinds of statements or programming concepts can you make in a language like Java that would translate to a multiplexer or decoder at the machine level?

If you just put a multiplexer down in front of me and give me some inputs I can tell you what the output will be, I understand the concept as a completely standalone thing. I'm interested in trying to put some context of these new low level/machine language concepts that I'm learning using the high level language concepts I'm familiar with.

1

There are 1 best solutions below

0
On

Digital electronic building blocks such as logic gates, multiplexers, and decoders can be used to implement an instruction set architecture, which in turn can implement constructs in higher level programming languages. Learning the intervening levels of abstraction provides a deep understanding of how the needs of one level are met by the design of another level.

Clearly a comprehensive answer explaining each intervening level is beyond the scope of a single SO answer -- college courses and careers are dedicated to such topics. However, here is a sketch of the intervening levels between Java and digital logic constructs:

  1. A Java program is compiled to Java bytecode.
  2. Java bytecode is interpreted by a Java virtual machine (JVM).
  3. A JVM is itself a program that was compiled into an instruction set.
  4. An instruction set is interpreted by a microarchitecture.
  5. A microarchitecture is implemented using digital logic constructs.

It is true that both an "if" statement in Java and a gate in digital logic deal with boolean values. It is also true that the digital logic level supports the execution of programs written in high level languages such as Java. However, the correspondence is indirect through multiple intervening levels of abstraction. Understanding those intervening levels is important to understanding the true nature of the correspondence.