Try   HackMD

Introduction to Microprocessor

tags: ee3220 embedded system

What is inside a processor?

A simple processor

Q: Name the units and describe their usage.

A:

  • PC stands for program counter. It stores the address of next line of execution code.
  • ALU stands for Arithmetic Logic Unit. It computes the data from the registers and then send the result back to registers.
  • Registers: buffer. Place of the data located.
  • Control Unit: decodes instruction. control data I/O of the processor. Also control the others units in the processor
  • IR stands for instruction register. Store the current instruction that executing
  • status reg: incidates the result from ALU (C: carry; N: Negative; Z: zero; V: overflow)
  • Memory: EEPROM/SD card/etc. The program and data store in that place

Q: What is bus?

A: the physical connections between components. Maybe a copper track, or just a jumper wire

Instruction execution

Fetch -> Decode -> Execute -> Fetch ->

How the processor execute the written program?

Usually, the processor execute the program just like how we read an article. It does the instructions line by line. But the computer cannot handle multiple instructions at a time, it process the current instruction, then store/send the result if necessary.

So how the processor read a instruction (Instruction Fetch)?

The value of address in PC(program counter) is send to the data bus. The control unit(CU) issues read signal to the memory. Memory places the corresponding data to data bus. The data is the instruction, and it will be loaded into the Instruction Register(IR).

What would be done after fetch the instruction?

Of course, if the CPU just read the instruction, it is just copying from one place to another. Therefore, the CU decodes the message in the instruction and then issues control signals to ALU and other internal logic circuit. After that, the address in PC updates so the PC points to the next instruction*.

So the processor can do what I want now?

Not exactly. Since the data may store in the memory but not the internal register, CU needs to issue read signal to the memory if that is the case. Memory places the data to data bus and internal general registers gets the data.

The execution of instruction

The corresponding units perform action. Usually CU is involved(copying data/move the data from one place to another, etc.), sometimes including ALU(adding two or multiple datum). The status registers change/keep their value based on the result of the action.

Is a instruction completed?

Usually not. The result might have to store in the memory, so the CU issues write signal to the memory. The data is store the specified address.

*When the address of PC increment?

Depend on the CPU design.

The Instructions

As we know, processors only know '1' and '0' (Vcc and Ground). All the instructions, no surprisingly, are in binary form. Or in another words, specified patterns of digital signals. There are three types of information in each instruction:

  • action
  • source
  • destination
    Format of instruction

    For engineers, we usually use lookup table to decode/analyse the what the processor doing. Just refer the documentation or datasheet. Use Lecture p.7-8 as an example.

Pipeline

Video explains what all these things are
Non-pipelined processor follow the instructions one by one. That means when the processor is fetching data, it cannot decode/execute the instruction. There is a wasteful of time. To solve the problem, pipelined processors is made.


Every process can work independently in pipelined processors so the processing time can be shortened.
The three processes can work concurrently.
Attention: the advantage is gone if there are branch instructions. It is because the processor have to fetch new address form the memory.

CISC & RISC

Not important at this point. Just remember the summary in the lecture note

Reading material

How Microprocessors Work?
Instruction pipeline