Sequential System Synthesis -- State Encoding. ENEE 6442 The State Encoding Problem > Goal: Given n states, assign a unique code (of length of at least.

Slides:



Advertisements
Similar presentations
Escola Politécnica da Universidade de São Paulo GSEIS - LME Logic Synthesis in IC Design and Associated Tools Sequential Synthesis Wang Jiang Chau Grupo.
Advertisements

Recognising Languages We will tackle the problem of defining languages by considering how we could recognise them. Problem: Is there a method of recognising.
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
CS 336 March 19, 2012 Tandy Warnow.
Synthesis For Finite State Machines. FSM (Finite State Machine) Optimization State tables State minimization State assignment Combinational logic optimization.
1 Steps towards State assignment Slides of Mark Schulz used.
Size-estimation framework with applications to transitive closure and reachability Presented by Maxim Kalaev Edith Cohen AT&T Bell Labs 1996.
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
CSL758 Instructors: Naveen Garg Kavitha Telikepalli Scribe: Manish Singh Vaibhav Rastogi February 7 & 11, 2008.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
CS447/ECE453/SE465 Prof. Alencar University of Waterloo 1 CS447/ECE453/SE465 Software Testing Tutorial Winter 2008 Based on the tutorials by Prof. Kontogiannis,
Encoding xsxs 0101 AAB00 BAC00 CDC00 DAB01 Variant I A = 00 B = 01 C = 10 D = 11 Variant II A = 00 B = 11 C = 01 D = 10 Variant II Variant I.
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Sequential System Synthesis -- Finite State Machine.
FSM Decomposition using Partitions on States 290N: The Unknown Component Problem Lecture 24.
ECE Synthesis & Verification - Lecture 19 1 ECE 667 Spring 2009 ECE 667 Spring 2009 Synthesis and Verification of Digital Systems Functional Decomposition.
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
CS 140L Lecture 7 Professor CK Cheng 11/12/02. Transformation between Mealy and Moore Machines Algorithm: 1) For each NS, z = S i, j create a state S.
COE 561 Digital System Design & Synthesis Sequential Logic Synthesis Dr. Aiman H. El-Maleh Computer Engineering Department King Fahd University of Petroleum.
Orderings and Bounds Parallel FSM Decomposition Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 10 Update and modified by Marek.
ECE 667 Synthesis and Verification of Digital Systems
Logic gate level Part 3: minimizing circuits. Improving circuit efficiency Efficiency of combinatorial circuit depends on number & arrangement of its.
GRAPH Learning Outcomes Students should be able to:
Zvi Kohavi and Niraj K. Jha 1 Capabilities, Minimization, and Transformation of Sequential Machines.
Zvi Kohavi and Niraj K. Jha 1 Memory, Definiteness, and Information Losslessness of Finite Automata.
Zvi Kohavi and Niraj K. Jha 1 Structure of Sequential Machines.
Chapter 4 Relations and Digraphs
Lecture 9 Query Optimization.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
Chapter 1 Fundamental Concepts Introduction to Graph Theory Douglas B. West July 11, 2002.
Relations and their Properties
1/24 Introduction to Graphs. 2/24 Graph Definition Graph : consists of vertices and edges. Each edge must start and end at a vertex. Graph G = (V, E)
Chapter 7. Trees Weiqi Luo ( 骆伟祺 ) School of Software Sun Yat-Sen University : Office : A309
Equivalence Relations
Graphs Upon completion you will be able to:
Chapter 8. Sequential machine. Sequential machine M = ( I, O, S, , ) I : set of input O : set of output S : set of states  (state transition) : I 
Great Theoretical Ideas in Computer Science for Some.
Huffman code and Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
COMPSCI 102 Introduction to Discrete Mathematics.
Introduction to NP Instructor: Neelima Gupta 1.
Week 11 - Wednesday.  What did we talk about last time?  Graphs  Paths and circuits.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
CHAPTER SIX T HE P ROBABILISTIC M ETHOD M1 Zhang Cong 2011/Nov/28.
Capabilities, Minimization, and Transformation of Sequential Machines
Relations and Their Properties
More NP-Complete and NP-hard Problems
Finite state machine optimization
Finite state machine optimization
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Basic Concepts Graphs For more notes and topics visit:
Chapter 5. Greedy Algorithms
CS2100 Computer Organisation
Sequential logic design principles
3-7 Other Two-level Implementations
Lectures on Network Flows
Mathematical Structures for Computer Science Chapter 6
COE 561 Digital System Design & Synthesis Sequential Logic Synthesis
Synthesis of sequential circuits
Synthesis and Verification of Finite State Machines
Graphs Chapter 11 Objectives Upon completion you will be able to:
Synthesis and Verification of Finite State Machines
Interval Partitioning of a Flow Graph
Heuristic Minimization of Two Level Circuits
Discrete Mathematics for Computer Science
Relations: The Second Time Around
CSE 370 – Winter Sequential Logic-2 - 1
CS 201 Compiler Construction
Presentation transcript:

Sequential System Synthesis -- State Encoding

ENEE 6442 The State Encoding Problem > Goal: Given n states, assign a unique code (of length of at least  log n  ) to each state such that the cost of binary logic level implementation is minimized. (state assignment problem) > Cost of the implementation: =Number of literals =Speed =Testability

ENEE 6443 Example: Why State Encoding Matters? > Consider a fragment of the cube table for an FSM: =Let y 1 y 2 and Y 1 Y 2 be the current state and next state. We want to represent Y 1,Y 2, and output O as a function of y 1,y 2, and input x. 1CB0 1CA0ONSCSx =Assignment 1: A=01, B=10, C=11 Y 1 =…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… Y 2 =…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… O=…+x’y 1 ’y 2 +…+x’y 1 y 2 ’+… O Y1Y2Y1Y2Y1Y2Y1Y2 y1y2y1y2y1y2y1y2x O Y1Y2Y1Y2Y1Y2Y1Y2 y1y2y1y2y1y2y1y2x =Assignment 2: A=00, B=10, C=11 Y 1 =…+x’y 1 ’y 2 ’+…+x’y 1 y 2 ’+…=…+x’y 2 ’+…

ENEE 6444 Lessons We Have Learned > Two codes are adjacent if they only differ in one bit. (e.g. 00 and 01 are adjacent, 01 and 10 are not.) > Any k-bit code has k adjacent codes. > If two states are given adjacent codes, we will be able to extract common cubes from the next state and output functions. =Common fanout (next) state =Common fanin (current) state > Identify pairs that should receive adjacent codes. 1CAb 1BAaONSCSx

ENEE 6445 Attraction Graph > The attraction graph of a FSM is a weighted, undirected, complete graph that represents the attraction between each pair of states. =Node: state =Edge: the attraction between the two states > If two states share a common fanout/fanin state, their attraction should increase. > Two states that have a strong attraction should be assigned adjacent codes. > How to measure the attraction quantitatively?

ENEE 6446 Fanout-Oriented Algorithm > State Transition Matrix S |s|x|s| : =Row: one per (current) state =Column: one per (next) state =Entry: (non-negative) number of arcs going from state s i (row) to state s j (column) > Output Matrix Z |s|x|O| : =Row: one per (current) state =Column: one per output =Entry: (non-negative) number of arcs going out of state s i (row) with output z j (column) > Let N b be the number of encoding bits, then the attraction between states s i and s j is given by N b S i S j T +Z i Z j T =W(1,2) = 2(1 1 0)(1 0 1) T +(1)(0) T =2 =W(1,3) = 2(1 1 0)(1 0 1) T +(1)(1) T =3 =W(2,3) = 2(1 0 1)(1 0 1) T +(0)(1) T =4 A C B 1/1 1/0 0/0 1/1 0/0 0/0 A C B 3 4 2

ENEE 6447 Fanin-Oriented Algorithm > State Transition Matrix S |s|x|s| : =Row: one per (next) state =Column: one per (current) state =Entry: (non-negative) number of arcs going from state s j (column) to state s i (row) > Input Matrix X |s|x|I| : =Row: one per (current) state =Column: |I| per input =Entry: (non-negative) number of arcs entering state s i (row) with input x j (column) > Let N b be the number of encoding bits, then the attraction between states s i and s j is given by N b S i S j T +X i X j T =W(1,2) = 2(1 1 1)(1 0 0) T +(2 1)(0 1) T =3 =W(1,3) = 2(1 1 1)(0 1 1) T +(2 1)(1 1) T =7 =W(2,3) = 2(1 0 0)(0 1 1) T +(0 1)(1 1) T =1 A C B 1/1 1/0 0/0 1/1 0/0 0/0 A C B ^^^

ENEE 6448 The Encoding Algorithm > Given the attraction graph (matrix W(i,j)), assign a unique N b -bit code to each state. =For each node s i, find the N b largest attractions W(i,j) and sum them up; =Pick the one with the largest sum and assign it code 0…0; =Assign the N b adjacent codes of 0…0 to the N b neighbor states that have the N b largest attractions; =Remove the N b +1 node and repeat until all nodes get a N b -bit code;

ENEE 6449 Example: The Encoding Algorithm A C B A C B Fanout-Oriented Algorithm: A C B A C B Fanin-Oriented Algorithm: Y 1 =y 1 ’y 2 x Y 2 =y 1 ’y 2 x + y 1 y 2 ’x’ + y 1 ’y 2 ’x Z = y 1 ’x (13 literals) A C B 1/1 1/0 0/0 1/1 0/0 0/0 Y 1 =y 1 ’y 2 x’ + y 1 ’y 2 x Y 2 =y 1 ’y 2 ’x Z = y 2 ’x (11 literals)

ENEE Decomposition and Encoding: Motivation > There are many different ways to encode a FSM with four states: {A,B,C,D}. > If we know that pairs (A,B),(C,D); (A,C),(B,D) should receive adjacent codes, then there are only 8 different assignments: =A=00, B=01, C=10, D=11 =A=00, B=10, C=01, D=11 =A=01, B=00, C=11, D=10 =A=01, B=11, C=00, D=10 =A=10, B=11, C=00, D=01 =A=10, B=00, C=11, D=01 =A=11, B=01, C=10, D=00 =A=11, B=10, C=01, D=00

ENEE Notations on Partitions > A partition  on a set S is a collection of disjoint subsets (called blocks) of S whose union is S. =  ={(1,2),(3,4,6),(5,8),(7)} is a partition of S={1,2,3,4,5,6,7,8} =0={(1),(2),(3)} and 1={(1,2,3)} are two trivial partitions of S={1,2,3} =For s,t  S, s  t (  ) means that they belong to the same block of partition  =For two partitions  1 and  2, their meet  1  2 is also a partition where s  t (  1  2 ) iff s  t (  1 ) and s  t (  2 ); their join  1 +  2 is the partition where s  t (  1 +  2 ) iff there exists a sequence in S: s=s 0,s 1,…,s n =t, such that for all i=0,…n-1, either s i  s i+1 (  1 ) or s i  s i+1 (  2 ). =Given  1 ={(1,2),(3,4,6),(5,8),(7)},  2 ={(1,6),(2,5,8),(3,4,7)},  1  2 ={(1),(2),(3,4),(5,8),(6),(7)},  1 +  2 ={(1,2,3,4,5,6,7,8)}

ENEE Substitution Property > A partition  on set S of machine M= has the substitution property (S.P.) iff s  t(  ) implies that  (s,a)  (t,a)(  ) for all a  I. > Theorem. A sequential machine M has a non- trivial parallel decomposition of its states iff there exist two non-trivial S.P. partitions  1 and  2 on M such that meet  1  2 =0. > Theorem. IF a sequential machine has one non- trivial S.P. partition, then it has a non-trivial serial decomposition.

ENEE Parallel Decomposition >  1 = {(0,1,2),(3,4,5)} and  2 ={(0,5),(1,4),(2,3)} are two S.P. partitions and  1  2 =0. > Let A=(0,1,2), B=(3,4,5), and X=(0,5),Y=(1,4),Z=(2,3), we can build two machines. > The output, in this case, is the product of the outputs of the two newly built machines BAB 0ABA101YYZ 0ZXY 0ZZX10 G1G1G1G1 G2G2G2G2

ENEE Serial Decomposition >  1 = {(1,2,3),(4,5)} is the only S.P. partition. > We choose another partition  2 ={(1,4),(2,5),(3)} s.t.  1  2 =0. > Let A=(1,2,3), B=(4,5), and X=(1,4),Y=(2,5),Z=(3), we can rebuild this machine as G1G1G1G1 G2G2G2G2 10YYB,Y 11XZB,X 00XYA,Z 01YZA,Y 01XXA,X XYZ 1001YYYZY 1101XZXXX B1B1B1B1 B0B0B0B0 A1A1A1A1 A0A0A0A0 B1B1B1B1 B0B0B0B0 A1A1A1A1 A0A0A0A0

ENEE Computation of the S.P. Partition > Recall that “ A partition  on set S of machine M= has the substitution property (S.P.) iff s  t(  ) implies that  (s,a)  (t,a)(  ) for all a  I.” > So S.P. partition is independent of output > If (1,2)  (1,4),(2,3)  (1,2,3,4) (transitivity)  {(1,2,3,4,5)} trivial. > If (1,3)  (1,5)  (1,3,5)  (2,3)  (1,2,3,5)  (1,2,3,4,5) trivial. > If (1,4), form a block. > If (2,3)  (4,5)  (1,4,5)  {(1,4,5),(2,3)} > If (2,5)  (1,4)  {(1,4),(2,5),(3)} > If (2) > if (3,5)  (1,5),(2,3), contradiction. > If (3)  {(1,4),(2),(3),(5)} > Another partition: {(1),((2,3),(4,5)}

ENEE Decomposition and State Encoding > We need two bits xy to encode a sequential state machine M with four states: A,B,C,D. > Suppose  1 ={(A,B), (C,D)} and  2 ={(A,C),(B,D)} are two non-trivial S.P. partitions. > Clearly  1  2 =0 so we have a non-trivial parallel decomposition, M 1 ={ab,cd} and M 2 ={ac,bd}, both with only two states. > If we use bit x to encode M 1 and bit y to encode M 2 as ab=0, cd=1; and ac=0, bd=1. > Then M can be encoded as A=00,B=01,C=10,D=11. > SE problem becomes finding S.P. partitions and applying parallel/serial decompositions.