source: trunk/symbol_table/id_group_strms.py @ 2065

Last change on this file since 2065 was 2065, checked in by ksherdy, 7 years ago

Added in log2 pablo statements. Updated Python demo.

File size: 2.4 KB
Line 
1# demo
2import bitutil as pablo
3
4class Groups():
5        starts = 0
6        ends = 0
7        ends_1 = 0
8        ends_2 = 0
9        ends_3 = 0
10        ends_4 = 0
11        ends_5 = 0
12        ends_6 = 0
13        ends_7 = 0
14        ends_8 = 0
15        ends_9 = 0
16        ends_10 = 0
17        ends_11 = 0
18        ends_12 = 0
19        ends_13 = 0
20        ends_14 = 0
21        ends_15 = 0
22        ends_16 = 0
23        ends_gte_17 = 0
24
25def Gen_lgth_groups(groups):
26
27        cursor = groups.starts
28        temp = groups.ends
29
30        # Group symbols of length 1
31        cursor = pablo.Advance(cursor)
32        groups.ends_1 = cursor & temp
33        temp = temp & ~groups.ends_1
34
35        # Group symbols of length 2
36        cursor = pablo.Advance(cursor)
37        groups.ends_2 = cursor & temp
38        temp = temp & ~groups.ends_2
39
40        # Group symbols of length 3
41        cursor = pablo.Advance(cursor)
42        groups.ends_3 = cursor & temp
43        temp = temp & ~groups.ends_3
44
45        # Group symbols of length 4
46        cursor = pablo.Advance(cursor)
47        groups.ends_4 = cursor & temp
48        temp = temp & ~groups.ends_4
49
50        # Group symbols of length 5
51        cursor = pablo.Advance(cursor)
52        groups.ends_5 = cursor & temp
53        temp = temp & ~groups.ends_5
54
55        # Group symbols of length 6
56        cursor = pablo.Advance(cursor)
57        groups.ends_6 = cursor & temp
58        temp = temp & ~groups.ends_6
59
60        # Group symbols of length 7
61        cursor = pablo.Advance(cursor)
62        groups.ends_7 = cursor & temp
63        temp = temp & ~groups.ends_7
64
65        # Group symbols of length 8
66        cursor = pablo.Advance(cursor)
67        groups.ends_8 = cursor & temp
68        temp = temp & ~groups.ends_8
69
70        # Group symbols of length 9
71        cursor = pablo.Advance(cursor)
72        groups.ends_9 = cursor & temp
73        temp = temp & ~groups.ends_9
74
75        # Group symbols of length 10
76        cursor = pablo.Advance(cursor)
77        groups.ends_10 = cursor & temp
78        temp = temp & ~groups.ends_10
79
80        # Group symbols of length 11
81        cursor = pablo.Advance(cursor)
82        groups.ends_11 = cursor & temp
83        temp = temp & ~groups.ends_11
84
85        # Group symbols of length 12
86        cursor = pablo.Advance(cursor)
87        groups.ends_12 = cursor & temp
88        temp = temp & ~groups.ends_12
89
90        # Group symbols of length 13
91        cursor = pablo.Advance(cursor)
92        groups.ends_13 = cursor & temp
93        temp = temp & ~groups.ends_13
94
95        # Group symbols of length 14
96        cursor = pablo.Advance(cursor)
97        groups.ends_14 = cursor & temp
98        temp = temp & ~groups.ends_14
99
100        # Group symbols of length 15
101        cursor = pablo.Advance(cursor)
102        groups.ends_15 = cursor & temp
103        temp = temp & ~groups.ends_15
104
105        # Group symbols of length 16
106        cursor = pablo.Advance(cursor)
107        groups.ends_16 = cursor & temp
108        temp = temp & ~groups.ends_16
109
110        # Group symbols of length greater than 16
111        groups.ends_gte_17 = temp
112
113def Main(groups):
114        Gen_lgth_groups(groups)
115
Note: See TracBrowser for help on using the repository browser.