character matching character matching systolic design — character matching a straightforward...

32
Character Character Matching Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters (string) is simple but time-consuming. The following algorithm shows the sequence of operations. The algorithm compares the characters in the pattern against the characters in the text from left to right. This simple algorithm has a time complexity of O(m*n) where m and n are the lengths of the pattern and text.

Post on 20-Dec-2015

248 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Character MatchingCharacter MatchingSystolic Design — Character Matching

A straightforward approach to search for a pattern within a string of characters (string) is simple but time-consuming.

The following algorithm shows the sequence of operations.

The algorithm compares the characters in the pattern against the characters in the text from left to right.This simple algorithm has a time complexity of O(m*n) where m and n are the lengths of the pattern and text.

Page 2: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design Systolic Design — Character Matching— Character Matching

Search for a Pattern

T-index 0;While T-index < (n-m+1) DO

Save T-index;P-index 0;While P-index < m and Textsave = PatternP-index DO

Save Save + 1;P-index P-index + 1;

ENDIf P-index = m then return;T-index T-index +1;

END

Page 3: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design Systolic Design — Character Matching— Character Matching

Concept of the finite state automaton can be used to perform pattern matching operation in a time complexity of O(n).

Knuth proposed an algorithm with the time complexity of O(m+n).

Page 4: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

The proposed model is used for character matching (pattern Matching) operation.

The model is composed of two kind of cells:Comparator cells, and

Accumulator cells.

Page 5: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

The comparator cells receive text and patterns from opposite directions and generate the Comparison results.

The accumulator cells transmit information regarding delimiters and "don't care" signals. In addition, it accumulates the partial match results.

Page 6: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design Systolic Design — Character Matching— Character Matching

C C C C

A A A A•••

••

Pin

Sout

in

Xin

r out

d1 d2 d3 dn

r in

Xout

out

Sin

Pout

tttt

Pattern

String

End ofPattern

Don't Care

Result

Page 7: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

Algorithm in C cells:

Pout Pin

Sout Sin

dout (Pin = Sin)

Page 8: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

Algorithm in A cells:

out in

Xout Xin

IF in THEN rout t; t True

ELSE rout rin; t t AND (Xin OR din)

Page 9: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

Detect pattern Detect pattern ISSIISSI in text in text MISSISSIPPI MISSISSIPPI in a in a systolic organization composed of seven cells.systolic organization composed of seven cells.

Page 10: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

Initial configuration

IPPISSISSIM

TEXT

ISSI

PATTERN

Page 11: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

MI

M

I

M

I

IS

MI

IS

Page 12: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

MI

IS

S S

MI

ISS S

MI

ISS

S S I

ISSS S I

Page 13: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

ISSIS S I I

Re-circulation

SSI

S I I

SSISS I I S

11

SISI I S

Page 14: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

SISSI I S S

II

S SS S

II

SS

SS

II

15

II

SS

S

S

Page 15: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

ISSI

SSP

ISI

SP18

IS

SP P I

IP P I

Page 16: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

II IPP

I P P

Page 17: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Character Matching

General CharacteristicsGeneral Characteristics

Hardware utilization is low, since during each clock pulse only half of the cells are active.

Patterns have to be cycled through the array continuously to meet all the text characters.

Possible detection of more hits in the input text.

Page 18: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Join Operation

Within the scope of relational databases, join is one of the most time consuming operations.

Page 19: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Assume we have two product-compatible relations (sets) A and B. Each relation is composed of several tuples (records).

Further, let , , , ..., then the -Join of relation A on attribute X with relation B on attribute Y is a relation consist of tuples t(<a,b>) from Cartesian product of A and B such that tx ty is true.

Systolic Organization

A B = a,b a,b A B, and tX tY is true

Page 20: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Join Operation

Assume we have the following two relations:

S# Sname Status CityS1 Smith 20 LondonS2 Jones 10 ParisS3 Blake 30 ParisS4 Clark 20 LondonS5 Adams 30 Athens

SP# Pname Color Weight CityP1 Nut Red 12 LondonP2 Bolt Green 17 ParisP3 Screw Blue 17 RomeP4 Screw Red 14 LondonP5 Cam Blue 12 ParisP6 Cog Red 19 London

P

Page 21: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Join Operation

S# Sname Status S.City P# Pname Color Weight P.CityS1 Smith 20 London P1 Nut Red 12 LondonS1 Smith 20 London P4 Screw Red 14 LondonS1 Smith 20 London P6 Cog Red 19 LondonS2 Jones 10 Paris P2 Bolt Green 17 ParisS2 Jones 10 Paris P5 Cam Blue 12 ParisS3 Blake 30 Paris P2 Bolt Green 17 ParisS3 Blake 30 Paris P5 Cam Blue 12 ParisS4 Clark 20 London P1 Nut Red 12 LondonS4 Clark 20 London P4 Screw Red 14 LondonS4 Clark 20 London P6 Cog Red 19 London

A S.City=P.City B

Page 22: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Join Operation

In relational database system, join operation is used as a measure to evaluate the performance of the system.

This is due to the Complexity of the join, and

application of join in de-normalizing the relations.

Page 23: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Let us look at a systolic model for join operation:

A collection of basic cells replicated in a two dimensional space.

System is highly parallel and satisfies the constraints imposed by the VLSI technology.

Systolic Design — Join Operation

Page 24: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

A Systolic Cella in

t in

b in

b out

t out

a out

a’s and b’s are the attributes andt is a control signal that reflectsthe comparison between a and b.

Systolic Design — Join Operation

Page 25: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

A Systolic Cell

a in

t in

b in

b out

t out

a out

Tout tin (ain bin)aout ain

bout bin

Systolic Design — Join Operation

Page 26: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

t41

t14

t13

• • •• • •• • •

Attributes of A relation in

Attributes of B relation in

Elements ofthe Bit Matrix

Systolic Design — Join Operation

Page 27: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

• • •

a11

b11

a12

• b12

Systolic Design — Join Operation

Page 28: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

• • •

a11

b11

a12

b12

a21

•b21

Systolic Design — Join Operation

Page 29: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

• • •

a11

b11

a22

a12

b12

• b22

a21

b21

Systolic Design — Join Operation

Page 30: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

Systolic Design — Join Operation

b11

• a22

a12

b12

b22

a21

b21

•b31

a11

a31

a23

•a13

• a14

•b23

b13

b14 •

Page 31: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

b11

a32

a22

a12b12

b22

a21

b21

b31

a11

• a31

•b32

a13

a14

b13

b14

b23

••b24

• a23

a24

Systolic Design — Join Operation

Page 32: Character Matching Character Matching Systolic Design — Character Matching A straightforward approach to search for a pattern within a string of characters

a 62

b 22

b 21 a 63

a 64

a 54

b 14

a 61

b 31

a 53

b 23

a 52

b 32

a 44

b 24

a 51

b 41

a 43

b 33

a 42

b 42

a 34

b 34

a 41

b 51

a 33

b 43

a 32

b 52

a 24

b 44

a 31

b 61

a 23b 53

a 22

b 62

a 14

b 54

t 14

t 23

t 32

t 41

t 31

t 22

t 13

t 12

t 21

t 11

a 21 b 63b 64

Systolic Design —

Join Operation