source: proto/parabix2/Compiler/README @ 351

Last change on this file since 351 was 351, checked in by eamiri, 9 years ago

REAMDME updated
subtraction macro added to template

File size: 2.6 KB
Line 
1This directory contains code for Bit Stream Compiler. This compiler transforms high level python code to C code. The input python file must be written using Parallel Bit Stream idea and only operations on parallel bit streams can be used in the input file. The compiler can be run useing the following command
2
3python bitstream_compiler.py <input file> [output file]
4
5User must input an input file name. This must be a valid python file that only includes operations defined for parallel bit streams. The input file must contain a function named "main".
6
7Output filename is optional. If it is not specified by uesr, the name "code.c" will be used. This file must be compiled using g++. Using gcc to compile this file produces error. It is recommended to use optimiztion flag -O3 when compiling this file.
8
9
10=====================================
11Variables:
12    In any program compilable by this compiler all variables are assumed to be bit streams, arrays of bitstreams or structures of bitstreams.
13
14Valid operations on bit streams:
15    Bitwise logical operations:
16        And
17        Or
18        Xor
19        And-Not (&~)
20
21    Predefind Functions:
22        Advance
23        ScanThru
24
25    Pragmas:
26        optimize pragma
27       
28    Loops:
29        while loop
30   
31    Function calls:
32        Normal python function call
33   
34    Module importing:
35        Simple form of module importing
36
37=====================================
38Loops:
39    The current valid form is: while var > 0 for bitstream var.
40
41Function Calls:
42    Currently function calls must be of the following form: var = func(params)
43    params is a list of positional arguments. Keyword arguments are not currently supported.
44    func is the function name. It must return a single variable bitstream variable.
45    All the functions will be inlined in the output C code.
46    Function calls are only allowed within "main" function. No other function call is allowed, except calling predefined functions.
47
48Module importing:
49    The following format is accepted currently, but implementation is not yet finished: import module_name[,module_name]
50
51=====================================
52OTHER CONSTRAINTS:
53    There should be one and only one return statement within the main function. This statement variables values of which is needed in other parts of the output program. A variables with name 'error_mask' is always assumed to be used in other parts of the output program. (This does not mean that your program should have a variable with this name). If you have a variable that specifies error locations, it is recommended to be named 'error_mask'.
54       
Note: See TracBrowser for help on using the repository browser.