Logic Simulation 3 Outline –Event-driven simulation algorithms –Event-driven simulation implementation Goal –Understand event-driven simulation –Understand.

Slides:



Advertisements
Similar presentations
The debugger Some programs may compile correctly, yet not produce the desirable results. These programs are valid and correct C programs, yet not the programs.
Advertisements

Computational Geometry
Lecture 8: Asynchronous Network Algorithms
AVL Trees1 Part-F2 AVL Trees v z. AVL Trees2 AVL Tree Definition (§ 9.2) AVL trees are balanced. An AVL Tree is a binary search tree such that.
Project 3, Standard Template Library (STL) Bryce Boe 2013/11/25 CS24, Fall 2013.
ECE 553: TESTING AND TESTABLE DESIGN OF DIGITAL SYSTES Logic Simulation.
CS 1220 – Object Oriented Design 1 Project Info Term Project Overview 1.You need to read in a circuit description Consists of list of gates, what nodes.
Parallel and Distributed Simulation Time Warp: Other Mechanisms.
1 Merge Sort Review of Sorting Merge Sort. 2 Sorting Algorithms Selection Sort uses a priority queue P implemented with an unsorted sequence: –Phase 1:
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Copyright 2001, Agrawal & BushnellDay-1 PM Lecture 4a1 Design for Testability Theory and Practice Lecture 4a: Simulation n What is simulation? n Design.
Logic Simulation 4 Outline –Fault Simulation –Fault Models –Parallel Fault Simulation –Concurrent Fault Simulation Goal –Understand fault simulation problem.
Logic Simulation Outline –Logic Simulation –Logic Design Description –Logic Models Goal –Understand logic simulation problem –Understand logic models.
4/25/2006 ELEC7250: Hill 1 Brad Hill ELEC 7250 Logic Simulator.
Sequential Logic 1  Combinational logic:  Compute a function all at one time  Fast/expensive  e.g. combinational multiplier  Sequential logic:  Compute.
Hash Tables1 Part E Hash Tables  
Hash Tables1 Part E Hash Tables  
Hashing COMP171 Fall Hashing 2 Hash table * Support the following operations n Find n Insert n Delete. (deletions may be unnecessary in some applications)
Logic Simulation 2 Outline –Timing Models –Simulation Algorithms Goal –Understand timing models –Understand simulation algorithms Reading –Gate-Level Simulation.
مرتضي صاحب الزماني  The registers are master-slave flip-flops (a.k.a. edge-triggered) –At the beginning of each cycle, propagate values from primary inputs.
Queues CS-240 & CS-341 Dick Steflik. Queues First In, First Out operation – FIFO As items are added they are chronologically ordered, items are removed.
Logic simulator and fault diagnosis Fan Wang Dept. of Electrical & Computer Engineering Auburn University ELEC7250 Term Project Spring 06’
Cmpt-225 Simulation. Application: Simulation Simulation  A technique for modeling the behavior of both natural and human-made systems  Goal Generate.
Data Structures Lecture-1:Introduction
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
1 Geometric Intersection Determining if there are intersections between graphical objects Finding all intersecting pairs Brute Force Algorithm Plane Sweep.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 15: Linked data structures.
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
CHAPTER 09 Compiled by: Dr. Mohammad Omar Alhawarat Sorting & Searching.
Brought to you by Max (ICQ: TEL: ) February 5, 2005 Advanced Data Structures Introduction.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
+ Simulation Design. + Types event-advance and unit-time advance. Both these designs are event-based but utilize different ways of advancing the time.
EKT 221/4 DIGITAL ELECTRONICS II  Registers, Micro-operations and Implementations - Part3.
Data Structure & Algorithm II.  In a multiuser computer system, multiple users submit jobs to run on a single processor.  We assume that the time required.
CSE373: Data Structures & Algorithms Lecture 6: Priority Queues Dan Grossman Fall 2013.
Interconnect simulation. Different levels for Evaluating an architecture Numerical models – Mathematic formulations to obtain performance characteristics.
Timing Model VHDL uses the following simulation cycle to model the stimulus and response nature of digital hardware Start Simulation Update Signals Execute.
Search CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Hashing 1 Hashing. Hashing 2 Hashing … * Again, a (dynamic) set of elements in which we do ‘search’, ‘insert’, and ‘delete’ n Linear ones: lists, stacks,
Advanced Data Structure By Kayman 21 Jan Outline Review of some data structures Array Linked List Sorted Array New stuff 3 of the most important.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
AVL Trees and Heaps. AVL Trees So far balancing the tree was done globally Basically every node was involved in the balance operation Tree balancing can.
Priority Queues, Heaps, and Heapsort CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
Penn ESE370 Fall DeHon 1 ESE370: Circuit-Level Modeling, Design, and Optimization for Digital Systems Day 24: November 5, 2012 Synchronous Circuits.
Priority Queues, Heaps, and Heapsort CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
LINKED LISTS.
© Oxford University Press All rights reserved. Data Structures Using C, 2e Reema Thareja.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Term Project: Overview
Data Structures Using C, 2e
Planning & System installation
HDL simulation and Synthesis (Marks16)
Hashing CSE 2011 Winter July 2018.
Exam Hints.
Lectures Queues Chapter 8 of textbook 1. Concepts of queue
Priority Queues © 2010 Goodrich, Tamassia Priority Queues 1
Term Project: Overview
CMPS 3130/6130 Computational Geometry Spring 2017
Dictionaries 9/14/ :35 AM Hash Tables   4
Advanced Associative Structures
Part-D1 Priority Queues
Parallel and Distributed Simulation
Stacks and Queues CSE 373 Data Structures.
Chapter 4: Simulation Designs
CS210- Lecture 16 July 11, 2005 Agenda Maps and Dictionaries Map ADT
Hashing.
CSCS-200 Data Structure and Algorithms
CMPT 225 Lecture 16 – Heap Sort.
Presentation transcript:

Logic Simulation 3 Outline –Event-driven simulation algorithms –Event-driven simulation implementation Goal –Understand event-driven simulation –Understand simulator implementation Reading –Gate-Level Simulation by D’Abreu –Types of Simulators by Trimberger

Event-Driven Logic Simulation Evaluate gate when inputs change –use logic model to compute new output value –use timing model to compute when output will change Schedule an output change event –store the event on a time-sorted event queue Process events from the queue –output change evaluated at scheduled time –causes new events to be scheduled >0 (0) >1 (5) 1->0 (12) 1->0 (10)

Event-Driven Logic Simulation >0 (0) >1 (5) 1->0 (12) 1->0 (10) 1. t=X: Schedule PI:1->0 at t=0 2. t=0: PI changes 1->0 –Evaluate A, schedule A:0->1 at t=5 4. t=5: A changes 0->1 –Evaluate B, schedule B:1->0 at t=10 –Evaluate C, schedule C:1->0 at t=12 5. t=10: B changes 1->0, output 6. t=12: C changes 1->0, output A B C

Simulation Algorithm while (HaveEvents()) event = NextEvent();/* time-sorted order */ currenttime = event->time;/* update global time */ event->gate->output = event->output/* change gate output */ print output if it is primary output; for (all gates g in event->gate fan-out list) newoutput = EvalGate(g);/* new gate output */ newtime = currenttime + g->delay;/* when it changes */ ScheduleEvent(g, newoutput, newtime);

Simulator Initialization Set all gate outputs to X (3-state logic) Start simulation from primary inputs –inputs from outside world 0/1 values are set as inputs propagate Problems –feedback and memory increase initialization time –some states may never initialize Solution –real circuits have initialization logic –reading before writing memory is an error

Event Scheduling Only schedule event on a gate output if it: –occurs after the last pending event and has a different value »otherwise creates useless work –occurs before first pending event »remove next event if same value, now obsolete –occurs between two events and is different than previous one »remove next event if same value, now obsolete –has different value than current output, and no pending events »otherwise creates useless work Note: typically 0, 1, or 2 pending events on a gate 1 1: 0 at 3ns 2: 1 at 5ns 1 at 10ns - discard 0 at 10ns - keep 1 1: 0 at 3ns 2: 1 at 5ns 1 at 2ns - discard 0 at 2ns - keep, discard #1 7ns 1

Event Scheduling Note: cases 2 & 3 cannot happen for pure propagation delay model –events always arrive in time-sorted order –new event must come >= last pending event –can happen for more complex timing models Inertial delay –remove pending event pair if new event caused them to be spaced < inertial delay and return to original value –for pure propagation model, just add time check in case 1 against last pending event –wait for all events at time T -don’t delete until you are sure Pending: 1: 0 at 1ns 2: 1 at 5ns 7ns prop. delay 3ns inertial delay New: 0 at 6ns - discard, remove #2 0 at 9ns - add to queue 0 X 1

Optimizations Problem –multiple events at time T can cause multiple gate evaluations –up to N evaluations for N inputs Solution –for all events at time T put gates to be evaluated on a list –evaluate all gates at same time, scheduling events Problem –multiple events at time T cause multiple printed output Solution –wait until time advances to print primary outputs –print them only if any primary outputs changed 1: 0 at 2ns 2: 1 at 2ns Evaluate gate using event 1 2. Schedule 3: 1 at 9ns 3. Evaluate gate using event 2 4. Delete event 3 7ns

Simulation Control Visualization –timing diagrams –back annotation of schematic Inputs –timing diagrams –vectors - especially for synchronous circuits Probing –examine events at a node –straightforward for event-driven simulation »mark each node to save value »can force node to value –must make a primary output for compiled simulation Control –stop and start time sequence –insert “breakpoint” events, like debugger

Event Queue Implementation Events must be processed in time order –event queue must sort by time Must be able to delete events –cancel obsolete events on a gate Implementations –priority queue »O(logN) time to insert/delete for N-item queue »many implementations - AVL tree, heap, etc. »problem: N is often large –bucket queue - time wheel »divide time into time quanta Q, e.g. 1ps »circular buffer of N entries 1 quantum in size »can store events Q*N into future »events beyond buffer go into unsorted far list »O(1) time to insert, nearly so for delete

Time Wheel 0 1 i-1 i i event curtime curtime+999ps curtime+1ps time wheel of time quantums all events scheduled for a given time quantum Wheel only needs to be big enough to hold most variation in gate delays

Time Wheel Operation Insertion if (eventtime - curtime >= WHEELLENGTH*quantum) insert event into far list else insert at wheel[eventtime % (WHEELLENGTH*quantum)] Deletion i = curtime % (WHEELLENGTH*quantum) while (wheel[i] == NULL) if (i == WHEELLENGTH-1) i = 0; timebase += (WHEELLENGTH*quantum); for all events in far list if (eventtime - timebase < WHEELLENGTH*quantum) insert event into wheel else i++ remove first event from wheel[i] list and return it