instructions and procedures

​​​​​​

1. Concept review

  • Instructions: Code (machine code) that instructs the computer what to do. Multiple instructions together form a program. Such as math instructions and memory instructions.
  • Note: Instructions and data are stored in the same memory.
  • Instruction set: A table recording the instruction name, usage, opcode, and required number of RAM address bits.

 

program

2. Execution of instructions

  • in principle:
  • Each RAM address stores 0 or 1 data.
  • A specific combination of numbers is represented as a command, otherwise it is represented as a value.
  • LOAD instruction:
  • The computer will read the instructions/data recorded in the RAM in order of address.
  • After the computer receives the instruction, such as LOAD_A, it transmits the data to register A through the data line.

 

  • ADD instruction:
  • The ADD BA instruction tells the ALU to add the number in register B and register A and store it in register A.
  • JUMP instruction:
  • When encountering a JUMP instruction, the program will jump to the corresponding RAM address to read data.
  • The JUMP instruction can jump conditionally (such as JUMP-negative) or jump unconditionally.

3. Computer instruction length

Since early computers only had 8 bits per word and instructions only occupied 4 bits, this meant that there could only be 16 instructions, which was far from enough.

Modern computers have two ways to solve the problem of insufficient instructions:

The most straightforward is to use more bits to represent instructions, such as 32-bit or 64-bit.

Use "variable instruction length" to make different instructions have different lengths to save as many bits as possible.

Assuming that 1 word is 16 bits, if an instruction does not require memory operation, the number of addressing bits can be omitted.

In this case, some instructions need to be followed by data, such as JUMP, which is called an immediate value.

Article from: [Computer Science Crash Course] Notes

Guess you like

Origin blog.csdn.net/hellow_xqs/article/details/131122304