2

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.

CptSupermrkt
  • 6,844
  • 12
  • 56
  • 87
  • Between the code and the processor architecture, lies the bytecode optimization – Leo Feb 08 '14 at 22:58
  • You can get started by reading about ALUs, OpCodes and Buses. Don't rush to guesses. Between processor architecture and code you will encounter many levels of abstraction. You can find isomorphisms with logic concepts but let them remain such. The logic of a complex `if` statement does not translate directly to equivalent circuitry. You have circuits that emulate other circuits but only on a higher level. – digenishjkl Feb 11 '14 at 10:41

1 Answers1

2

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.

kjhughes
  • 106,133
  • 27
  • 181
  • 240