1 / 49

Logic Synthesis in IC Design and Associated Tools Review-II

Logic Synthesis in IC Design and Associated Tools Review-II. Wang Jiang Chau Grupo de Projeto de Sistemas Eletrônicos e Software Aplicado Laboratório de Microeletrônica – LME Depto . Sistemas Eletrônicos Universidade de São Paulo. Data Structures.

mabli
Télécharger la présentation

Logic Synthesis in IC Design and Associated Tools Review-II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Logic Synthesis in IC Design and Associated Tools Review-II Wang Jiang Chau Grupo de Projeto de Sistemas Eletrônicos e Software Aplicado Laboratório de Microeletrônica – LME Depto. SistemasEletrônicos Universidade de São Paulo

  2. Data Structures • Data Type: integer, boolean, etc. Set of values that objects can assume, their common data representation and set of operations on them. Abstract Data Type (ADT): graphs, trees, lists Mathematical model with defined operations Data Structures: arrays, pointers Data types and their relationships, used to implement ADTs Obs. Very common The term Data structure is used to mean ADT

  3. Abstract Data Types (ADTs)- 1 The concept of abstraction means: • We know what a data type can do • How it is done is hidden for the user • With an ADT, users are not concerned with how the task is done but rather with what it can do.

  4. Abstract Data Types (ADTs)- 2 • Mathematical model with associated operations. • The implementation is not defined • Two ADTs with the same model, but with different set of operations are considered distinct ones (the implementation may be different depending on the set of operations • Lists, stacks, queues, graphs, trees, heaps

  5. List ADT • A sequence of zero or more elements A1, A2, A3, … AN • N: length of the list • A1: first element • AN: last element • Ai: position i • If N=0, then empty list • Linearly ordered • Ai precedes Ai+1 • Ai follows Ai-1

  6. Operations • printList: print the list • makeEmpty: create an empty list • find: locate the position of an object in a list • list: 34,12, 52, 16, 12 • find(52)  3 • insert: insert an object to a list • insert(x,3)  34, 12, 52, x, 16, 12 • remove: delete an element from the list • remove(52)  34, 12, x, 16, 12 • findKth: retrieve the element at a certain position

  7. Implementation of a List • Choose a data structure to represent the list ADT • E.g. arrays, records, etc. • Each operation associated with the list is implemented by one or more subroutines • Two standard implementations for the list ADT • Array-based • Linked list

  8. Lists with Arrays • Elements are stored in contiguous array positions

  9. Array Implementation • Requires an estimate of the maximum size of the list • waste space • printList and find: O(n) • findKth: O(1) • insert and delete: O(n) • e.g. insert at position 0 (making a new element) • requires first pushing the entire array down one spot to make room • e.g. delete at position 0 • requires shifting all the elements in the list up one • On average, half of the lists needs to be moved for either operation

  10. Lists with Pointers (Linked Lists) • Ensure that the list is not stored contiguously • use a linked list • a series of structures that are not necessarily adjacent in memory • Each node contains the element and a pointer to a structure containing its successor • the last cell’s next link points to NULL • Compared to the array implementation, • the pointer implementation uses only as much space as is needed for the elements currently on the list • but requires space for the pointers in each cell

  11. Head A C B A node data pointer Linked Lists • A linked listis a series of connected nodes • Each node contains at least • A piece of data (any type) • Pointer to the next node in the list • Head: pointer to the first node • The last node points to NULL

  12. Pointer Implementation • Requires no estimate of the maximum size of the list • No wasted space • printList and find: O(n) • findKth: O(n) • insert and delete: O(1) • e.g. insert at position 0 (making a new element) • Insert does not require moving the other elements • e.g. delete at position 0 • requires no shifting of elements • Insertion and deletion becomes easier, but finding the Kth element moves from O(1) to O(n)

  13. The Stack ADT • The Stack ADT stores arbitrary objects • Insertions and deletions follow the last-in first-out (LIFO) scheme • Think of a spring-loaded coin dispenser • Main stack operations: • push(object): inserts an element • object pop(): removes and returns the last inserted element • Auxiliary stack operations: • object top(): returns the last inserted element without removing it • integer size(): returns the number of elements stored • boolean isEmpty(): indicates whether no elements are stored • Suited to arrays (the top element is the kth one) !!

  14. The Queue ADT • The Queue ADT stores arbitrary objects • Insertions and deletions follow the first-in first-out (FIFO) scheme • Insertions are at the rear of the queue and removals are at the front of the queue (think of a line in a cashier) • Main queue operations: • enqueue(object): inserts an element at the end of the queue • object dequeue(): removes and returns the element at the front of the queue • Auxiliary queue operations: • object front(): returns the element at the front without removing it • integer size(): returns the number of elements stored • boolean isEmpty(): indicates whether no elements are stored • Exceptions • Attempting the execution of dequeue or front on an empty queue throws an EmptyQueueException • Suited to pointers (both ends need to be controlled) !!

  15. 849 PVD 1843 ORD 142 SFO 802 LGA 1743 337 1387 HNL 2555 1099 1233 LAX 1120 DFW MIA Graph ADT • A graph is a pair (V, E), where • V is a set of nodes, called vertices • E is a collection of pairs of vertices, called edges • Example: • A vertex represents an airport and stores the three-letter airport code • An edge represents a flight route between two airports and stores the mileage of the route

  16. flight AA 1206 ORD PVD 849 miles ORD PVD Edge Types • Directed edge (arc) • ordered pair of vertices (u,v) • first vertex u is the origin • second vertex v is the destination • e.g., a flight • Undirected edge • unordered pair of vertices (u,v) • e.g., a flight route • Directed graph • all the edges are directed • e.g., route network • Undirected graph • all the edges are undirected • e.g., flight network

  17. Operations • Update methods • insertVertex(o): insert a vertex storing element o • insertEdge(v, w, o): insert an edge (v,w) storing element o • removeVertex(v): remove vertex v (and its incident edges) • removeEdge(e): remove edge e • Iterator methods • incidentEdges(v): edges incident to v • vertices(): all vertices in the graph • edges(): all edges in the graph • Vertices and edges • are positions • store elements • Accessor methods • endVertices(e): the two endvertices of e • opposite(v, e): the vertex opposite of v on e • areAdjacent(v, w): true iff v and w are adjacent • replace(v, x): replace element at vertex v with x • replace(e, x): replace element at edge e with x

  18. 849 PVD 1843 ORD 142 SFO 802 LGA 1743 337 1387 HNL 2555 1099 1233 LAX 1120 DFW MIA Graphs with Arrays Edge connectivity Vertices

  19. Array Implementation • Requires an estimate of the maximum size of the vertices • waste space (besides memory size is quadratic to the number of vertices) • areAdjacent: O(1) • IncidentEdges: O(n) • insert and removeVertex: O(n)- similar to lists, but both arrays must be re-arranged

  20. Graphs with Arrays of Lists • type lisgraph= array [1, 2, …, nnodes] of record value: information neighbors: linked_list • Node[4]= {value=DFW; neighbors= {LAXORDLGAMIA} Obs. record  structure

  21. Array of Lists Implementation • Requires also an estimate of the maximum size of the vertices • waste space • A graph with few edges favors this scheme • areAdjacent: O(n) • IncidentEdges: O(k) (depends on the size of the lists) • insert and removeVertex: O(n), but only one array must be re-arranged

  22. Rooted Tree ADT • A tree is a collection of nodes • The collection can be empty • (recursive definition) If not empty, a tree consists of a distinguished node r (the root), and zero or more nonempty subtrees T1, T2, ...., Tk, each of whose roots are connected by a directed edge from r

  23. A C D B subtree E G H F K I J Terminology • Subtree: tree consisting of a node and its descendants • Root: unique node without a parent • Internal node: node with at least one child (A, B, C, F) • External node (a.k.a. leaf): node without children (E, I, J, K, G, H, D) • Ancestors of a node: parent, grandparent, great-grandparent, … • Descendant of a node: child, grandchild, great-grandchild, etc. • Depth of a node: number of ancestors • Height of a tree: maximum depth of any node (3)

  24. Operations • We use positions to abstract nodes • Generic methods: • integer size() • boolean isEmpty() • Iterator elements() • Iterator positions() • Accessor methods: • position root() • position parent(p) • positionIterator children(p) • Query methods: • boolean isInternal(p) • boolean isExternal(p) • boolean isRoot(p) • Update method: • object replace (p, o) • Additional methods may be defined by data structures implementing the Tree ADT

  25. Binary Tree ADT • A binary tree is a set T of nodes such that either • T is empty, or • T is partitioned into three disjoint subsets: • A single node r, the root • Two possibly empty sets that are binary trees, called left and right subtrees of r

  26. Binary Trees - Example • Operations are similar to the general trees’ ones !!

  27. Binary Search Trees • A binary search tree • A binary tree that has the following properties for each node n • n’s value is greater than all values in its left subtree TL • n’s value is less than all values in its right subtree TR • Both TL and TR are binary search trees

  28. Binary Search Trees - Example • Alphabetical ordering !

  29. Array Implementation - 1 • An array-based representation of a complete tree • A binary tree is represented by using an array of tree nodes • If the binary tree is complete and remains complete, then, a memory-efficient array-based implementation can be used • Requires the creation of a free list which keeps track of available nodes

  30. Array Implementation - 2

  31. Pointer Implementation - 1 • A very simple way to implement a tree is to have each node store a reference to its left and right children • An alternative form is to have each node store a reference to its parent • Could also be used to store information about cities on roads, circuits on a board, etc.

  32. Pointer Implementation - 2

  33. Greedy Algorithms Algorithm is greedy if : • it builds up a solution in small steps • it chooses a decision at each step myopically to optimize some underlying criterion Analyzing optimal greedy algorithms by showing that: • in every step it is not worse than any other algorithm, or • every algorithm can be gradually transformed to the greedy one without hurting its quality

  34. Minimum Spanning Tree Problem • A minimum spanning tree is a least-cost subset of the edges of a graph that connects all the nodes 6 Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) rejected 3-2 (3) {1},{2,3,4,5,6} 3-1 (3) {1,2,3,4,5,6} Edge Connected Components - {1},{2},{3},{4},{5},{6} Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) rejected 3-2 (3) {1},{2,3,4,5,6} 3-1 (3) Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) rejected Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) rejected 3-2 (3) Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) {1},{2},{3,4,5,6} 5-4 (3) rejected 3-2 (3) {1},{2,3,4,5,6} Edge Connected Components - {1},{2},{3},{4},{5},{6} 6-5 (2) {1},{2},{3},{4},{5,6} 5-3 (2) {1},{2},{4},{3,5,6} 4-3 (2) 4 2 1 4 5 3 2 3 3 3 2 3 4 2 4

  35. Greedy Algorithm – General Model • Set C of candidates (not used) • Solution Set S=  While S  final_solution and C  { x is a “maximized” element of C; select (x) C  C-{x} If (S {x}) is acceptable then SS {x} } If S= final_solution then return (S) } else return (there is no solution)

  36. Divide and Conquer • A divide and conquer algorithm consists of two parts: • Divide the problem into smaller subproblems of the same type, and solve these subproblems recursively • Combine the solutions to the subproblems into a solution to the original problem • Traditionally, an algorithm is only called “divide and conquer” if it contains at least two recursive calls

  37. D & C- Example and Counter-example • Quick Sort: • Partition the array into two parts (smaller numbers in one part, larger numbers in the other part) • Quicksort each of the parts • No additional work is required to combine the two sorted parts • Binary tree Look-up: • Compare the key to the value in the root • If the two values are equal, report success • If the key is less, search the left subtree • If the key is greater, search the right subtree • This is not a divide and conquer algorithm because, although there are two recursive calls, only one is used at each level of the recursion

  38. Traversing Graphs and Trees- DFS • A depth-first search (DFS) explores a path all the way to a leaf before backtracking and exploring another path • For example, after searching A, thenB, then D, the search backtracks and tries another path from B • Node are explored in the order A B D E H L M N I O P C F G J K Q • N will be found before either I or J A B C D E F G H I J K L M N O P Q

  39. How to Depth-First Search • Start at root_node (any first node if graph) • If (node  marked) then dfs(node) // mark is important in graphs dfs (v) mark v; for each node w adjacent to v if (w  marked) then dfs(w);

  40. Traversing Graphs and Trees- BFS • A breadth-first search (BFS) explores nodes nearest the root before exploring nodes further away • For example, after searching A, then B, then C, the search proceeds with D,E,F,G • Node are explored in the order A B C D E F G H I J K L M N O P Q • J will be found before N A B C D E F G H I J K L M N O P Q

  41. How to Breadth-First Search • Start at root_node (any first node if graph) • If (node  marked) then bfs(node) // mark is important in graphs bfs (v) ENQUEUE (v, Q) ; // Q is a queue while (Q ) u FIRST(Q); DEQUEUE (u, Q); for each w adjacent to u if (w  marked) then mark w; ENQUEUE (w,Q)

  42. A B C D E F G H J I Exploring Graphs-1 Pre-order traversal (with dfs) • Node processing first • Left node (and descendents) processing • Other children node (and descendents) processing Sequence of processing: A, B, D, E H, I, J, C, F, G

  43. A B C D E F G H J I Exploring Graphs-2 Post-order traversal (with dfs) • Left node (and descendents) processing first • Other children node (and descendents) processing • Node processing Sequence of processing: D, H, I, J, E B, F, G, C, A

  44. A B C D E F G H J I Exploring Graphs-3 In-order traversal (with dfs) • Left node (and descendents) processing first • Node processing • Other children node (and descendents) processing Sequence of processing: D, B, H, E I, J, A, F, C,G

  45. Branch and Bound Algorithms • Branch and bound algorithms are generally used for optimization problems • As the algorithm progresses, a tree of subproblems is formed • The original problem is considered the “root problem” • A method is used to construct an upper and lower bound for a given problem • At each node, apply the bounding methods • If the bounds match, it is deemed a feasible solution to that particular subproblem • If bounds do not match, partition the problem represented by that node, and make the two subproblems into children nodes • Continue, using the best known feasible solution to trim sections of the tree, until all nodes have been solved or trimmed

  46. Branch and Bound Algorithms- Example • Traveling salesman problem: A salesman has to visit each of n cities once each, and wants to minimize total cost traveled 1 2 3 4 5 Cost of a direct travel from one city to another: Departing from 1 and arriving in 5 : 20 Departing from 5 and arriving in 1 : 18 1 2 3 4 5

  47. 4 4 2 2 Example- Computing Partial Costs-1 • To specify partial paths • To explore the most promising conditions first • Define the probable minimal cost for arriving • Define the probable minimal cost for departing • OBS. From A to B, half of the value depends on the arrival at B and half on the departure froma A 1 5 7 2 2 2 4 4 3 2 4 2 2 5 2 2 2 4 4 2 2

  48. 4 2 Example- Computing Partial Costs-2 • Suppose the journey starts at city 1 • The initial cost (actually eual for any starting city is 40/2 = 20 • Next step- computing any one of the possible paths: • 12: (in this case, we know that (13,4,5), (3,4,52) and (21) are not possible anymore and we re- compute the nodes costs • Cost= 14 (2) +17 (others) = 31 N.A. 1 2 3 4 5 1 7 N.A. 2 2 4 7 3 2 2 1 2 3 4 5 2 4 4 2 2 4 2 5 2 2

  49. 1,2 Bound 31 1,3 Bound 24 1,4 Bound 29 1,5 Bound 41 1,3,2 Bound 24 1,3,4 Bound 30,5 1,3,5 Bound 40,5 1,4,2 Bound 40 1,4,3 Bound 41,5 1,4,5 Bound 29 1,4,5,2 Bound 30 1,4,5,3 Bound 48 1,3,2,4 Bound 37 1,3,2,5 Bound 31 1,4,5,2 Bound 30 1,3,2,5 Bound 31 Example- Computing Partial Costs-3 1 Bound 20 1,3,2,5 Bound 31

More Related