source: trunk/symbol_table/pablo/div2_group_strms.py @ 4138

Last change on this file since 4138 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 
1# demo
2import bitutil as pablo
3
4class Groups():
5        starts = 0
6        follows = 0
7        follows_2 = 0
8        follows_4 = 0
9        follows_6 = 0
10        follows_8 = 0
11        follows_10 = 0
12        follows_12 = 0
13        follows_14 = 0
14        follows_16 = 0
15        follows_0 = 0
16
17def Gen_lgth_groups(groups):
18       
19        ### Div2 Strategy ###
20        follows_gt_0 = groups.follows
21        follows_mask_1_2 = pablo.Advance(groups.starts) | pablo.Advance(pablo.Advance(groups.starts))
22
23        # Groups symbols of length 1 and length 2
24        groups.follows_2 = follows_gt_0 & follows_mask_1_2
25        follows_gt_2 = follows_gt_0 &~ follows_mask_1_2
26        follows_mask_3_4 = pablo.Advance(pablo.Advance(follows_mask_1_2))
27
28        # Groups symbols of length 3 and length 4
29        groups.follows_4 = follows_gt_2 & follows_mask_3_4
30        follows_gt_4 = follows_gt_2 &~ follows_mask_3_4
31        follows_mask_5_6 = pablo.Advance(pablo.Advance(follows_mask_3_4))
32
33        # Groups symbols of length 5 and length 6
34        groups.follows_6 = follows_gt_4 & follows_mask_5_6
35        follows_gt_6 = follows_gt_4 &~ follows_mask_5_6
36        follows_mask_7_8 = pablo.Advance(pablo.Advance(follows_mask_5_6))
37
38        # Rinse and repeat
39        groups.follows_8 = follows_gt_6 & follows_mask_7_8
40        follows_gt_8 = follows_gt_6 &~ follows_mask_7_8
41        follows_mask_9_10 = pablo.Advance(pablo.Advance(follows_mask_7_8))
42
43        groups.follows_10 = follows_gt_8 & follows_mask_9_10
44        follows_gt_10 = follows_gt_8 &~ follows_mask_9_10
45        follows_mask_11_12 = pablo.Advance(pablo.Advance(follows_mask_9_10))
46
47        groups.follows_12 = follows_gt_10 & follows_mask_11_12
48        follows_gt_12 = follows_gt_10 &~ follows_mask_11_12
49        follows_mask_13_14 = pablo.Advance(pablo.Advance(follows_mask_11_12))
50
51        groups.follows_14 = follows_gt_12 & follows_mask_13_14
52        follows_gt_14 = follows_gt_12 &~ follows_mask_13_14
53        follows_mask_15_16 = pablo.Advance(pablo.Advance(follows_mask_13_14))
54
55        groups.follows_16 = follows_gt_14 & follows_mask_15_16
56        follows_gt_16 = follows_gt_14 &~ follows_mask_15_16
57
58        groups.follows_0 = follows_gt_16
59
60def Main(groups):
61        Gen_lgth_groups(groups)
Note: See TracBrowser for help on using the repository browser.