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