source: trunk/symbol_table/pablo/bit_byte_group_strms.py @ 2185

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

Fixed template glue.

File size: 1.1 KB
Line 
1# demo
2import bitutil as pablo
3
4class Groups():
5        starts = 0
6        follows = 0
7        follows_7 = 0 # bit
8        follows_0 = 0 # byte
9
10def Gen_lgth_groups(markers, groups):
11
12        groups.starts = markers.starts
13        groups.follows = markers.follows
14
15        # Groups symbols of length 1 to length 7
16        follows_gt_0 = groups.follows
17
18        follows_mask_1_2 = pablo.Advance(groups.starts) | pablo.Advance(pablo.Advance(groups.starts))
19
20        follows_mask_3_4 = pablo.Advance(pablo.Advance(follows_mask_1_2))
21        follows_mask_5_6 = pablo.Advance(pablo.Advance(follows_mask_3_4))
22        follows_mask_6_7 = pablo.Advance(follows_mask_5_6)
23        follows_mask_1_7 = follows_mask_1_2 | follows_mask_3_4 | follows_mask_5_6 | follows_mask_6_7
24
25        # Naive Advance
26        groups.follows_7 = follows_gt_0 & follows_mask_1_7
27
28        # Advance 32 and Interpose
29        #temp32 = pablo.Advance32 (follows_mask_1_7)
30        #groups.follows_16 = follows_gt_8 & interpose32 (follows_mask_1_7, temp32, 7)
31
32        follows_gt_7 = follows_gt_0 &~ groups.follows_7
33
34        # Groups symbols of length greater than 7
35        groups.follows_0 = follows_gt_7
36
37
38def Main(markers, groups):
39        Gen_lgth_groups(markers, groups)
40
Note: See TracBrowser for help on using the repository browser.