Line | |
---|

1 | # -*- coding: utf-8 -*- |
---|

2 | # |
---|

3 | # parabix2_compilable.py |
---|

4 | # |
---|

5 | # Parallel XML Parsing with Bitstream Addition |
---|

6 | # |
---|

7 | # - Complete prototype for all bitstream computations in Parabix2 |
---|

8 | # - Optimized for compilation |
---|

9 | # - Separate compilation |
---|

10 | |
---|

11 | # Robert D. Cameron |
---|

12 | # July 29, 2010 |
---|

13 | # |
---|

14 | |
---|

15 | #import bitutil |
---|

16 | |
---|

17 | class Basis_bits(): |
---|

18 | bit_0 = 0 |
---|

19 | bit_1 = 0 |
---|

20 | bit_2 = 0 |
---|

21 | bit_3 = 0 |
---|

22 | bit_4 = 0 |
---|

23 | bit_5 = 0 |
---|

24 | bit_6 = 0 |
---|

25 | bit_7 = 0 |
---|

26 | |
---|

27 | class Dictionary (): |
---|

28 | Words = 0 |
---|

29 | Word_starts = 0 |
---|

30 | Word_ends = 0 |
---|

31 | |
---|

32 | class Hash_data(): |
---|

33 | Hash_value = 0 |
---|

34 | |
---|

35 | def Classify_bytes(basis_bits, dictionary): |
---|

36 | temp1 = (basis_bits.bit_6 & basis_bits.bit_7) |
---|

37 | temp2 = (basis_bits.bit_5 | temp1) |
---|

38 | temp3 = (basis_bits.bit_4 & temp2) |
---|

39 | temp4 = (~temp3) |
---|

40 | temp5 = (basis_bits.bit_4 | basis_bits.bit_5) |
---|

41 | temp6 = (basis_bits.bit_6 | basis_bits.bit_7) |
---|

42 | temp7 = (temp5 | temp6) |
---|

43 | temp8 = ((basis_bits.bit_3 & temp4)|(~(basis_bits.bit_3) & temp7)) |
---|

44 | temp9 = (basis_bits.bit_1 &~ basis_bits.bit_0) |
---|

45 | dictionary.Words = (temp8 & temp9) |
---|

46 | |
---|

47 | temp = pablo.Advance(dictionary.Words) ^ dictionary.Words |
---|

48 | dictionary.Word_starts = temp & dictionary.Words |
---|

49 | dictionary.Word_ends = temp & ~dictionary.Words |
---|

50 | |
---|

51 | def Compute_Hash_Value_Bitstream(hash_data, basis_bits): |
---|

52 | hash_data.Hash_value = basis_bits.bit_2 ^ basis_bits.bit_4 ^ basis_bits.bit_6 |
---|

53 | #hash_data.Hash_value = basis_bits.bit_3 ^ basis_bits.bit_5 ^ basis_bits.bit_7 |
---|

54 | |
---|

55 | def Main(basis_bits, dictionary, hash_data): |
---|

56 | Classify_bytes(basis_bits, dictionary) |
---|

57 | Compute_Hash_Value_Bitstream(hash_data, basis_bits); |
---|

58 | |
---|

**Note:** See

TracBrowser
for help on using the repository browser.