source: trunk/symbol_table/pablo/div2_logbase2_group_strms.py

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

Additional symbol table modifications for integration with current ICXML structure.

File size: 1.9 KB
Line 
1import bitutil as pablo
2
3class Groups():
4        starts = 0
5        follows = 0
6        follows_2 = 0
7        follows_4 = 0
8        follows_6 = 0
9        follows_8 = 0
10        follows_16 = 0
11        follows_0 = 0
12
13def Gen_lgth_groups(groups):
14       
15        ### Div2 Strategy ###
16        follows_gt_0 = groups.follows
17        follows_mask_1_2 = pablo.Advance(groups.starts) | pablo.Advance(pablo.Advance(groups.starts))
18
19        # Groups symbols of length 1 and length 2
20        groups.follows_2 = follows_gt_0 & follows_mask_1_2
21        follows_gt_2 = follows_gt_0 &~ follows_mask_1_2
22        follows_mask_3_4 = pablo.Advance(pablo.Advance(follows_mask_1_2))
23
24        # Groups symbols of length 3 and length 4
25        groups.follows_4 = follows_gt_2 & follows_mask_3_4
26        follows_gt_4 = follows_gt_2 &~ follows_mask_3_4
27        follows_mask_5_6 = pablo.Advance(pablo.Advance(follows_mask_3_4))
28
29        # Groups symbols of length 5 and length 6
30        groups.follows_6 = follows_gt_4 & follows_mask_5_6
31        follows_gt_6 = follows_gt_4 &~ follows_mask_5_6
32        follows_mask_7_8 = pablo.Advance(pablo.Advance(follows_mask_5_6))
33
34        # Groups symbols of length 7 and length 8
35        groups.follows_8 = follows_gt_6 & follows_mask_7_8
36        follows_gt_8 = follows_gt_6 &~ follows_mask_7_8
37
38        ### Log2 Strategy ###
39        # Groups symbols of length 9 to length 16
40
41        follows_mask_1_8 = (follows_mask_1_2 | follows_mask_3_4 | follows_mask_5_6 | follows_mask_7_8)
42        # Naive Advance
43        #follows_mask_9_16 = pablo.Advance(pablo.Advance(pablo.Advance(pablo.Advance(pablo.Advance(pablo.Advance(pablo.Advance(pablo.Advance(follows_mask_1_8))))))))
44        #groups.follows_16 = follows_gt_8 & follows_mask_9_16
45
46        # Advance 32 and Interpose
47        #temp32 = pablo.Advance32 (follows_mask_1_8)
48        #groups.follows_16 = follows_gt_8 & interpose32 (follows_mask_1_8, temp32, 8)
49
50        temp8 = pablo.Advance (follows_mask_1_8, 8)
51        groups.follows_16 = follows_gt_8 & temp8
52
53
54        follows_gt_16 = follows_gt_8 &~ groups.follows_16
55
56        # Groups symbols of length greater than 16
57        groups.follows_0 = follows_gt_16
58
59def Main(groups):
60        Gen_lgth_groups(groups)
Note: See TracBrowser for help on using the repository browser.