Changeset 4009 for proto/s2k/trunk


Ignore:
Timestamp:
Aug 16, 2014, 6:04:24 PM (5 years ago)
Author:
ksherdy
Message:

Added description. Initial binding strategy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/s2k/trunk/framework/input/test/s2k/proto/grep/grep_flow.s2k

    r3840 r4009  
     1/*
     2 * grep exact-string search C++ in \s2k{}.
     3 *
     4 * Description:
     5 *
     6 * The \s2k{} grep exact-string search demo is organized into the following
     7 * pipeline stages.
     8 * 
     9 * Stage 1 - Read`
     10 * Stage 2 - Transpose~
     11 * Stage 3 - ClassifyBytes~
     12 * Stage 4 - Match~
     13 * Stage 5 - MatchLines~
     14 * Stage 6 - Write`
     15 *
     16 * Trailing tildes characters `~' indicate pipeline stages written in \s2k{}.
     17 * Trailing back ticks `'', indicate stages defined within the
     18 * \s2k{} C++ templates file, 'grep.template'.
     19 *
     20 * The \s2k{} program defines the following program elements.
     21 *
     22 * 1. Stream structures Lex and Output.
     23 *
     24 * 2. Stream functions ClassifyBytes, Match, and MatchLines.
     25 * ClassifyBytes defines \s2k{} equations for each of the character
     26 * classes encountered in the fixed string `apple' and line feeds.
     27 * In this example, the generation of character class bit stream
     28 * equations is automated using the character class compiler tool.
     29 * Match defines \s2k{} equations to match the fixed string `apple'
     30 * and line feeds.
     31 *
     32 * 3. Stream `graph' of stream filters.
     33 *
     34 *
     35 * The Pablo compiler translates Pablo code to C++ code as follows.
     36 *
     37 * 1. \s2k{} stream structures to C/C++ structures, i.e., simple data containers.
     38 *
     39 * 2. \s2k{} stream functions to C/C++ structures, i.e., objects with methods.
     40 *    C/C++ structures are generated with `do_block', `do_final_blocks', `clear'
     41 *    member functions, as well as member variables to capture
     42 *    the propagation of state information across segment and register
     43 *    boundaries for block-by-block stream computations.
     44 *
     45 * 3. \s2k{} `graph' method to sequence of stream function `do_block',
     46 *    `do_final_block', and `clear' function calls.
     47 */
     48
    149/*
    250struct Basis_bits{
     
    83131}
    84132
     133// pgather
    85134/*
    86 filter Demo(struct Output output) {
    87         stream m = output.match_follows;
    88         int c = 0;
    89     foreach (stream s) in (stream m) {         
    90         printf("%d", c);
    91         c = c + 1;
    92        
    93     }   
     135filter Write(struct Output output) {
     136  stream<8> lines = pgather<8>(output.lines);
     137  write<8>(oaddr, lines);
    94138}
    95139*/
    96  
     140
     141// post-processing
     142/*
     143filter Write(struct Output output) {
     144  write<1>(oaddr, output.line_starts);
     145  write<1>(oaddr, output.line_ends);
     146  write<1>(oaddr, output.match_follows);
     147}
     148*/
     149
    97150graph Main() {
    98151
     
    102155    struct Output output;
    103156   
     157//  filter Read src;
    104158    filter Transpose transpose;
    105159    filter ClassifyBytes classifyBytes;
    106160    filter Match match;
    107161    filter MatchLines matchLines;
    108 //    filter Demo demo;
     162//  filter Write snk; // bind<1>(output.line_starts, line_starts); bind<1>(output.line_ends, line_ends); bind<1>(output.match_follows, match_follows);
    109163
     164//  read();
    110165    transpose(byte_data, basis_bits);
    111166    classifyBytes(basis_bits, lex);
    112167    match(lex, output);
    113168    matchLines(lex, output);
    114 //    demo(output);
     169//  write(output);
    115170   
    116171}
     172
Note: See TracChangeset for help on using the changeset viewer.