Tuesday, March 3, 2009

Microprocessor Instructions

Even the incredibly simple microprocessor shown in the previous example will have a fairly large set of instructions that it can perform. The collection of instructions is implemented as bit patterns, each one of which has a different meaning when loaded into the instruction register. Humans are not particularly good at remembering bit patterns, so a set of short words are defined to represent the different bit patterns. This collection of words is called the assembly language of the processor. An assembler can translate the words into their bit patterns very easily, and then the output of the assembler is placed in memory for the microprocessor to execute.

Here's the set of assembly language instructions that the designer might create for the simple microprocessor in our example:

  • LOADA mem - Load register A from memory address
  • LOADB mem - Load register B from memory address
  • CONB con - Load a constant value into register B
  • SAVEB mem - Save register B to memory address
  • SAVEC mem - Save register C to memory address
  • ADD - Add A and B and store the result in C
  • SUB - Subtract A and B and store the result in C
  • MUL - Multiply A and B and store the result in C
  • DIV - Divide A and B and store the result in C
  • COM - Compare A and B and store the result in test
  • JUMP addr - Jump to an address
  • JEQ addr - Jump, if equal, to address
  • JNEQ addr - Jump, if not equal, to address
  • JG addr - Jump, if greater than, to address
  • JGE addr - Jump, if greater than or equal, to address
  • JL addr - Jump, if less than, to address
  • JLE addr - Jump, if less than or equal, to address
  • STOP - Stop execution

No comments:

Post a Comment