Microprocessor Design
Back To Introduction
Instructions
by
James Adrian
      A microprocessor obtains instructions from system memory through the system data bus. These instructions received by the microprocessor are also called operation codes or op codes. Programs comprised of instructions are written by system programmers and application programmers and stored in system memory before they are executed by the microprocessor.

      The microprocessor specifies memory locations by placing an address number on the address bus. This number must be decoded by an address decoder in order to specify a particular address.

      In the fanciful case where system memory is comprised of only two memory locations, the decoder diagramed in the following figure would suffice.


     


      E0 would enable one of the memory locations and E1 would enable the other. They are never in the same state at the same time. If memory locations are accessed by an active high signal, only one enable signal is high at any given time. This is true of decoders of any size. Here is a decoder that enables one of four possible locations:


     


      If eight locations exist, a decoder that specifies only one of those would need to have a third address signal controlling it and that signal would need to deselect four of the outputs and allow the selection of any of the other four by the other address signals.

     

      The address decoder in the figure above must enable one of four memory modules while Phase 2 is high. It must also disable all four memory modules while Phase 2 is low. This can be accomplished by adding another AND gate to each output and routing Phase 2 into one of the inputs of each of these. On the falling edge of Phase 2, all memory modules are disabled and it is the falling edge of each E (Enable Input) that finalizes what is placed in memory at the end of a write cycle. The falling edge of Phase two terminates a read cycle also, but a read cycle does nothing to the contents of memory.

      The number of memory cells in each memory module can be large because they are each connected to the address bus. The address decoder needs as input the two most significant bits of the address bus to make the choice between the four modules. If the address bus is 32 bits wide, each of the four memories could have 230 memory cells. Each cell could have as many bits as the system data bus.

      Connectivity to peripheral devices such as keyboards, video monitors, pointing devices, speakers, and motor controllers is accomplished by setting aside memory space (ranges of address numbers) for them. For instance, M4 in the diagram could be a collection of peripheral devices, each having their own communication protocol. (Writing a number into a specific address could decide the brightness of a lamp, or the loudness of a speaker.)

      In addition to reading from system memory and writing to system memory, a microprocessor must be able to keep track of which instruction is to be done next after the current one is done. The unit above could accomplish this by using one particular register as a program counter. This is not the uP Counter. Each time an instruction is read from the system address saved in the program counter, that address number needs to be incremented and stored back into the same register (the program counter) before going onto the next instruction in system memory.

      Using a general-purpose register as a program counter takes time that must be spent during the execution of each instruction and also presents other severe limitations. It is never done. A hardware program counter, missing from the diagram above, must be aded. Sometimes, even a second ALU is used as an address ALU.

      A program counter makes it is possible to change the address of the next instruction to any address. If that address is not the next instruction of the program stored in system memory, the change in the address of the next instruction is called a branch. The functional unit above could only produce an unconditional branch because there is no hardware to take into account conditions previously created by the program. For instance, branching because the last ALU calculation produced a zero result would not be possible. There is nothing that detects or saves or uses a zero result.


Contact

      https://www.futurebeacon.com/jamesadrian.htm