What is machine code and how do we make the leap from transistors to machine code?

592 views

What is machine code and how do we make the leap from transistors to machine code?

In: Technology

5 Answers

Anonymous 0 Comments

there are multiple intermediate jumps between transistors to machine code. You use transistors to make gates, use gates to build more complex components like a register, an adder, a counter, memory, etc, then you make control logic so that a part of the processor does a specific operation when it reads a specific number from memory. That number in memory is the machine code.

https://nandgame.com/

Anonymous 0 Comments

Machine instructions have 3-ish parts: an operation, a register, and a value/address. The operation is like add, load, store, test, or jump. Each operation pattern of bits causes same register in the computer to change; add changes a data register; jump changes the register that stores the address of the next instruction; …

Transistors in a flip-flop configuration make up each bit of each register. Transistors in and/or logic formulas make the decoder structures that decode the operation. Transistors also make the buffers and controls for busses that connect to memory and I/O.

Anonymous 0 Comments

Transistors are circuit components that take in two voltages and give out a certain voltage based on those inputs. For example, you can have a transistor that outputs a high voltage if both of its inputs are high and a low voltage if not; or you can have one that outputs high if either one or both of the inputs are high and outputs low if both inputs are low.

The operation of those two transistors I described is identical to the Boolean Logic operations AND and OR. A Boolean AND operation evaluates to true if both operands are true, an OR evaluates to true if at least one operand is true. So, in this way we can use transistors to recreate logical operations by equating voltages with truth values, namely by treating a high voltage as meaning “true” and a low voltage as meaning “false”.

As it happens, Boolean operations can be combined to do arithmetic if we equate truth values to numbers (true↔1 and false↔0), and of course we can use that equivalency to relate digits to voltages and use transistors to do arithmetic.

Your CPU is made up of things called arithmetic logic units, which are bundles of transistors set up to do all of the basic mathematical and logic operations a computer needs. This is where machine code comes in. Machine code is essentially a list of operations (represented as numbers called opcodes) and their inputs, and it is what any program eventually gets turned into to run it. When running a program, its machine code gets loaded into RAM, the CPU gets pointed to where the program starts, and then as it runs through the program it will pull each line of machine code and decode the opcode (using Boolean logic) to figure out where in the arithmetic logic unit the operands need to go.

Anonymous 0 Comments

* Transistors are used to build [logic gates](https://en.wikipedia.org/wiki/Logic_gate).
* Logic gates are used to build logic blocks which can be used to build things like:
* adders
* memory cells
* shift registers
* etc
* Those things are combined to make a processor that can understand instructions like “add 5 to 6 and store the result in memory cell 3”.

Anonymous 0 Comments

There’s a part deep in your CPU called the Instruction Decoder Unit. A really simplified version of job is to take apart an instruction and to open and close the various gates in the rest of the CPU in order to make it perform the instructions. The Machine Code of a given processor defines which parts of a instruction do what. You have one segment that is the “opcode” that tells the IDU which instruction it is, and how to interpret the rest of the instruction. Now, the machine code is at the electrical level. Each bit in the machine code is a high or a low value, which open or close specific logic gates in the IDU to make the instructions work. For an addition instruction, the bit pattern for the opcode will make the IDU shift the ALU (arithematic logic unit) into it’s add mode, while the bit patterns in the operands sections will open the buses to the ALU from the registers to allow the date to be read and written from them as needed.