A 32-bit Processor: Sequencing and Output Logic

Similar documents
Reference Sheet for C112 Hardware

REGISTER TRANSFER LANGUAGE

Let s put together a Manual Processor

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

The Manual Processor. Lecture 17. Registers: The Multiplexers: The Arithmetic and Logic Unit. The Shifter (This is just a special multiplexer)

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

EE 3170 Microcontroller Applications

COSC 243. Computer Architecture 1. COSC 243 (Computer Architecture) Lecture 6 - Computer Architecture 1 1

CPU Design John D. Carpinelli, All Rights Reserved 1

IA Digital Electronics - Supervision I

Page 521 CPSC 5155 Last Revised July 9, 2011 Copyright 2011 by Edward L. Bosworth, Ph.D. All rights reserved.

Chapter 16. Control Unit Operation. Yonsei University

The CPU and Memory. How does a computer work? How does a computer interact with data? How are instructions performed? Recall schematic diagram:

ASSIGNMENT ECE514 (COMPUTER ORGANIZATION) ASSIGNMENT NO. 3

(Refer Slide Time: 1:43)

Module 5 - CPU Design

Lecture 11: Control Unit and Instruction Encoding

There are four registers involved in the fetch cycle: MAR, MBR, PC, and IR.

Chapter 3 : Control Unit

Digital System Design Using Verilog. - Processing Unit Design

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS II Fall 1999

Class Notes. Dr.C.N.Zhang. Department of Computer Science. University of Regina. Regina, SK, Canada, S4S 0A2

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

Microcomputer Architecture and Programming

Computer Architecture

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Blog -

STRUCTURE OF DESKTOP COMPUTERS

Parallel logic circuits

Register Transfer and Micro-operations

Week 6: Processor Components

Computer Architecture Programming the Basic Computer

Chapter 5. Computer Architecture Organization and Design. Computer System Architecture Database Lab, SANGJI University

Data paths for MIPS instructions

Single cycle MIPS data path without Forwarding, Control, or Hazard Unit

CHAPTER SIX BASIC COMPUTER ORGANIZATION AND DESIGN

PROBLEMS. 7.1 Why is the Wait-for-Memory-Function-Completed step needed when reading from or writing to the main memory?

Major and Minor States

Design of Decode, Control and Associated Datapath Units

Faculty of Engineering Systems & Biomedical Dept. First Year Cairo University Sheet 6 Computer I

For Example: P: LOAD 5 R0. The command given here is used to load a data 5 to the register R0.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Data Paths and Microprogramming

Multicycle conclusion

LECTURE 4. Logic Design

CSE 141L Computer Architecture Lab Fall Lecture 3

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 3, 2015

Implementing the Control. Simple Questions

CHAPTER 5 : Introduction to Intel 8085 Microprocessor Hardware BENG 2223 MICROPROCESSOR TECHNOLOGY

Arithmetic-logic units

COS 140: Foundations of Computer Science

COMPUTER ORGANIZATION & ARCHITECTURE

Combinational Circuits

CS 31: Intro to Systems Digital Logic. Kevin Webb Swarthmore College February 2, 2016

LC3DataPath ECE2893. Lecture 9a. ECE2893 LC3DataPath Spring / 14

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1.

Wednesday, September 13, Chapter 4

The von Neumann Architecture. IT 3123 Hardware and Software Concepts. The Instruction Cycle. Registers. LMC Executes a Store.

UNIT - V MEMORY P.VIDYA SAGAR ( ASSOCIATE PROFESSOR) Department of Electronics and Communication Engineering, VBIT

Department of Computer Science and Engineering CS6303-COMPUTER ARCHITECTURE UNIT-I OVERVIEW AND INSTRUCTIONS PART A

Materials: 1. Projectable Version of Diagrams 2. MIPS Simulation 3. Code for Lab 5 - part 1 to demonstrate using microprogramming

Chapter 4 The Von Neumann Model

REGISTER TRANSFER AND MICROOPERATIONS

REGISTER TRANSFER AND MICROOPERATIONS

Topics. Computer Organization CS Exam 2 Review. Infix Notation. Reverse Polish Notation (RPN)

Block diagram view. Datapath = functional units + registers

Chapter 4. The Processor

Where Does The Cpu Store The Address Of The

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

Arithmetic Circuits. Design of Digital Circuits 2014 Srdjan Capkun Frank K. Gürkaynak.

ECE 341 Midterm Exam

2. (a) Compare the characteristics of a floppy disk and a hard disk. (b) Discuss in detail memory interleaving. [8+7]

Digital VLSI Testing Prof. Santanu Chattopadhyay Department of Electronics and EC Engineering India Institute of Technology, Kharagpur.

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Basic Processing Unit: Some Fundamental Concepts, Execution of a. Complete Instruction, Multiple Bus Organization, Hard-wired Control,

Introduction to CPU Design

Chapter 4 The Von Neumann Model

CS Computer Architecture

Materials: 1. Projectable Version of Diagrams 2. MIPS Simulation 3. Code for Lab 5 - part 1 to demonstrate using microprogramming

von Neumann Architecture Basic Computer System Early Computers Microprocessor Reading Assignment An Introduction to Computer Architecture

Basic Computer System. von Neumann Architecture. Reading Assignment. An Introduction to Computer Architecture. EEL 4744C: Microprocessor Applications

ECE260: Fundamentals of Computer Engineering

A mathematician has asked us to design a simple digital device that works similarly to a pocket calculator.

Lecture1: introduction. Outline: History overview Central processing unite Register set Special purpose address registers Datapath Control unit

CS 101, Mock Computer Architecture

CS3350B Computer Architecture Winter 2015

Chapter 5: The Processor: Datapath and Control

Computer Architecture 2/26/01 Lecture #

END-TERM EXAMINATION

PROGRAMMABLE LOGIC DEVICES

ASSEMBLY LANGUAGE MACHINE ORGANIZATION

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

Processor Organization and Performance

Combinational and sequential circuits (learned in Chapters 1 and 2) can be used to create simple digital systems.

Chapter 14 Design of the Central Processing Unit

CHAPTER 4: Register Transfer Language and Microoperations

Transcription:

Lecture 18 A 32-bit Processor: Sequencing and Output Logic Hardware Lecture 18 Slide 1

Last lecture we defined the data paths: Hardware Lecture 18 Slide 2

and we specified an instruction set: Instruction Cycle Transfers Path LOAD Rdest, Address E1 MAR MDR Use the mask E2 MDR Memory E3 Rdest MDR No Mask STORE Rdest, Address E1 MAR MDR; A Rdest Via the mask E2 Memory A Shifter (unchanged) JUMP Address E1 PC MDR Via the mask CALL Rdest, Address E1 PC PC+1 E2 Rdest PC E3 PC MDR Via the mask Hardware Lecture 18 Slide 3

The next job is to design the controller The controller s state sequence looks simple enough, but there is a problem: What should the input signal(s) be? Hardware Lecture 18 Slide 4

Designing the controller We need to design a combinatorial circuit with one output C. If C=1 we continue to the next execution state, but if C=0 we have finished and can fetch the next instruction. The inputs will be the instruction op-code bits and the state (F2, E1 etc.). Hardware Lecture 18 Slide 5

Decoders to the Rescue We will approach this design problem functionally making use of decoders (aka de-multiplexers or binary to unary converters). First an 8 to 256 decoder can be used decode the top eight bits of the IR - that is to say the opcode. Only one output line is non zero for any input, and that indicates the instruction that is being executed. Hardware Lecture 18 Slide 6

Instructions with the same state sequence Having decoded the instructions we can now consider them binary variables in our design. Several instructions have the same state sequence (though different arithmetic functions). We can implement simple circuits for these from Boolean equations, eg: ADDS = ADD + SUBTRACT + AND + OR + XOR SHIFTS = ASL + ASR + ROR SKIPS = SKIP + SKIPPOSITIVE + SKIPNEGATIVE Hardware Lecture 18 Slide 7

State assignments We need to make state assignments for the fetch and execute states. Since there are seven states we will need three flip flops. State Q2 Q1 Q0 Minterm F1 0 0 0 Q2 Q1 Q0 F2 0 1 1 Q2 Q1 Q0 F3 0 0 1 Q2 Q1 Q0 E1 0 1 0 Q2 Q1 Q0 E2 1 0 0 Q2 Q1 Q0 E3 1 1 0 Q2 Q1 Q0 E4 1 1 1 Q2 Q1 Q0 Unused 1 0 1 Q2 Q1 Q0 Hardware Lecture 18 Slide 8

Decoders to the rescue (again) Having defined how our states will be represented we can use a 3 to 8 decoder to give us one Boolean variable for each state. We now have hardware lines that tell us both the state and the instruction or group of instructions being executed. We can use all these as Boolean variables in our hardware design! Hardware Lecture 18 Slide 9

The C input to the finite state machine We can now simply write Boolean equations to define when the finite state machine needs to return to fetch a new instruction. For example we can go through our register transfer tables and find all the instructions that need exactly 2 execution cycles, and thus determine that the condition for returning from E2 is: (E2 (RETURN + SHIFTS + MOVE + JUMPINDIRECT)) Hardware Lecture 18 Slide 10

The C input to the finite state machine If we now repeat the process for each state where the state machine can branch back to state F1 we get the following Boolean equation: C = (F3 NOP) (E1 (SKIPS + CLEAR + JUMP)) (E2 (RETURN + SHIFTS + MOVE + JUMPINDIRECT))) (E3 (COMP + DEC + INC + COMPARE + ADDS + STOREINDIRECT + LOAD)) With a bit of care we can implement this directly. Hardware Lecture 18 Slide 11

Designing the state sequencing logic We are now in a position to design the state sequencing logic using the methodology we know and love! C This State Q2 Q1 Q0 Next State D2 D1 D0 0 F1 0 0 0 F2 0 1 1 0 F2 0 1 1 F3 0 0 1 0 F3 0 0 1 F1 0 0 0 0 E1 0 1 0 F1 0 0 0 0 E2 1 0 0 F1 0 0 0 0 E3 1 1 0 F1 0 0 0 0 E4 1 1 1 F1 0 0 0 0 Unused 1 0 1 1 F1 0 0 0 F2 0 1 1 1 F2 0 1 1 F3 0 0 1 1 F3 0 0 1 E1 0 1 0 1 E1 0 1 0 E2 1 0 0 1 E2 1 0 0 E3 1 1 0 1 E3 1 1 0 E4 1 1 1 1 E4 1 1 1 F1 0 0 0 1 Unused 1 0 1 Hardware Lecture 18 Slide 12

Designing the state sequencing logic From the table we get the following Karnaugh maps and minimised equations D2 = C Q2 Q1 + C Q1 Q0 D1 = C Q1 + C Q2 Q0 + Q2 Q1 Q0 D0 = Q2 Q1 Q0 + Q2 Q1 Q0 + C Q2 Q1 Q0 Hardware Lecture 18 Slide 13

Further Simplifications We could apply the XOR simplification rule to give us: D0 = Q2 (Q1 Q0) + C Q2 Q1 Q0 But a better method is to make use of the fact that we have explicitly decoded the states: D2 = C Q2 Q1 + C Q1 Q0 D1 = C Q1 + C Q2 Q0 + F1 D0 = F1 + F2 + C E3 Hardware Lecture 18 Slide 14

The final circuit is simpler than expected! Hardware Lecture 18 Slide 15

Checking the don t cares We did not check whether the circuit will be safe at start up, but it is. We will need to add extra hardware to make the processor do something particular at start up, (and maybe also on a signal from a reset button), so checking the don t cares is not a major issue. Hardware Lecture 18 Slide 16

The Output Logic The output logic is a huge combinatorial design problem. The inputs are the states (F1, F2 etc) and the instruction bits (at least the top 16). The outputs are the clock controls (c0, c1, c2 etc) the arithmetic function select lines (f0, f1, etc) and the multiplexer select lines (s0, s1, etc). In total we have 28 different combinatorial design problems each with 17 inputs - clearly this is beyond the means of the Karnaugh map! Hardware Lecture 18 Slide 17

The Output Logic Up until now we have been using the Moore finite state machine model for our design methodology Recall that the Moore machine had no connection between the inputs and the output logic. This is a safer design methodology since it makes the design more robust against spikes. Hardware Lecture 18 Slide 18

The Output Logic using a Mealey Machine However, for the processor we use the Mealy machine where the inputs also go to the output logic. It is not possible to use the Moore machine since, in order to set up the processor correctly, we need to know which instruction is being executed. Hardware Lecture 18 Slide 19

Clock Gates The clock gate signals c0 to c8 determine which register is loaded at each cycle. The MAR will use this typical gating circuit: Hardware Lecture 18 Slide 20

Defining the CMAR signal We proceed using the Boolean algebra to find the clock signals. Looking through the register transfer tables we find all the places where the MAR is to be set and derive the equation from these. CMAR = F1 + E1 (LOAD + STORE) + E2 (LOADINDIRECT + STOREINDIRECT) Hardware Lecture 18 Slide 21

Don t cares about register contents In practice we only need the MAR to be correct when we are about to load the MDR, so we can give it a clock pulse and load random data at other times without disturbing processor execution. This allows us to simplify the equation for CMAR: CMAR = F1 + E1 + E2 Hardware Lecture 18 Slide 22

The MDR Clock The same procedure is followed for many of the other register clocks. Looking at the MDR, from the register transfers we find: CMDR = F2 + E2 LOAD + E3 LOADINDIRECT The MDR (loaded in F2) is needed in cycle 3 by the CALL instruction, but only LOADINDIRECT uses it after E3, so we can simplify the equation to: CMDR = F2 + E2 LOAD + E3 Hardware Lecture 18 Slide 23

The Programmable Registers R0-R6 The register that changes (Rdest) is recorded in IR bits 22-20 in the present design. If we expanded the design to include 16 registers then bit 23 would be used as well. The condition that the destination register should change is: CRdest = E4 + E3 (LOAD + ADDS + ONE) + E2 (SHIFTS + MOVE + CALL + CALLINDIRECT) + E1 CLEAR SHIFTS=ASL+ASR+ROR, ONE=All one register instructions. Hardware Lecture 18 Slide 24

The Programmable Registers Clocks A decoder is required to determine which register receives a clock pulse. A four bit decoder would be required if we expanded the design to 16 registers Hardware Lecture 18 Slide 25

The Shifter function select bits In this design we are using a simple four function shifter. In most cases where data is routed through the shifter we want No Action so we choose that to be the default. Instruction Function f4 f3 Default No Action 0 0 ASL Arithmetic Shift Left 0 1 ASR Arithmetic Shift Right 1 0 ROR Rotate Right 1 1 From the above table we can determine equations for the function select bits: f4 = ASR+ROR f3 = ASL+ROR Hardware Lecture 18 Slide 26

The ALU function select bits Instruction Function f2 f1 f0 Default Zero 0 0 0 Unused B-A 0 0 1 E3 (SUBTRACT + COMPARE) A-B 0 1 0 E3 (DEC + INC + ADD) AplusB 0 1 1 E3 COMP A B 1 0 0 E3 OR A + B 1 0 1 E3 AND A B 1 1 0 E2 (DEC + COMP) -1 1 1 1 f2 = E3 (COMP+OR+AND) + E2 (COMP+DEC) f1 = E3 (SUBTRACT+COMPARE+DEC+INC+ADD+AND) + E2 (COMP+DEC) f0 =E3 (DEC + INC + ADD + OR) +E2 (COMP+DEC) Hardware Lecture 18 Slide 27

The ALU carry in bit The only place that a 1 carry is required in the current instruction set is INC E3 Its default will be 0 Thus f 5 = INC E3 Note that we connected the carry out bit as an input to the controller. We need to use it in our state sequencing logic for implementing SKIPPOSITIVE and SKIPNEGATIVE instructions. Hardware Lecture 18 Slide 28

The multiplexer selection bits The selection inputs are defined by the following three tables. Selection s2 s1 s0 Selection s6 s5 s4 Selection s3 R0 0 0 0 Shifter 0 0 0 Bus 0 R1 0 0 1 ALU 0 0 1 Incrementer 1 R2 0 1 0 PC 0 1 0 R3 0 1 1 0 1 1 R4 1 0 0 Mask 1 0 0 R5 1 0 1 MDR 1 0 1 R6 1 1 0 1 1 0 Bus 1 1 1 1 1 1 Hardware Lecture 18 Slide 29

The Internal Bus Selector First we need to look at the register transfer tables to determine when the different paths are selected. Using, for example, SPC to mean the condition when the PC is selected we find: SPC = SALU = SMask = SMDR = E2 (CALL + CALLINDIRECT) E1 CLEAR + (E2 + E3) (INC + DEC + COMP) + E3 TWO E1 (LOAD + JUMP + STORE) + E3 CALL E3 LOAD + E4 Where TWO is Boolean variables which becomes 1 when a two register instruction is being executed. The shifter is the default selection. Hardware Lecture 18 Slide 30

The Internal Bus Selection Bits: S6, S5, S4. Using the unallocated selections as don t cares we can write: s4 = s5 = s6 = SALU + SMDR SPC SMask + SMDR Selection s6 s5 s4 Shifter 0 0 0 ALU 0 0 1 PC 0 1 0 0 1 1 Mask 1 0 0 MDR 1 0 1 1 1 0 1 1 1 Hardware Lecture 18 Slide 31

The register selector We can find the conditions defining the register selector from entries in the register transfer tables where A or B are loaded. Sometimes the register to be selected is the source (Rsrc: bits 19-16) sometimes it is the destination (Rdest: bits 23-20), sometimes the internal bus. SRsrc = E1 (INDIRECT + TWO) SBus = E2 ONE SRdest = (SRsrc + SBus) INDIRECT, ONE, and TWO are Boolean variables indicating the instruction type. Hardware Lecture 18 Slide 32

Individual Register Selection The individual selection is done by a multiplexer, with an additional set of gates to impose the Sbus condition. Hardware Lecture 18 Slide 33

The PC selector Last but not least we can get the conditions for the PC to be connected to the internal bus from the register transfer tables: s3 = F1 + E1 (CALL + CALLINDIRECT) Hardware Lecture 18 Slide 34

How did we do? We can now make a wiring list, buy the components from maplin and test it. The components will cost 200-300 (over twice the price of a Intel Core 2. The clock could be set at about 10KHz (A bit faster if we fabricate it on a single chip) So it looks as if we had better consider the Mark 2 version straight away. Hardware Lecture 18 Slide 35

Improvements - The Instruction Formats All instructions are 32 bit, but mostly the bottom 16 bits are empty. This means that we are wasting memory space and doing many more fetch cycles than we need. We could pack up the instructions on byte boundaries and introduce some multiplexing hardware to load the IR correctly. Hardware Lecture 18 Slide 36

Improvements - Arithmetic We have three unused inputs on the multiplexer that selects the internal bus. Additional arithmetic hardware could include: A sixteen bit multiplier (multiply the bottom 16 bits of A and B to obtain a 32 bit result) An incrementer A decrementer Hardware Lecture 18 Slide 37

Improvements - The Data Paths Additional multiplexers could help us to reduce the instruction cycles of many instructions. For instance a multiplexer to select the input to B independently of A would reduce many three cycle instructions to two cycles. A data path from the registers to the internal bus would reduce some instructions by one cycle. This would require an additional input on the bus selector multiplexer, and so might be considered an alternative to the additional arithmetic functions already discussed. Hardware Lecture 18 Slide 38

Improvements - The Combinatorial Circuits This is the hard part. We want to have the minimum time delays in all our combinational logic. This is partly a question of path length, but does require looking at low level transistor models to calculate the time accurately Hardware Lecture 18 Slide 39

And that is the end of the course Hardware Lecture 18 Slide 40

And that is the end of the course - well nearly! Hardware Lecture 18 Slide 41

And that is the end of the course - well nearly! Coursework 2 takes the place of the first lab exercise of next term. You can do it as soon as you like. The instruction sheets are on the course website. Hardware Lecture 18 Slide 42

And that is the end of the course - well nearly! Coursework 2 takes the place of the first lab exercise of next term. You can do it as soon as you like. The instruction sheets are on the course website. There will be a revision session before the exam at the start of the summer term. Watch the course website for the time and venue. Hardware Lecture 18 Slide 43

And that is the end of the course - in the meantime Hardware Lecture 18 Slide 44

And that is the end of the course - in the meantime Have a great Christmas break Hardware Lecture 18 Slide 45