source: proto/Compiler/README @ 435

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

README update

File size: 3.6 KB
RevLine 
[434]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 using the following command
[350]2
[434]3python bitstream_compiler.py <input file> [output file] [options]
[350]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
[351]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=====================================
[434]11OPTIONS:
12
13-simd-carry: In generated C code, carry and borrows of addition and subtraction operations is saved in a vector. The default behaviour (-int-carry) saves these variable in integers.
14
15-t template_name: To specify a template different from the default template. By default, template name is template.c and it is assumed to be in the current directory.
[435]16
17Options, input file name, and output file name can be in any order, as long as: output file comes after the input file and template file name comes right after -t.
[434]18=====================================
19SUB-DIRECTORIES:
20
21Currently the compiler directory contains two subdirectories. Each directory contains a template file. Users can put their python input files in each of the directories and run compiler to generate C code. The differece is that template file of workspace directory is simpler and compileable by gcc and llvm-gcc. Template of the p-workspace is more complicated with code for performance measuring and requires a C++ compiler like g++ or llvm-g++.
22
23
24=====================================
25=====================================
[351]26Variables:
27    In any program compilable by this compiler all variables are assumed to be bit streams, arrays of bitstreams or structures of bitstreams.
28
29Valid operations on bit streams:
30    Bitwise logical operations:
31        And
32        Or
33        Xor
34        And-Not (&~)
35
36    Predefind Functions:
37        Advance
38        ScanThru
39
40    Pragmas:
41        optimize pragma
42       
43    Loops:
44        while loop
45   
46    Function calls:
47        Normal python function call
48   
49    Module importing:
50        Simple form of module importing
51
52=====================================
53Loops:
54    The current valid form is: while var > 0 for bitstream var.
55
56Function Calls:
57    Currently function calls must be of the following form: var = func(params)
58    params is a list of positional arguments. Keyword arguments are not currently supported.
59    func is the function name. It must return a single variable bitstream variable.
60    All the functions will be inlined in the output C code.
61    Function calls are only allowed within "main" function. No other function call is allowed, except calling predefined functions.
62
63Module importing:
64    The following format is accepted currently, but implementation is not yet finished: import module_name[,module_name]
65
66=====================================
67OTHER CONSTRAINTS:
68    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'.
69       
Note: See TracBrowser for help on using the repository browser.