1 / 15

Regular expressions to fsms

Regular expressions to fsms. hardware and software techniques Paul Cockshott. Extended regular grammars. Sequence abe Alternation a|b|E Charset [a-z] Zero or more x* One or more x+. Sequence abe Alternation a|b|E Charset [a-z] Zero or more x* One or more x+. Sequence Alternation

jace
Download Presentation

Regular expressions to fsms

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. 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. 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+ Reduced forms - ε is the null character

  4. Map to state machines • Sequence abc 3 a 1 c 2 b

  5. Map alternation A|x|p A p x

  6. Map A+|b A A b

  7. FSM Implementations

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

  9. PLA with latch Input char State latch Next state Action code clock Product lines Or plane And plane

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

  11. Or plane P or q p p q

  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. instruction Fsm table + State sel State line Last char index Char col First char index reg Current char hit RAM based FSM Source data 8 bits 1 6bits 8 bits

  14. Add char class map instruction Fsm table + State sel State line Last char index Char col First char index reg Current char 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.

More Related