source: proto/Compiler/README @ 817

Last change on this file since 817 was 803, checked in by ksherdy, 9 years ago

Update README.

File size: 3.9 KB
RevLine 
[654]1PyBit Prototype Project Set Up (Ubuntu Linux)                                  |
2
[803]3The following steps describe how to set up a PyBit/Pablo prototype project. The JSON
[654]4PyBit prototype project is used as a running example.
5
61. Create PyBit Prototype Directory Structure
7
8        1.1 Create a project sub directory in proto directory.
9
10                For example for the JSON project,
11
12                svn co http://parabix.costar.sfu.ca/svn/proto proto
13                cd proto
14                mkdir JSON
15
16        1.2 Copy default PyBit project files
17
18                cp -R Compiler/workspace/* JSON
19
20                The Python file structure will change. As a hack, we currently maintain
21                two files.
22
[795]23                (1) pybit_prototype.py                  - prototype specific solution routines
24                (2) pybit_compilable.py                 - compiler compatible solution routines
[654]25
[795]26                We replace these with the following.
27
28                (1) pablo_prototype.py
29                (2) pablo_compilable.py
30
[654]31        1.3 SVN add/commmit
32
33                svn add Makefile template.c pybit_driver.py pybit_soln.py pybit_compiler.py src
[656]34                svn commit -m'Create default PyBit prototype directory structure.'
[654]35
36        1.4 Rename Files (Optional)
37
38                Rename the Python prototype, template and update the makefile to
39                project specific file names.
40
412. Set the svn:externals property to check out required lib directories.
42
43        The svn:externals property contains instructions for Subversion to populate
44        a versioned directory with one or more other checked-out Subversion working
45        copies.
46
47        'http://parabix.costar.sfu.ca/svn/trunk/lib'
48        'http://parabix.costar.sfu.ca/svn/trunk/lib/perflib'
49
50        2.1 Create a svn:externals property file.
51
52                cd JSON
[656]53                touch props.txt
54                echo "lib http://parabix.costar.sfu.ca/svn/trunk/lib" > props.txt
55                echo "perflib http://parabix.costar.sfu.ca/svn/trunk/lib/perflib" >> props.txt
[654]56
57        2.2 Set the svn:externals property for the JSON directory.
58
[656]59                svn propset svn:externals . -F props.txt
[654]60
61        2.3 Update the local copy of the the project directory JSON
62
[656]63                svn update
64                svn commit -m'Commit the propset command.'
[654]65
[803]662. Modify [pybit|pablo]_prototype.py to prototype a Pybit implemenation in Python.
[654]67
683. Modify template.c and compilable.py to generation an executable program.
69
[661]70        3.1 Compilation
[654]71
[661]72                Makefiles exist to compile Python prototypes into generated block-at-a-time C code and
73                to compile generated code into executable programs.
74
[795]754. Additional Information Specific to the Deprecated PyBit Compiler
[661]76
77        This section provides additional information regarding the capabilities of the PyBit compiler.
78
79        4.1 Variables
80
[656]81                In any compilable program all variables are assumed to be type bit stream, arrays of
82                bitstreams or structures of bitstreams.
[654]83
[661]84        4.2 Operations
[654]85
[661]86                Valid operations on bit streams include the following.
[654]87
[656]88        Bitwise logical operations
[654]89                And
90                Or
91                Xor
92                And-Not (&~)
93
94        Primitives
95                Advance(bitstream)
[656]96                ScanThru(cursor,span_stream)
[654]97
98        Pragmas
99                optimize pragma
[661]100     
[654]101        Loop Structures
102                while loop
103
[661]104                The current valid form is: while var > 0 for bitstream var.
105 
[654]106        Function Calls
107                Python function calls
108
[656]109                Currently function calls must be of the following form: var = func(params)
110                params is a list of positional arguments. Keyword arguments are not currently supported.
111                func is the function name. It must return a single variable bitstream variable.
112                All the functions will be inlined in the output C code.
113                Function calls are only allowed within "main" function. No other function call is allowed,
[654]114                except calling predefined functions.
[661]115 
[654]116        Module Importing
117                Simple form of module importing.
[656]118                The following format is accepted currently, but the implementation
119                is not yet finished: import module_name[,module_name]
[654]120
121
122        Additional Constraints
[656]123                There should be one and only one return statement within the main function. This statement variables
124                values of which is needed in other parts of the output program.
[654]125
[656]126                A variables with name 'error_mask' is assumed to be used in the output program.
127                This does not mean that your program must have a variable with this name. If you
128                have a variable that specifies error locations, it is recommended to be named 'error_mask'.
[654]129
130
131
[661]132
Note: See TracBrowser for help on using the repository browser.