Register File, Finite State Machines & Hardware Control Language



Similar documents
Computer organization

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Engr354: Digital Logic Circuits

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

Chapter 2 Logic Gates and Introduction to Computer Architecture

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Admin. ECE 550: Fundamentals of Computer Systems and Engineering. Last time. VHDL: Behavioral vs Structural. Memory Elements

Lecture 10 Sequential Circuit Design Zhuo Feng. Z. Feng MTU EE4800 CMOS Digital IC Design & Analysis 2010

5 Combinatorial Components. 5.0 Full adder. Full subtractor

Topics of Chapter 5 Sequential Machines. Memory elements. Memory element terminology. Clock terminology

Lecture 10: Sequential Circuits

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Design: a mod-8 Counter

Let s put together a Manual Processor

Lecture 8: Synchronous Digital Systems

Lecture 11: Sequential Circuit Design

CHAPTER 11 LATCHES AND FLIP-FLOPS

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

CHAPTER 3 Boolean Algebra and Digital Logic

Lecture-3 MEMORY: Development of Memory:

EE360: Digital Design I Course Syllabus

More Verilog. 8-bit Register with Synchronous Reset. Shift Register Example. N-bit Register with Asynchronous Reset.

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Sequential Circuits. Combinational Circuits Outputs depend on the current inputs

University of St. Thomas ENGR Digital Design 4 Credit Course Monday, Wednesday, Friday from 1:35 p.m. to 2:40 p.m. Lecture: Room OWS LL54

Aims and Objectives. E 3.05 Digital System Design. Course Syllabus. Course Syllabus (1) Programmable Logic

Digital Electronics Detailed Outline

16-bit ALU, Register File and Memory Write Interface

Timing Methodologies (cont d) Registers. Typical timing specifications. Synchronous System Model. Short Paths. System Clock Frequency

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Lecture 7: Clocking of VLSI Systems

Microprocessor & Assembly Language

l C-Programming l A real computer language l Data Representation l Everything goes down to bits and bytes l Machine representation Language

CS311 Lecture: Sequential Circuits

路 論 Chapter 15 System-Level Physical Design

7. Latches and Flip-Flops

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Chapter 5. Sequential Logic

IE1204 Digital Design F12: Asynchronous Sequential Circuits (Part 1)

CSE140: Components and Design Techniques for Digital Systems

CSE140: Components and Design Techniques for Digital Systems

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

PROGRAMMABLE LOGIC CONTROLLERS Unit code: A/601/1625 QCF level: 4 Credit value: 15 OUTCOME 3 PART 1

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

Understanding Logic Design

(Refer Slide Time: 00:01:16 min)

ECE410 Design Project Spring 2008 Design and Characterization of a CMOS 8-bit Microprocessor Data Path

BINARY CODED DECIMAL: B.C.D.

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

Traffic Light Controller. Digital Systems Design. Dr. Ted Shaneyfelt

Sequential Circuit Design

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Counters are sequential circuits which "count" through a specific state sequence.

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

Chapter 2 Basic Structure of Computers. Jin-Fu Li Department of Electrical Engineering National Central University Jungli, Taiwan

CpE358/CS381. Switching Theory and Logical Design. Class 4

Serial Communications

So far we have investigated combinational logic for which the output of the logic devices/circuits depends only on the present state of the inputs.

Flip-Flops, Registers, Counters, and a Simple Processor

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

2 : BISTABLES. In this Chapter, you will find out about bistables which are the fundamental building blocks of electronic counting circuits.

DM Segment Decoder/Driver/Latch with Constant Current Source Outputs

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Introduction to CMOS VLSI Design (E158) Lecture 8: Clocking of VLSI Systems

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

Memory unit. 2 k words. n bits per word

CS 61C: Great Ideas in Computer Architecture Finite State Machines. Machine Interpreta4on

Layout of Multiple Cells

Sistemas Digitais I LESI - 2º ano

Registers & Counters

CS:APP Chapter 4 Computer Architecture. Wrap-Up. William J. Taffe Plymouth State University. using the slides of

Instruction Set Architecture. Datapath & Control. Instruction. LC-3 Overview: Memory and Registers. CIT 595 Spring 2010

Getting the Most Out of Synthesis

(1) /30 (2) /30 (3) /40 TOTAL /100

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

Memory Elements. Combinational logic cannot remember

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1

Karnaugh Maps & Combinational Logic Design. ECE 152A Winter 2012

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Systems I: Computer Organization and Architecture

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Fig 3. PLC Relay Output

RAM & ROM Based Digital Design. ECE 152A Winter 2012

Counters and Decoders

Lesson 12 Sequential Circuits: Flip-Flops

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

FINITE STATE MACHINE: PRINCIPLE AND PRACTICE

Module 2. Embedded Processors and Memory. Version 2 EE IIT, Kharagpur 1

Combinational Logic Design Process

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

VHDL GUIDELINES FOR SYNTHESIS

Introduction to Software Testing Chapter 8.1 Building Testing Tools Instrumentation. Chapter 8 Outline

MICROPROCESSOR AND MICROCOMPUTER BASICS

Sequential Logic: Clocks, Registers, etc.

Transcription:

Register File, Finite State Machines & Hardware Control Language Avin R. Lebeck Some slides based on those developed by Gershon Kedem, and by Randy Bryant and ave O Hallaron Compsci 04 Administrivia Homework #4 is up, due Oct 20 Midterm: Median 90 May be late for office hours Thursday Morning May move Monday afternoon office hours Read Sections 4.-4.3 of text Pragmatic Logic (PF on blackboard or through Library) Today Review Logic esign Logisim demo (work through beginnergs guide) Memory: Latches, FlipFlops, Register file Finite State Machines: Sequential Circuits Hardware Control Language (if time) Compsci 04 2

Review: Boolean Functions, Gates and Circuits Circuits are made from a network of gates. (function compositions). Logisim demo a b a XOR(a,b) F = ~a*b + ~b*a a b XOR(a,b) 0 0 0 0 0 0 b F Compsci 04 3 Review: The ALU Overflow = Zero n- n-2 0 ALU control ALU Slice ALU Slice ALU Slice ALU Slice a n- b n- a n-2 b n-2 a b a 0 b 0 Compsci 04 4

Review: Abstraction: The ALU General structure Two operand inputs Control inputs ALU Operation Input A Zero ALU Result We can build circuits for Input B Overflow Multiplication Carry Out ivision They are more complex Compsci 04 5 Review: Set-Reset Latch (Continued) R 0 0 R 0 0 S 0 0 S 0 Time S 0 R 0 0 Compsci 04 6

ata Latch ( Latch) E nable ata E 0 0-0 0 Time oes not affect Output E 0 0 Compsci 04 7 Flip-Flop C latch E latch E On C is transferred to the first latch and the second is stable. On C the output of the first stage is transferred to the second (output), and the first stage is stable. Key: Output changes only on the edge of a clock Logisim demos Compsci 04 8

Register File Register File = the set of locations for register values E.g., 32 32-bit registers How do I build a Register File using Flip-Flops? What other components do I need? Compsci 04 9 Register File Circuit to determine which of 32 registers? Circuit to get just the data from one of 32 registers? Compsci 04 0

Tri-State river The Tri-State driver is like a (one directional) switch: When the Enable is on (E=) it transfers the input to the output. When the Enable is off (E=0) it disconnects the output. E E 0 0-0 Z E Z :- High Impedance Compsci 04 Bus Connections The Bus: Many to many connections. Mutual exclusion: At most one Enable is on! Control must ensure this! Note: Bus sometimes used to denote multiple parallel wires n- n-2 0 E n- E n-2 E E 0 Compsci 04 2

Register Cells on a bus IE E latch OE IE E latch OE IE E latch OE IE E latch OE One can source and sink from any cell on the bus by activating the right controls, IE--input enable, and OE--output enable. Compsci 04 3 ata-in 3-Port Register Cell Bus-C Bus-B Complement Bus-A in E nable OutA OutB Stores one bit of a register Can Read onto Bus-A & Bus-B and Write from Bus-C Simultaneously Compsci 04 4

3-Port Register File EC EA EB Bus-C Bus-B Bit- Bus-A Bus-C Bus-B Bit-0 Bus-A Compsci 04 5 Address ecode Circuit ata-in Bus-C Bus-B Register address: 0 E nabl e OutA Bus-A OutB A0 A EA B0 B EB C0 C EC Compsci 04 6

Register File (Four 4-bit Registers) Reg-3 Reg-2 Reg- Reg-0 A3 B3 C3 A2 B2 C2 A B C A0 B0 C0 A-En Add-A Add-A0 B -En Add-B Add-B 0 C -En Add-C Add-C 0 Compsci 04 7 igital Logic Summary Given Boolean function, generate a circuit to realize the function. Constructed circuits that can add and subtract. The ALU: a circuit that can add, subtract, detect overflow, compare, and do bit-wise operations (AN, OR, NOT) Shifter Memory Elements: SR-Latch, Latch, Flip-Flop Tri-state drivers & Bus Communication vs. MUX Register Files Control Signals modify what circuit does with inputs ALU, Shift, Register Read/Write Next Finite State Machines Hardware Control Language Compsci 04 8

Finite State Machine S ={ s 0, s,... s n- } is a finite set of states. I = { i 0, i,... i k-, } is a finite set of input values. O= { o 0, o,... o m- } is a finite set output values. efinition: A finite state machine is a function F:(S x I )-> (S x O) that gets a sequence of input values I k I, k = 0,,2, and it produces a sequence of output values O k O, k=,2, such that: F(s k, i k ) = (s k+, o k+ ) K=0,, 2, Compsci 04 9 Finite State Machine is: Finite State Machine (Translation to English) A machine with a finite number of possible states. A machine with a finite number of possible Inputs. A machine with a finite number of possible different outputs. At each period (Clock cycle) the machine receives an input and it produces an output. The output is a function of the machine input and current state. After each period the machine changes state. The new state is a function of the input and current state. Compsci 04 20

Example: Traffic Light Controller N C W C C E Traffic light controller at an intersection. C S Compsci 04 2 Finite State Machine (cont.) Example: Traffic lights controller: There are four states: NG: Green light in the north-south direction. NY: Yellow light in the north-south direction. EG: Green light at the East-West direction. EY: Yellow light at the East-West direction. There are four outputs: (G;R): North-South green light, East-West red light (Y;R): North-South yellow light, East West red light (R;Y): North-South red light, East-West yellow light (R;G): North-South red light, East-West green light There are four inputs: (c, c): Car at the North-South, Car at East-West (c, nc) Car at North-South, No-car at East-West (nc, c): No-car at North-South, Car at East-West (nc, nc): No-car at North-South, No-car at East-West Compsci 04 22

FSM Example: Traffic Light State Transitions: State Input Next-State Output NG (-;NC) NG (G;R) NG (-;C) NY (G;R) NY - EG (Y;R) EG (NC;-) EG (R;G) EG (C;-) EY (R;G) EY - NG (R;Y) - means don t care Format (North/South; East/West) Compsci 04 23 Finite State Machine (cont.) Finite State Machines can be represented by a graph. The graph is called a State iagram. The states are the nodes in the graph. The arcs in the graph represent state transitions. Each arc is labeled with the Inputs that cause the transition Nodes are labeled with the outputs. Compsci 04 24

FSM State iagram Example: Traffic light Controller I= (-- ; NC) I = (--;C) NG O = (G;R) NY O = (Y;R) EY O = (R;Y) EG O = (R;G) I = (C; --) I = (NC; --) Compsci 04 25 State Code NG 00 NY 0 EG 0 EY Enumerate States State Coding Input Code (C;C) (C;NC) 0 (NC;C) 0 (NC;NC) 00 One bit for each Input Input is either true or false Output Code (R;G) 0000 (G;R) 0000 (Y;R) 0000 (R;Y) 0000 One bit per color for each light GYRGYR (North; East) Compsci 04 26

Coded State iagram (--;0) I= (-- ; NC) (--;) I = (--;C) NG 00 O = (G;R) (00;00) NY 0 (00;00) O = (Y;R) EY O = (R;Y) (00;00) EG (00;00) (;--) O = (R;G) I = (C; --) 0 (0;--) I = (NC; --) Compsci 04 27 Example: Traffic Light Controller S = State, bits are S0 and S NS = Next State, bits are NS0 and NS IN S NS OUT 0 0 0 02345 0-00 00 0000-00 0 0000 -- 0 0 0000-0 0 0 0000-0 0000 -- 00 0000 NS = S0 *S *I0+S0*S *I = S *(S0 I0+S0*I) NS0 = S0 *S+S0*S *I +S0*S *I = S0 *S+S0*S OUT0 = S0 *S OUT = S0 *S OUT2 = S0*S +S0*S= S0 OUT3 = S0*S OUT4 = S0*S OUT5 = S0 *S +S0 *S= S0 Compsci 04 28

Traffic Controller FSM implementation Compsci 04 29 General Method for FSM design etermine the problem:. raw the state diagram, 2. Write the truth table, 3. Write sum-of-products equations Compsci 04 30

A Simple Arrow FSM Consider those flashing arrow signs No light, one light, two lights, three lights > >> >>> Let s design the FSM to control this sign Compsci 04 3 Pattern Recognizer A pattern recognizer examines a sequence of inputs to detect when it sees the pattern 0. When it sees this pattern its output is forever. Let s design the FSM Compsci 04 32

Bit Equality a Bit equal b eq HCL Expression bool eq = (a&&b) (!a&&!b) Generate if a and b are equal Hardware Control Language (HCL) Very simple hardware description language Boolean operations have syntax similar to C logical operations We ll use it to describe control logic for processors Compsci 04 33 Word Equality Word-Level Representation b 3 a 3 b 30 Bit equal Bit equal eq 3 eq 30 B A = Eq a 30 HCL Representation Eq bool Eq = (A == B) b a b 0 a 0 Bit equal Bit equal eq eq 0 32-bit word size HCL representation Equality operation Generates Boolean value Compsci 04 34

Bit-Level Multiplexor s Bit MUX HCL Expression b a out bool out = (s&&a) (!s&&b) Control signal s ata signals a and b Output a when s=, b when s=0 Compsci 04 35 s Word Multiplexor Word-Level Representation s b 3 out 3 B A MUX Out a 3 b 30 a 30 b 0 a 0 out 30 HCL Representation int Out = [ s : A; : B; ]; Select input word A or B depending on control signal s HCL representation Case expression out Series of test : value pairs 0 Output value for first successful test Compsci 04 36

HCL Word-Level Examples Minimum of 3 Words C B A MIN3 Min3 int Min3 = [ A < B && A < C : A; B < A && B < C : B; : C; ]; Find minimum of three input words HCL case expression Final case guarantees match 4-Way Multiplexor s s0 0 2 3 MUX4 Out4 int Out4 = [!s&&!s0: 0;!s : ;!s0 : 2; : 3; ]; n Select one of 4 inputs based on two control bits n HCL case expression n Simplify tests by assuming sequential matching Compsci 04 37 Random-Access Memory vala Read ports srca valb A Register file W valw dstw Write port srcb B Stores multiple words of memory Address input specifies which word to read or write Register file Holds values of program registers %eax, %esp, etc. Clock Register identifier serves as address I 8 implies no read or write performed Multiple Ports Can read and/or write multiple words in one cycle Each has separate address and data input/output Compsci 04 38

Register File Timing x 2 vala srca valb srcb A Register file B 2 x Reading Like combinational logic Output data generated based on input address After some delay Writing Like register Update only as clock rises 2 x Register file W valw dstw y 2 Rising clock 2 y Register file W valw dstw Clock Clock Compsci 04 39 Summary Finite State Machines Inputs, Current State Compute Outputs and Next State HCL Language to express boolean logic Also, word level functions Homework #4 Compsci 04 40