ECSE-323 Digital System Design. Datapath/Controller Lecture #1

Similar documents
Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Microprocessor Design

ELCT 501: Digital System Design

Digital Fundamentals: A Systems Approach

Modeling Digital Systems with Verilog

ECE337 Lab 4 Introduction to State Machines in VHDL

1. Convert the decimal number to binary, octal, and hexadecimal.

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Laboratory Exercise 7

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

CS 110 Computer Architecture. Finite State Machines, Functional Units. Instructor: Sören Schwertfeger.

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

CS3350B Computer Architecture Winter 2015

Why FPGAs? FPGA Overview. Why FPGAs?

MODULE 3. Combinational & Sequential logic

Chapter 3. Boolean Algebra and Digital Logic

Logic Design II (17.342) Spring Lecture Outline

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

Logic Design II (17.342) Spring Lecture Outline

Previous Lecture Sequential Circuits. Slide Summary of contents covered in this lecture. (Refer Slide Time: 01:55)

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

HDL & High Level Synthesize (EEET 2035) Laboratory II Sequential Circuits with VHDL: DFF, Counter, TFF and Timer

ELEN Electronique numérique

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

CS 151 Final. Instructions: Student ID. (Last Name) (First Name) Signature

ELCT201: DIGITAL LOGIC DESIGN

Long and Fast Up/Down Counters Pushpinder Kaur CHOUHAN 6 th Jan, 2003

Laboratory Exercise 7

FSM Implementations. TIE Logic Synthesis Arto Perttula Tampere University of Technology Fall Output. Input. Next. State.

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Course Administration

CHAPTER 4: Logic Circuits

Vending Machine. Keywords FSM, Vending Machine, FPGA, VHDL

Solution to Digital Logic )What is the magnitude comparator? Design a logic circuit for 4 bit magnitude comparator and explain it,

Chapter Contents. Appendix A: Digital Logic. Some Definitions

Registers and Counters

Contents Circuits... 1

Decade Counters Mod-5 counter: Decade Counter:

Register Transfer Level in Verilog: Part II

COE328 Course Outline. Fall 2007

CHAPTER 4: Logic Circuits

Digital Logic Design ENEE x. Lecture 24

Lecture 11: Synchronous Sequential Logic

More Digital Circuits

Principles of Computer Architecture. Appendix A: Digital Logic

Chapter 5 Synchronous Sequential Logic

Universidad Carlos III de Madrid Digital Electronics Exercises

Chapter 3 Unit Combinational

CS8803: Advanced Digital Design for Embedded Hardware

Computer Systems Architecture

CSC258: Computer Organization. Combinational Logic

Ryerson University Department of Electrical and Computer Engineering EES508 Digital Systems

Chapter 7 Counters and Registers

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Faculty of Electrical & Electronics Engineering BEE3233 Electronics System Design. Laboratory 3: Finite State Machine (FSM)

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Debugging of Verilog Hardware Designs on Altera s DE-Series Boards. 1 Introduction. For Quartus Prime 15.1

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

CHAPTER 6 COUNTERS & REGISTERS

CPS311 Lecture: Sequential Circuits

Contents Slide Set 6. Introduction to Chapter 7 of the textbook. Outline of Slide Set 6. An outline of the first part of Chapter 7

Electrical and Telecommunications Engineering Technology_TCET3122/TC520. NEW YORK CITY COLLEGE OF TECHNOLOGY The City University of New York

ENGG2410: Digital Design Lab 5: Modular Designs and Hierarchy Using VHDL

Midterm Exam 15 points total. March 28, 2011

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

Sequential Circuit Design: Principle

1. a) For the circuit shown in figure 1.1, draw a truth table showing the output Q for all combinations of inputs A, B and C. [4] Figure 1.

Fall 2000 Chapter 5 Part 1

Control Unit. Arturo Díaz-Pérez Departamento de Computación Laboratorio de Tecnologías de Información CINVESTAV-IPN

Debugging of VHDL Hardware Designs on Altera s DE2 Boards

Administrative issues. Sequential logic

TSIU03, SYSTEM DESIGN. How to Describe a HW Circuit

Computer Architecture and Organization

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

Switching Circuits & Logic Design, Fall Final Examination (1/13/2012, 3:30pm~5:20pm)

COMP2611: Computer Organization. Introduction to Digital Logic

CS61C : Machine Structures

VeriLab. An introductory lab for using Verilog in digital design (first draft) VeriLab

Combinational vs Sequential

BCN1043. By Dr. Mritha Ramalingam. Faculty of Computer Systems & Software Engineering

CSCB58 - Lab 4. Prelab /3 Part I (in-lab) /1 Part II (in-lab) /1 Part III (in-lab) /2 TOTAL /8

ENGG 1203 Tutorial. D Flip Flop. D Flip Flop. Q changes when CLK is in Rising edge PGT NGT

CS6201 UNIT I PART-A. Develop or build the following Boolean function with NAND gate F(x,y,z)=(1,2,3,5,7).

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

Registers and Counters

Sequential logic circuits

FPGA Implementation of Sequential Logic

Digital Systems Laboratory 1 IE5 / WS 2001


Ryerson University Department of Electrical and Computer Engineering COE/BME 328 Digital Systems

DIGITAL SYSTEM DESIGN UNIT I (2 MARKS)

Logic Design. Flip Flops, Registers and Counters

EE292: Fundamentals of ECE

Flip-Flops and Registers

EE 209 Lab 7 A Walk-Off


University of Maiduguri Faculty of Engineering Seminar Series Volume 6, december 2015

Transcription:

1 ECSE-323 Digital System Design Datapath/Controller Lecture #1

2 Synchronous Digital Systems are often designed in a modular hierarchical fashion. The system consists of modular subsystems, each of which performs some functional task, such as addition, multiplication, storage, counting, etc.

3 A good way to design modular digital systems is to partition the system into two types of modules: Datapath Modules, which process and manipulate data. Control Modules, which generate control signals that modify the processing of the datapath modules. The datapath modules also send status signals to the control modules.

4 A system built in this way is said to use a Datapath/Controller architecture. Control inputs Control signals Data outputs Control Unit Status signals Datapath Clock Control outputs Data inputs

5 Examples of Control Signals: Multiplexers - select Registers -load_en, clear, set Shift Registers - load_en, shift_en, clear, set Counters - count_en, clear, set, up/down

6 Examples of Control Inputs: start, reset, mode, begin all external non-data inputs (such as button presses)

7 Examples of Control Outputs: done, ready, error

8 Examples of Status Signals: Serial Multipliers, Adders - done, ready Counters - count_decode, zero Comparators - AeqB, AltB, AgtB

9 A Simple Example - Pushbutton Counter Design a circuit that counts the number of times a button has been pressed.

10 A Bad Solution: COUNTER Pushbutton count clock

Why is the design bad? 11 The external signal from the pushbutton can be noisy due to switch bounce, causing multiple counts for every button press. The count output changes at unpredictable times, which could cause difficulty (and glitches) synchronizing with other circuits.

12 The counter will increment at each of these times! pushbutton signal switch bounce 5 msec

13 A Better Solution: status signal Pushbutton control input control signals TIMER start timer_on TO PB TO CONTROLLER TS CE COUNTER enable count data output clock

14 The timer is used to "wait out" the extra signal transitions created by switch bounce. timer out 20 msec pushbutton signal switch bounce

State Diagram for Counter Controller FSM 15 TO+PB=1 S1 In S1 we wait for both the Timer and the pushbutton signals to go low. TO+PB=0 PB=0 S3 [TS=1] [CE=1] PB=1 S2 In S3 we enable the counter and start the timer, then go to S1. In S2 we wait for the pushbutton signal to go high.

16 In general, even if you don't have to worry about de-bouncing inputs, you should always check for transitions on input signals in a 2-stage manner: 1. Wait for the signal to go low. 2. Wait for the signal to go high 3. (then do stuff )

17 This sort of 2-stage wait for a signal transition is useful for starting a sequence of actions, such as in a serial conversion from binary to BCD, or in a serial multiplier That is, to know when the actions should start, we check the value of the start input. We first wait for it to go low, then we wait for it to go high. Only then do we commence the operation.

18 The Boss gives you a more complicated TASK: Design a circuit that finds the minimum and maximum values of a set of values stored in a set of 3 registers 15, 72, 5

19 General Approach to Design of Datapath/Controller Systems 1. Describe the function to be performed 2. Determine what datapath elements are needed 3. Specify the interconnections of the datapath elements 4. Identify the controller input and output signals 5. Sketch the sequence of control signal values needed to carry out the desired function 6. Design a Finite State Machine that will implement the required sequence 7. Simulate (by hand or by computer) the complete system to verify the proper execution of the desired function. Go back to step if there are any problems. 8. Implement and test complete system. Go back to step 2 if there are any problems with the implementation

20 Do the design by going step-by-step through the steps outlined in the previous slide

21 Step 1: Describe the function to be performed It is usually easiest to describe the function in a "pseudo-code" form which can be easily translated into a hardware implementation.

22 Digression: Register-Transfer Language (RTL) Datapath/Controller systems are often specified by describing the transfer of data between registers, and the processing applied to the data. These descriptions use a language known as a Register-Transfer Language, or RTL.

23 Register-Transfer Language (RTL) RTL is a type of hardware description language. RTL descriptions are often used by hardware design software (simulators, synthesis) rather than VHDL, Use of RTL can produce more efficient synthesis (smaller circuits) since the compiler has an easier job understanding just what it is that the designer wants.

24 RTL statements specify how, and when data is moved from one register to another. The basic syntax of an RTL statement is: R2 R1 This says that, on the next clock transition, the contents of register R1 are transferred to register R2.

25 Usually we don't want to transfer on every clock, but only when some control condition is asserted. K : R2 R1 This says that, when Boolean condition K is true, on the next clock transition, the contents of register R1 are transferred to register R2.

26 Multiple transfer operations on the same clock edge can be specified with a comma-delimited list: K : R2 R1, R1 R2 This statement describes a register-swap operation, controlled by signal K. In this example, when K is true the contents of register R1 are copied to register R2 and vice-versa.

27 You can specify multiple conditions on the commadelimited list: K : R2 R1, K : R1 R2

28 Operations on data are described as operations on the contents of register(s): K : A A + R1 This statement describes an accumulation operation, controlled by signal K. Whenever K is true, the contents of register A are added to the contents of register R1 and the result stored back into register A.

29 Memory Operations require address operands: READ : DR M([AR]) WRITE : M([AR]) DR The expression [R] means the contents of register R. The expression M(A) means the memory slot with address A. Memory slots are treated like registers.

30 Register-Transfer Language is not covered in the text (except for a brief mention on p. 466) RTL is used extensively in the specification of computer architectures, to be covered in the Microprocessors and Computer Architecture courses.

31 Returning back to the Min/Max circuit, we can write the following RTL description of the desired operation: RMAX R1, RMIN R1 R2<RMIN : RMIN R2, R2>RMAX : RMAX R2 R3<RMIN : RMIN R3, R3>RMAX : RMAX R3 Each line corresponds to events occuring in response to a single clock edge. The statements are read sequentially, top to bottom, corresponding to successive clocks.

32 Step 2: Determine what datapath elements are needed We can read off our needs from the pseudo-code: Two registers to store the max and min values Two comparators One multiplexers to control input to the RMAX and RMIN registers (note: only 1 multiplexer is needed, since the set of possible inputs to the two registers is the same, so we can share the multiplexer. We could use two multiplexers, and save a clock cycle. There are usually such tradeoffs.)

33 Step 3: Specify the interconnections of the datapath elements Think of what data sources the datapath elements will operate on. Some of the datapath elements will serve multiple purposes during the execution of an algorithm. Thus, different data sources may be operated on at different time. If this is the case, then Multiplexers should be used to choose between the different data sources. Often, intermediate results need to be held before they are operated on. In this case, registers should be used to store these values.

34 The circuit implied by the RTL description is: R1 R2 R3 REGSEL MUX RMAXLDEN RMAX RMIN RMINLDEN A B A B COMPARATOR COMPARATOR AgtB BleqA DONE RESET BleqA AgtB CONTROLLER REGSEL RMAXLDEN RMINLDEN

35 Note: Multiplexers are very important in the implementation of datapaths. They allow datapath elements (such as adders and registers) to be reused, thereby reducing the size of the circuit.

36 Tri-state busses are also sometimes used to implement connections between datapath elements, as they require less circuitry than multiplexers. Most FPGAs, however, only have a limited number of tri-state buffer circuits, usually located in output blocks. Therefore MUXs are usually used in FPGA datapath designs.

37 There are usually many different ways to implement a datapath. Expensive datapath elements (such as comparators, and arithmetic operators) should be re-used and shared as much as possible. For such elements, their inputs and outputs should be connected to multiplexers which can distribute these signals to the appropriate destinations. Enable signals can be used instead of multiplexers in some cases. We could use a multiplexer for each of the max and min value registers, but this would be overkill, as we can connect the register inputs together, and use the register load enables to determine which gets loaded.

38 For example, we could implement the MIN-MAX operation with just a single comparator, but it would require using more clock cycles, since we can only have one comparison operation per clock cycle: RMAX R1, RMIN R1 R2<RMIN : RMIN R2 R2>RMAX : RMAX R2 R3<RMIN : RMIN R3 R3>RMAX : RMAX R3

39 Step 4: Identify the controller input and output signals Do this by looking at the control signals of the datapath elements. Inputs: RESET (external control signal) CLK AgtB, BleqA (datapath status signals) Outputs: RMINLDEN - enable loading of the RMIN register RMAXLDEN - enable loading of the RMAX register REGSEL - select the input for RMIN or RMAX DONE - notify the user when the sorting is done

40 Step 5: Sketch the sequence of control signal values needed to carry out the desired function Do this by looking at the pseudocode and determining, for each clock transition, what the datapath control signals need to be. For example, for registers, you would decide when their load signals should be asserted, or when they should be cleared. For counters, you might determine when their count enables should be asserted.

Going back to the pseudocode for our example: 41 RMAX R1, RMIN R1 R2<RMIN : RMIN R2, R2>RMAX : RMAX R2 R3<RMIN : RMIN R3, R3>RMAX : RMAX R3 We see that in the first clock we need to have the multiplexer control input set to select the R1 input. We also assert the load signals for both RMIN and RMAX. In the second clock, we need to have the multiplexer select set to R2. However, we only assert the load for RMIN if the comparator signal BleqA is true (which implies R2<RMIN), and we only assert the load for RMAX if AgtB is true (implying R2>RMAX). In the third clock, we need to have the multiplexer select set to R3. However, we only assert the load for RMIN if the comparator signal BleqA is true (which implies R3<RMIN), and we only assert the load for RMAX if AgtB is true (implying R3>RMAX).

42 Step 6: Design a Finite State Machine that will implement the required sequence The simplest way to do this is to specify a different state for each line in the RTL description (or in the pseudocode). Note that there may be loops in the pseudocode. In our example, there would be 3 states, if we used a Mealy Machine implementation (4 states if we use a separate DONE state). A Moore Machine would require more states, since we would not be able to have two different logical conditions applied on one clock transition.

43 RESET S0 REGSEL=R1 RMAXLDEN=1 RMINLDEN=1 The sorting operation takes 3 clock cycles to complete S3 S1 REGSEL=R3 RMAXLDEN=AgtB RMINLDEN=BleqA REGSEL=R2 RMAXLDEN=AgtB RMINLDEN=BleqA S2 REGSEL=R1 RMAXLDEN=0 RMINLDEN=0 DONE = 1 Controller FSM state diagram (Mealy Machine)

Step 7: Simulate the complete system to verify the proper execution of the desired function 44 This Works! But note that the DONE line goes high slightly before the final value is ready. This is OK if the values are not used until the next clock edge.