Digital Logic issues in Embedded Systems. Things upcoming Remember that the first two topic talks are on 10/24 (ultrasonic distance and stepper motors)

Slides:



Advertisements
Similar presentations
Lab 08: SR Flip Flop Fundamentals:
Advertisements

Registers Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens A clock is a free-running signal with a cycle time. A clock may.
EECS 373 Winter 2014 Finishing up. Design expo Design Expo is on Tuesday the 22 nd from 11am-1:30pm in the EECS atrium. – Setup starts at 9:30am – We’ll.
1 Lecture 16 Timing  Terminology  Timing issues  Asynchronous inputs.
Finite State Machines (FSMs)
Lecture 23: Registers and Counters (2)
Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
1 Introduction Sequential circuit –Output depends not just on present inputs (as in combinational circuit), but on past sequence of inputs Stores bits,
Sequential Logic ENEL 111. Sequential Logic Circuits So far we have only considered circuits where the output is purely a function of the inputs With.
Digital Design - Sequential Logic Design Chapter 3 - Sequential Logic Design.
Penn ESE370 Fall DeHon 1 ESE370: Circuit-Level Modeling, Design, and Optimization for Digital Systems Day 24: November 4, 2011 Synchronous Circuits.
Digital Logic Design Lecture # 17 University of Tehran.
K-Maps, Timing Sequential Circuits: Latches & Flip-Flops Lecture 4 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier,
LOGIC GATES ADDERS FLIP-FLOPS REGISTERS Digital Electronics Mark Neil - Microprocessor Course 1.
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Serial buses, digital design Material taken from Dutta, Le, Ramadas,
1 Digital Design: State Machines Timing Behavior Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals.
Assume array size is 256 (mult: 4ns, add: 2ns)
1 EECS 373 Design of Microprocessor-Based Systems Prabal Dutta University of Michigan Lecture 8: Clocks, Counters, Timers, Capture, and Compare September.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 9 - Finite State Machines 1 February 19, 2002 John Wawrzynek.
EECS 373 Design of Microprocessor-Based Systems Mark Brehob
CS 151 Digital Systems Design Lecture 28 Timing Analysis.
1 CSE370, Lecture 14 Lecture 14 u Logistics n Midterm 1: Average 90/100. Well done! n Midterm solutions online n HW5 due date delayed until this Friday.
1 CSE370, Lecture 16 Lecture 19 u Logistics n HW5 is due today (full credit today, 20% off Monday 10:29am, Solutions up Monday 10:30am) n HW6 is due Wednesday.
COE 202: Digital Logic Design Sequential Circuits Part 1
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Rabie A. Ramadan Lecture 3
© BYU 18 ASYNCH Page 1 ECEn 224 Handling Asynchronous Inputs.
Digital Logic Design Lecture # 21 University of Tehran.
1 CSE370, Lecture 17 Lecture 17 u Logistics n Lab 7 this week n HW6 is due Friday n Office Hours íMine: Friday 10:00-11:00 as usual íSara: Thursday 2:30-3:20.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
SEQUENTIAL LOGIC By Tom Fitch. Types of Circuits Combinational: Gates Combinational: Gates Sequential: Flip-Flops Sequential: Flip-Flops.
MicroComputer Engineering DigitalCircuits slide 1 Combinational circuits Changes at inputs propagate at logic speed to outputs Not clocked No internal.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2007.
CO5023 Latches, Flip-Flops and Decoders. Sequential Circuit What does this do? The OUTPUT of a sequential circuit is determined by the current output.
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
1 EECS 373 Design of Microprocessor-Based Systems Mark Brehob University of Michigan Serial buses, digital design Material taken from Dutta, Le, Ramadas,
EE3A1 Computer Hardware and Digital Design Lecture 9 Pipelining.
Penn ESE370 Fall DeHon 1 ESE370: Circuit-Level Modeling, Design, and Optimization for Digital Systems Day 24: November 5, 2012 Synchronous Circuits.
Instructor: Alexander Stoytchev CprE 281: Digital Logic.
Penn ESE370 Fall DeHon 1 ESE370: Circuit-Level Modeling, Design, and Optimization for Digital Systems Day 20: October 25, 2010 Pass Transistors.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Dr. Shi Dept. of Electrical and Computer Engineering.
EECS 373 – lecture 4 Buses, serial communication and digital design.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Copyright © 2001 Stephen A. Edwards All rights reserved Busses  Wires sometimes used as shared communication medium  Think “party-line telephone”  Bus.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Digital Design - Sequential Logic Design
Lecture 10 Flip-Flops/Latches
Sequential Logic.
Instructor: Alexander Stoytchev
COMP541 Sequential Logic – 2: Finite State Machines
Basic Delay in Gates Definitions
Sequential Logic and Flip Flops
D Flip-Flop.
Instructor: Alexander Stoytchev
Sequential Circuits: Flip-Flops
CPE/EE 422/522 Advanced Logic Design L03
EECS 373 Design of Microprocessor-Based Systems Mark Brehob
Sequential Logic and Flip Flops
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
CSE 370 – Winter Sequential Logic - 1
Lecture 16 Logistics Last lecture Today HW5 out, due next wednesday
EECS 373 Design of Microprocessor-Based Systems A day of Misc. Topics
Introduction to Sequential Circuits
Instructor: Alexander Stoytchev
EECS 373 Design of Microprocessor-Based Systems Mark Brehob
Lecture 16 Logistics Last lecture Today HW5 out, due next wednesday
Flip-Flops.
Lecture 19 Logistics Last lecture Today
Sequential Digital Circuits
Instructor: Michael Greenbaum
Presentation transcript:

Digital Logic issues in Embedded Systems

Things upcoming Remember that the first two topic talks are on 10/24 (ultrasonic distance and stepper motors) – Those groups should be meeting with me in office hours shortly to discuss their talks. HW3 – Due in class on Tuesday 10/8 Project proposals – due Thursday 10/10 by 4pm. – pdf to Matt and Mark! – Be sure to discuss with Matt or I first. I’ll be mostly in my office from 2:30 – 5:00 on Friday. – Meetings from 10am-3pm on Friday 10/11 We’ll send out a doodle. – Bring 2 hard copies to the proposal meeting. Exam on Wednesday 10/16. – 7pm (sharp) 1500 EECS Will cancel class on Thursday 10/17 (was to be the exam time) – Office hours

Today Finish advanced digital logic for embedded systems. – Work example designs on board Discuss timers (time allowing)

EECS Our digital logic class, EECS 270, does a great job dealing with logic basics. But it only has so much time and has a wide variety of follow-on classes (373, 470, 478) to support. Today we’ll spend time reviewing some 270 material, introducing some new material, and providing design guidelines. We’ll then wrap it working on a rather difficult digital design problem involving interfacing.

Agenda for Glitches – Asynchronous resets and glitches – Design rules Set-up and hold time. – Review – Dealing with external inputs Design rules Design problem: Decoding Manchester encoding. – Paper design – Verilog

Glitches Combinational logic can glitch – What is a glitch? – How do we normally deal with it? – Where can it hurt us?

Full adder (from Wikipedia) Timing Assuming the XOR gates have a delay of 0.2ns while AND and OR gates have a delay of 0.1ns – What is the worst case propagation delay for this circuit? x y z

x y z Full adder (from Wikipedia) Consider the adjacent circuit diagram. Assuming the XOR gates have a delay of 0.2ns while AND and OR gates have a delay of 0.1ns, fill in the following chart. Only selected causality arrows shown… Glitches

Glitching: a summary When input(s) change, the output can be wrong for a time. However, that time is bound. – And more so, the output can change during this “computation time” even if the output ends up where it started!

Effect of Glitches Think back to EECS 370. – Why don’t glitches cause errors? – The trick is that the inputs all change at the same time In this case, the ID/EX registers all change some time shortly after the rising edge of the clock. – And we’ve chosen the clock period such that the next edge doesn’t happen until the combinational logic has stopped glitching. In fact, we use the worst-case combinational logic delay in the whole system when determining the clock period!

So, how can glitches hurt us? There are a handful of places: – Asynchronous resets If you’ve got a flip-flop that has an asynchronous reset (or “preset”) you need to be sure the input can’t glitch. – That pretty much means you need a flip-flop driving the input (which means you probably should have used a sync. reset!) – Clocks If you are using combinational logic to drive a clock, you are likely going to get extra clock edges. Traditionally, CLR is used to indicate async reset. “R” or “reset” for sync. reset. If clk is high and cond glitches, you get extra edges!

Design rules 1.Thou shall Not use asynchronous resets 2.Thou shall not drive a clock with anything other than a clock or directly off of a flip- flop’s output X X

Really? I mean people use asynchronous resets and clock gating! – Yep. And people use goto in C programs. Sometimes they are the right thing. – But you have to think really hard about them to insure that they won’t cause you problems. – Our “simple” bus used combinational logic for the clock Works because REQ goes low only after everything else has stopped switching – So no glitch. Not fun to reason about… Avoid unless you must – Then think really carefully.

Agenda Glitches – Asynchronous resets and glitches – Design rules Set-up and hold time. – Review – Dealing with external inputs Design rules Fun with buses: Tristate and pull-up Design problem: Decoding Manchester encoding. – Paper design – Verilog Bonus issue – Bit stuffing

Setup and hold time The idea is simple. – When the clock is changing if the data is also changing it is hard to tell what the data is. Hardware can’t always tell – And you can get meta-stable behavior too (very unlikely but…) – So we have a “guard band” around the clock rising time during which we don’t allow the data to change. See diagram. We call the time before the clock-edge “setup time” and the time after “hold time”

Example: Fast and slow paths; impact of setup and hold time

So what happens if we violate set-up or hold time? Often just get one of the two values. – And that often is just fine. Consider getting a button press from the user. If the button gets pressed at the same time as the clock edge, we might see the button now or next clock. – Either is generally fine when it comes to human input. – But bad things could happen. The flip-flop’s output might not settle out to a “0” or a “1” – That could cause latter devices to mess up. More likely, if that input is going to two places, one might see a “0” the other a “1”.

Example A common thing to do is reset a state machine using a button. – User can “reset” the system. Because the button transition could violate set-up or hold time, some state bits of the state machine might come out of reset at different times. – And you quickly end up at a wrong or illegal state.

So… Dealing with inputs not synchronized to our local clock is a problem. – Likely to violate setup or hold time. That could lead to things breaking. So we need a clock synchronization circuit. – First flip-flop might have problems. – Second should be fine. – Sometimes use a third if really paranoid Safety-critical system for example. Figure from we use the same thing to deal with external inputs too!

Design rules 3.Thou shalt use a clock synchronization circuit when changing clock domains or using unclocked inputs! /* Synchonization of Asynchronous switch input */ clk) begin sw0_pulse[0] <= sw_port[0]; sw0_pulse[1] <= sw0_pulse[0]; sw0_pulse[2] <= sw0_pulse[1]; end clk) SSELr <= {SSELr[1:0], SSEL};

Two design problems Design device which divides an input clock by 16 and has a 75% duty cycle – Output used as a clock. Manchester encoding – Basics Scheme Self timing etc. – Design problem

Time for Timers

Timers are used for… Measuring time Causing an event at a regular interval

Measuring time When would you use a timer to measure time? How could you make that measurement accurate? – Issue with throwing interrupt on event and checking timer? “Capture register”

Causing an event at a regular interval What type of event? How would you make that regular interval as regular as possible? – Issues with polling? “Reference register”

Virtualizing timers

Control and complexity You need a way to tell the timer what to do. – Set reference, read capture, reset timer, etc. – Some timers are extremely complex. So have lots of memory-mapped registers – Control, prescaler, etc. Some can do really cool things – PWM, etc.

pclk) if(~nreset) begin overflowReset <= 1'b0; controlReg <= 32'h ; overflowReg <= 32'h ; end else begin if(bus_write_en) begin : WRITE case(bus_addr[3:2]) 2'b00: // Timer Overflow Register begin overflowReg <= bus_write_data; overflowReset <= 1'b1; end 2'b01: // Timer Value, Read Only begin overflowReset <= 1'b0; end 2'b10: // Timer Control begin controlReg <= bus_write_data; overflowReset <= 1'b0; end 2'b11: // Spare begin overflowReset <= 1'b0; end endcase end else if(bus_read_en) begin : READ case(bus_addr[3:2]) 2'b00: // Timer Overflow register begin bus_read_data <= overflowReg; end 2'b01: // Timer Value, Read Only begin bus_read_data <= counterReg; end 2'b10: // Timer Control begin bus_read_data <= controlReg; end 2'b11: // Spare begin end endcase end else overflowReset <= 1'b0; end