Go to  ECE495  Experiment  |    |     |     |      |    Part List    |  Lab Manuals  |   ECE Lab home

 

ECE 495: Computer Engineering Design Laboratory

Experiment 2

Introduction to Microsequencer Design

Objectives

  The objective of this experiment is to learn the basic operating principles of microsequencers.

Preparation

  Review Chapter 7 of Computer Systems Organization & Architecture by John Carpinelli.

Equipment Needed

References

John D. Carpinelli, Computer Systems Organization & Architecture, Addison Wesley, 2001.

Morris Mano, Computer Engineering Hardware Design, Addison Wesley.

Background

Microsequencers

The control unit is responsible for coordinating actions within the CPU. The control unit decodes the instruction and issue a set of control signals that result in the instruction’s execution. These control signals cause data to be routed correctly within the CPU, generate correct external control signals, such as RD and WR in the 8085, and cause the ALU to perform the correct operation on the data.

There are two methods used to generate these control signals. Hardwired control units implement the control signals using combinational logic. The inputs to this control logic are generated by the control unit and also taken from the instruction opcode. Microprogrammed control units, or microsequencers, are another approach. In this method, control signals are the output of the control memory, the control unit generates the control signals by stepping through the correct sequence of control memory locations. Each word of control memory is called a microinstruction. The sequence is initiated based on the instruction to be executed; the next microinstruction is generated from the current microinstruction and external conditions.

            The general configuration is shown in Figure 2.1. The sequence of operations is as follows:

1.      The address of the next microinstruction to be executed is loaded into the address register. This becomes the input address to the control memory.

2.      The control memory decodes its input address and puts out the microinstruction. This microinstruction has two functions. First, it makes available the control signals to sequence execution of the instruction. Note that the microsequencer does not actually execute the instruction; it generates control signals which cause other hardware within the CPU (such as the ALU) to execute the instruction. Second, it generates address and condition signals.

3.      Based on the condition signals, the multiplexer generates the address of the next microinstruction. Possible next addresses are discussed later in this experiment.

Address multiplexer and mapping logic

The address multiplexer is used to select one out of a number of possible addresses for the next microinstruction to be executed. There are four standard possibilities.

INCR The next address in control memory. This is often used to execute a series of microinstructions that occupy consecutive locations in control memory.

ADDR The address specified by control memory. This is used to specify jumps within control memory. This is typically used to jump to the opcode fetch routine when finished executing the instruction. It is also combined with INCR to perform conditional jumps within the microcode, i.e. if the jump is taken, the next microinstruction address is taken from ADDR, otherwise it is taken from INCR.

SBR The address stored in the micro-subroutine register. Just as high-level and assembly language programs may have subroutines which can be invoked from different locations within the program, microcode may also use micro-subroutines. These micro-subroutines usually perform functions, such as indirect addressing, that are common to many instructions. The micro-subroutine register contains the return address of the micro-subroutine. The register is loaded when a micro-call is executed and is read when a micro-return is reached. If nested micro-subroutines are used in the system, the register must be replaced with a hardware stack.  



Figure 2.1: General microsequencer configuration.  

 

MAP The address based on the instruction to be executed. The mapping logic reads the opcode of the instruction to be executed and generates the micro-address of the first microinstruction used to execute the instruction. The logic used to generate the output depends on the placement of microcode within the control memory. The address to be used is determined by the branch logic. This is combinatorial logic that selects the next address based on the current microinstruction and external status bits. The branch logic also generates the signal used to load SBR.

In the first part of this experiment, INCR and SBR are not used; only ADDR and MAP supply the next micro-address. Furthermore, all branches are unconditional, so the branch logic defaults to a single control signal derived from the control memory.

In the second part, SBR is added as a possible source for the next address. When designing the additional hardware to incorporate SBR, keep in mind that the next address must still be generated in only one clock cycle. This can be accomplished by using multiplexers without latched outputs, by using master-slave clocking signals on the multiplexers, or any other method you choose.

Micro-address register

This is a single register which holds the address of the microinstruction. The clock used to load the register is actually the system clock. In this experiment, the register is incorporated within the multiplexer chip. Instead of the oscillator normally used as the system clock, you will use a DEBOUNCED push button switch to allow you to single step through the microcode.

Control memory

The control memory is typically a small ROM. For this experiment, you will use a 2816 EEPROM. You will enter the microcode using the DC assembler directive. Ground all unused address lines.

Other hardware

For this experiment, two additional pieces of hardware are needed. The instruction register, which normally holds the opcode for input to the mapping logic, will be replaced by two DIP switches. This is done to simplify hardware and facilitate debugging. Also, three LEDs with current-limiting resistors will be connected to signals Z1, Z2 and Z3 of the control memory. Since this experiment does not actually use the other components of the CPU, the LEDs will be used to monitor the control signals. Note that all LEDs must be driven by active low logic.

Control memory format

All eight outputs of the control memory are used in this experiment. The format is as follows.

 

Bit

Function

D7

   Address Multiplexer Control

 

      0 = Address from EPROM, 1 = Address from MAP

D6

   Control for LED Z1, active low

D5

   Control for LED Z2, active low

D4

   Control for LED Z3, active low

D3-0

   Address from EEPROM, ADDR

There are three instructions this control unit can execute. They are summarized below.

Instruction

Opcode

LEDs lit during

   

T1

T2

T3

T4

Opcode fetch  

Z1

Z2

Z3

 

I1

01

Z2

Z3

Z1

Z1, Z2, Z3

I2

10

Z1, Z3

Z1, Z2

Z2, Z3

Z1, Z2, Z3

I3

11

Z1, Z2, Z3

Z1, Z2

Z1

None

Each of these instructions must have its own microcode routine.

A fourth micro-subroutine is needed to implement the opcode fetch. This takes four microinstructions. The first three microinstructions would normally sequence the fetching of the opcode from memory; since this is not done here, use null code to step through these microcode locations. The fourth microinstruction must map to the correct micro-subroutine. If the opcode fetch reads an opcode of 00, the microcode should map back to the opcode fetch routine.

Prelab Assignments

1.      Design the microcode layout, i.e. which instructions reside in which EPROM locations.

2.      Based on your microcode layout, design the mapping logic.

3.      Based on the microcode specifications given in this experiment and the microcode layout, write the microcode.

4.      Prepare a separate design which has only two instructions, I1 and I2 from the previous example. Each instruction should call a micro-subroutine at the end of T3; this micro-subroutine is identical to I3. The design should include the microcode and the hardware necessary to implement the micro-subroutine register. Note that one additional address selection bit is required. In order to keep the design to eight bits, do not include output Z1 in this design. Just as opcode 00 branches back to the opcode fetch routine, opcode 11 should also branch back to the opcode fetch.

Lab Assignments

1.      Burn the microcode into the 2816 EEPROM.

2.      Wire and test the circuit. Use the debounced push button switch for the system clock, and the toggle switches for the instruction register.

3.      Repeat this procedure for the design which incorporates micro-subroutines.

  Go to  ECE495  Experiment  |    |     |     |      |    Part List    |  Lab Manuals  |   ECE Lab home