[44] | 1 | exception Byte7_conversion |
---|
[28] | 2 | |
---|
[27] | 3 | type bit = bool |
---|
| 4 | type nibble = bit * bit * bit * bit |
---|
| 5 | type byte = nibble * nibble |
---|
[28] | 6 | type byte7 = bit * bit * bit * nibble |
---|
[27] | 7 | type word = byte * byte |
---|
[28] | 8 | type word11 = bit * bit * bit * byte |
---|
| 9 | |
---|
| 10 | module Byte7Map : Map.S with type key = byte7 |
---|
| 11 | module WordMap : Map.S with type key = word |
---|
| 12 | |
---|
| 13 | val byte7_of_byte: byte -> byte7 |
---|
| 14 | |
---|
| 15 | val word_of_int: int -> word |
---|
[71] | 16 | val int_of_word: word -> int |
---|
[28] | 17 | val byte7_of_int: int -> byte7 |
---|
| 18 | val byte_of_int: int -> byte |
---|
| 19 | val int_of_bit: bit -> int |
---|
| 20 | val int_of_byte: byte -> int |
---|
[46] | 21 | val int_of_byte7: byte7 -> int |
---|
[28] | 22 | val int_of_nibble: nibble -> int |
---|
[72] | 23 | val nibble_of_int: int -> nibble |
---|
[42] | 24 | val byte7_of_bit: bit -> byte7 |
---|
| 25 | val byte_of_byte7: byte7 -> byte |
---|
[28] | 26 | |
---|
[58] | 27 | val complement: byte -> byte |
---|
| 28 | |
---|
[28] | 29 | val (++): word -> int -> word |
---|
| 30 | |
---|
| 31 | val add8_with_c: |
---|
| 32 | byte -> byte -> bit -> byte * bit * bit * bit (* +, c, ac, ov *) |
---|
| 33 | val subb8_with_c: |
---|
| 34 | byte -> byte -> bit -> byte * bit * bit * bit (* -, c, ac, ov *) |
---|
| 35 | val dec: byte -> byte (* with roll-over *) |
---|
| 36 | val inc: byte -> byte (* with roll-over *) |
---|
[46] | 37 | |
---|
| 38 | val nth_bit: int -> byte -> bit |
---|
| 39 | val set_nth_bit: int -> bit -> byte -> byte |
---|