The document discusses two approaches to controlling the operations of a CPU - hardwired control and microprogrammed control. Hardwired control directly connects instruction fields to control lines through digital logic circuits, allowing for fast execution but making the instruction set difficult to modify. Microprogrammed control stores control variables as microinstructions in memory, allowing the control sequence to be changed by modifying the microprogram rather than hardware. The key components of a microprogrammed control unit are a control memory storing microinstructions, an address register, and a next address generator that sequences through microinstructions.
The document discusses two approaches to controlling the operations of a CPU - hardwired control and microprogrammed control. Hardwired control directly connects instruction fields to control lines through digital logic circuits, allowing for fast execution but making the instruction set difficult to modify. Microprogrammed control stores control variables as microinstructions in memory, allowing the control sequence to be changed by modifying the microprogram rather than hardware. The key components of a microprogrammed control unit are a control memory storing microinstructions, an address register, and a next address generator that sequences through microinstructions.
9 2. Hardwired and Microprogrammed Control For each instruction, the control unit causes the CPU to execute a sequence of steps correctly. In reality, there must be control signals to assert lines on various digital components to make things happen. For example, when we perform an Add instruction in assembly language, we assume the addition takes place because the control signals for the ALU are set to "add" and the result is put into the AC. The ALU has various control lines that determine which operation to perform. The question we need to answer is, "How do these control lines actually become asserted?" We can take one of two approaches to ensure control lines are set properly. The first approach is to physically connect all of the control lines to the actual machine instructions. The instructions are divided up into fields, and different bits in the instruction are combined through various digital logic components to drive the control lines. This is called hardwired control, and is illustrated in figure (1)
Figure (1) Hardwired Control Organization Instruction Decoder
Control Unit (Combinational Circuit) Instruction Register Input from system bus (such as interrupts) Input from status/ flag register Control Signals (These signals go to register) The bus and the ALU Input from clock Computer Architecture 3rd Class Eng. Salam Hassan Mhesn
10 The control unit is implemented using hardware (for example: NAND gates, flip-flops, and counters).We need a special digital circuit that uses , as inputs, the bits from the Opcode field in our instructions, bits from the flag (or status) register, signals from the bus, and signals from the clock. It should produce, as outputs, the control signals to drive the various components in the computer. The advantage of hardwired control is that is very fast. The disadvantage is that the instruction set and the control logic are directly tied together by special circuits that are complex and difficult to design or modify. If someone designs a hardwired computer and later decides to extend the instruction set, the physical components in the computer must be changed. This is prohibitively expensive, because not only must new chips be fabricated but also the old ones must be located and replaced. Microprogramming is a second alternative for designing control unit of digital computer (uses software for control). A control unit whose binary control variables are stored in memory is called a microprogrammed control unit. The control variables at any given time can be represented by a string of 1's and 0's called a control word (which can be programmed to perform various operations on the component of the system). Each word in control memory contains within it a microinstruction. The microinstruction specifies one or more microoperatiotins for the system. A sequence of microinstructions constitutes a microprogram. A memory that is part of a control unit is referred to as a control memory. A more advanced development known as dynamic microprogramming permits a microprogram to be loaded initially from an auxiliary memory such as a magnetic disk. Control units that use dynamic microprogramming employ a writable control memory; this type of memory can be used for writing (to change the microprogram) but is used mostly for reading. The general configuration of a microprogrammed control unit is demonstrated in the block diagram of Figure (2). The control memory is assumed to be a ROM, within which all control information is permanently stored.
Figure (2) Microprogrammed Control Organization Next-Address Generator "Sequencer" Control data Register Control Memory "ROM" Control Address Register Control Word External input Computer Architecture 3rd Class Eng. Salam Hassan Mhesn
11 The control memory address register specifies the address of the microinstruction and the control data register holds the microinstruction read from memory the microinstruction contains a control word that specifies one or more microoperations for the data processor. Once these operations are executed, the control must determine the next address. The location of the next microinstruction may be the one next in sequence, or it may be locate somewhere else in the control memory. For this reason it is necessary to use some bits of the present microinstruction to control the generation of the address of the next microinstruction. The next address may also be a function of external input conditions. While the microoperations are being executed, the next address is computed in the next address generator circuit and then transferred into the control address register to read the next microinstruction. The next address generator is sometimes called a microprogram sequencer, as it determines the address sequence that is read from control memory, the address of the next microinstruction can be specified several ways, depending on the sequencer inputs. Typical functions of a microprogram sequencer are incrementing the control address register by one, loading into the control address register an address from control memory, transferring an external address or loading an initial address to start the control operations. The main advantages of the microprogrammed control are the fact that once the hardware configuration is established; there should be no need for further hardware or wiring changes. If we want to establish are different control sequence for the system, all we need to do is specify different set microinstructions for control memory. The hardware configuration should not be changed for different operations; the only thing that must be changed is the microprogram residing in control memory. Microinstructions are stored in control memory in groups, with each group specifying routine. Each computer instruction has microprogram routine in control memory to generate the microoperations that execute the instruction. The hardware that controls the address sequencing of the control memory must be capable of sequencing the microinstructions within a routine and be to branch from one routine to another. The address sequencing capabilities required in a control memory are:
1. Incrementing of the control address register. 2. Unconditional branch or conditional branch, depending on status bit conditions. 3. A mapping process from the bits of the instruction to an address for control memory. 4. A facility for subroutine call and return. Figure (3) shows a block diagram of control memory and the associated hardware needed for selecting the next microinstruction address. The microinstruction in control memory contains a set of bits to initiate microoperations in computer registers and other bits to specify the method by which the address is obtained. The diagram shows four different paths from which the control address register (CAR) receives the address. The incrementer increments the content of the control address register by one, to select the next microinstruction in sequence. Branching is achieved by specifying the branch address in one of the fields of the microinstruction. Conditional branching is obtained by using part of the microinstruction to select a specific status bit in order to determine its Computer Architecture 3rd Class Eng. Salam Hassan Mhesn
12 condition. An external address is transferred into control memory via a mapping logic circuit. The return address for a subroutine is stored in a special register whose value is then used when the microprogram wishes to return from the subroutine.
Figure (3) Selection address for control memory
Instruction Code Mapping logic Control Address Register (CAR) Subroutine register (SBR) Branch Logic Incrementer Control Memory Status bits Clock Branch Address Microoperations Select a Status bit Multiplexer