Presentation is loading. Please wait.

Presentation is loading. Please wait.

Regular expressions to fsms \hardware and software techniques Paul Cockshott.

Similar presentations


Presentation on theme: "Regular expressions to fsms \hardware and software techniques Paul Cockshott."— Presentation transcript:

1 Regular expressions to fsms \hardware and software techniques Paul Cockshott

2 Extended regular grammars Sequence abe Alternation a|b|E Charset [a-z] Zero or more x* One or more x+

3 Reduced forms Sequence abe Alternation a|b|E Charset [a-z] Zero or more x* One or more x+ Sequence Alternation -> a|b|c|d…. x+| ε x+ - ε is the null character

4 Map to state machines Sequence abc a b c

5 Map alternation A|x|p A x p

6 Map A+|b A A b

7 FSM Implementations PLAHardware State table in RAMHardwareSoftware State table with class table Software

8 Hardware and software FSMs Hardware Interpreting machine code in a cpu Interpreting network addresses in a router chip Software Compilers Software routers Protocol analysers

9 PLA with latch Input charState latch clock Next state Action code And plane Or plane Product lines

10 AND plane ~a a ~b b true and complement lines a AND ~b b

11 Or plane p q P or qp

12 Advantage of PLA Very fast – uses the minimum logic Lends itself to logic minimisation Efficient layout on silicon Method of choice for parsing simple regular grammars at > cpu speeds in instruction decode units

13 RAM based FSM 1 Source data + Fsm table First char index reg Last char index instruction State sel Current char State line Char col hit 8 bits 6bits 8 bits

14 Add char class map + Fsm table First char index reg Last char index instruction State sel Current char State line Char col hit Char class map

15 Advantages of char class map Reduces the size of the FSM table. If we have n states we would otherwise require 256n locations in table. With char class map we require c x n where c is the number of distinct character classes in the grammar.


Download ppt "Regular expressions to fsms \hardware and software techniques Paul Cockshott."

Similar presentations


Ads by Google