source: proto/Compiler/README @ 675

Last change on this file since 675 was 661, checked in by ksherdy, 9 years ago

Update README

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