DOC PREVIEW
U of I CS 231 - Control units

This preview shows page 1-2-3-25-26-27 out of 27 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 27 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Control unitsDatapath reviewInstruction format reviewBlock diagram of a processorWhere does the program go?Program counterInstruction decoderJumps and branchesThat’s it!The whole processorImplementing the instruction decoderMB, MD, WR and MWEight categories of instructionsGenerating MB, MD, WR, and MWGenerating FSFS for branch instructionsGenerating DA, AA, BADon’t-care conditionsMore about the branch control unitBranch control unit inputs and outputsBranch control unit inputsGenerating PL and JBGenerating BC and ADBranch control unitJumpsBranchesSummaryControl Unit 1Control units•In the last lecture, we introduced the basic structure of a control unit, and translated our assembly instructions into a binary representation.•Today we fill in the last piece of the processor and build a control unit to convert these binary instructions into datapath signals.•At the end of the lecture, we’ll have a complete example processor!Control Unit 2Datapath reviewDRegister fileA BWRDAAABAA BALUGFSVCNZ1 0Mux BMB0 1Mux DMDADRS DATAData RAMOUTMWconstant•Set WR = 1 to write one of the registers.•DA is the register to save to.•AA and BA select the source registers.•MB chooses a register or a constant operand.•FS selects an ALU operation.•MW = 1 to write to memory.•MD selects between the ALU result and the RAM output.•V, C, N and Z are status bits.Control Unit 3Instruction format review•We have three different instruction formats, each 16 bits long with a seven-bit opcode and nine bits for source registers or constants.•The first three bits of the opcode determine the instruction category, while the other four bits indicate the exact instruction.–For ALU/shift instructions, the four bits choose an ALU operation.–For branches, the bits select one of eight branch conditions.–We only support one one load, one store and one jump instruction.15 9 8 6 5 3 2 0OpcodeDestination (DR) orAddress 5-3 (AD)Register A (SA)Register B (SB),Operand (OP), orAddress 2-0 (AD)Control Unit 4Block diagram of a processor•The control unit connects programs with the datapath.–It converts program instructions into control words for the datapath, including signals WR, DA, AA, BA, MB, FS, MW, MD.–It executes program instructions in the correct sequence.–It generates the “constant” input for the datapath.•The datapath also sends information back to the control unit. For instance, the ALU status bits V, C, N, Z can be inspected by branch instructions to alter a program’s control flow.ControlUnitDatapathControl signalsStatus signalsProgramControl Unit 5Where does the program go?•We’ll use a Harvard architecture, which includes two memory units.–An instruction memory holds the program.–A separate data memory is used for computations.–The advantage is that we can read an instruction and load or store data in the same clock cycle.•For simplicity, our diagrams do not show any WR or DATA inputs to the instruction memory. •Caches in modern CPUs often feature a Harvard architecture like this.•However, there is usually a single main memory that holds both program instructions and data, in a Von Neumann architecture.ADRSInstructionRAMOUTADRS DATAData RAMOUTMWControl Unit 6Program counter•A program counter or PC addresses the instruction memory, to keep track of the instruction currently being executed.•On each clock cycle, the counter does one of two things.–If Load = 0, the PC increments, so the next instruction in memory will be executed.–If Load = 1, the PC is updated with Data, which represents some address specified in a jump or branch instruction.ADRSInstructionRAMOUTPCLoad DataControl Unit 7Instruction decoder•The instruction decoder is a combinational circuit that takes a machine language instruction and produces the matching control signals for the datapath.•These signals tell the datapath which registers or memory locations to access, and what ALU operations to perform.(to the datapath)ADRSInstructionRAMOUTPCLoad DataInstruction DecoderDA AA BA MB FS MD WR MWControl Unit 8Jumps and branches•Finally, the branch control unit decides what the PC’s next value should be.–For jumps, the PC should be loaded with the target address specified in the instruction.–For branch instructions, the PC should be loaded with the target address only if the corresponding status bit is true.–For all other instructions, the PC should just increment.ADRSInstructionRAMOUTPCInstruction DecoderDA AA BA MB FS MD WR MWBranchControlVCNZControl Unit 9That’s it!•This is the basic control unit. On each clock cycle:1. An instruction is read from the instruction memory.2. The instruction decoder generates the matching datapath control word.3. Datapath registers are read and sent to the ALU or the data memory.4. ALU or RAM outputs are written back to the register file.5. The PC is incremented, or reloaded for branches and jumps.ADRSInstructionRAMOUTPCInstruction DecoderDA AA BA MB FS MD WR MWBranchControlVCNZControl Unit 10The whole processorDRegister fileA BWRDAAABAA BALUGFSVCNZ1 0Mux BMB0 1Mux DMDADRS DATAData RAMOUTMWconstantADRSInstructionRAMOUTPCInstruction DecoderDA AA BA MB FS MD WR MWBranchControlVCNZControl Unit DatapathControl Unit 11Implementing the instruction decoder•The first thing we’ll look at is how to build the instruction decoder.•The instruction decoder’s input is a 16-bit binary instruction I that comes from the instruction memory.•The decoder’s output is a control word for the datapath. This includes:–WR, DA, AA, BA, and MD signals to control the register file.–FS for the ALU operation.–MW for the data memory write enable.–MB for selecting the second operand.•We’ll see how these signals are generated for each of the three instruction formats.ADRSInstructionRAMOUTInstruction DecoderDA AA BA MB FS MD WR MWControl Unit 12MB, MD, WR and MW•The following table shows the correct signals MB, MD, WR and MW for each of the eight different instruction categories we defined. •As mentioned last time, this is the sense in which these categories contain “similar” instructions.Control signalsI nstruction type MB MD WR MWRegister-f ormat ALU operation 0 0 1 0Register-f ormat shif t operation 0 0 1 0Memory write (f rom registers) 0 X 0 1Memory read (to registers) X 1 1 0I mmediate ALU operation 1 0 1 0I mmediate shif t operation 1 0 1 0Conditional branch X X 0 0J ump X X 0 0Control


View Full Document

U of I CS 231 - Control units

Documents in this Course
Counters

Counters

23 pages

Latches

Latches

22 pages

Lecture

Lecture

33 pages

Lecture

Lecture

16 pages

Lecture

Lecture

4 pages

Datapaths

Datapaths

30 pages

Lecture

Lecture

6 pages

Registers

Registers

17 pages

Datapaths

Datapaths

28 pages

Decoders

Decoders

20 pages

Load more
Download Control units
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Control units and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Control units 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?