source: proto/Compiler/workspace/prototype.py @ 653

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

Add skeleton Python prototype files.

File size: 978 bytes
Line 
1#
2# prototype.py
3#
4# Parallel Prototype Skeleton
5#
6# Ken Herdy
7# Oct. 13, 2010
8#
9#----------------------------------------------------------------------------
10#
11# We use python's unlimited precision integers for unbounded bit streams.
12# This permits simple logical operations on the entire stream.
13# Assumption: bitstreams are little-endian (e.g., as on x86).
14#
15#----------------------------------------------------------------------------
16#
17
18import bitutil
19import sys
20
21def XXX(data):
22        """
23        >>> XXX('Expected Value')
24        'Expected Value'
25        """
26        return data
27
28def demo_XXX(data):
29        XXX(data)
30        return data
31
32def main():
33
34        return
35
36if __name__ == "__main__":
37        import doctest
38        doctest.testmod()
39
40        if len(sys.argv) < 2:
41                sys.stderr.write("Usage: driver.py <infile> [outfile]\n")
42                sys.exit(2)
43        if len(sys.argv) == 3:
44                outfile = open(sys.argv[2],"w")
45        else: outfile = sys.stdout
46
47        data = bitutil.readfile(sys.argv[1]) 
48
49        result = demo_XXX(data)
50       
51        outfile.write(result)
52        outfile.close()
53
Note: See TracBrowser for help on using the repository browser.