Ignore:
Timestamp:
Sep 10, 2010, 5:37:19 PM (11 years ago)
Author:
mulligan
Message:

Many additions to Bit, Nibble and Byte API, as well as more instructions
added to ASMInterpret execute function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/Byte.ml

    r57 r62  
     1(*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*)
     2(* FILENAME: Byte.ml                                                         *)
     3(* DESCRIPTION: An ADT implementing bytes, and common operations on them.    *)
     4(* CREATED: 10/09/2010, Dominic Mulligan                                     *)
     5(* BUGS:                                                                     *)
     6(*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*^*)
     7
     8open Bit;;
    19open Nibble;;
    210
    3 module type BYTE = functor(Nibble: NIBBLE) ->
     11module type BYTE =
    412sig
    5   type nibble = Nibble.nibble
     13  type bit
     14  type nibble
     15  type byte
     16(*
     17  val from_bits: bit -> bit -> bit -> bit -> bit -> bit -> bit -> bit -> byte
     18  val from_nibbles: nibble -> nibble -> byte
     19  val from_int: int -> byte
     20
     21  val get_nibble_at: int -> byte -> nibble
     22  val set_nibble_at: int -> nibble -> byte -> byte option
     23  val get_bit_at: int -> byte -> bit
     24  val set_bit_at: int -> bit -> byte -> byte option
     25
     26  val (-&-): byte -> byte -> byte
     27  val (-|-): byte -> byte -> byte
     28  val (-^-): byte -> byte -> byte
     29  val not: byte -> byte
     30
     31  val map_nibble: (nibble -> nibble) -> byte -> byte
     32  val map_bit: (bit -> bit) -> byte -> byte
     33  val iter_nibble: (nibble -> string) -> byte -> string
     34  val iter_bit: (bit -> string) -> byte -> string
     35  val zip_nibble: (nibble -> nibble -> nibble) -> byte -> byte -> byte
     36  val zip_bit: (bit -> bit -> bit) -> byte -> byte -> byte
     37  val pretty: byte -> string
     38*)
    639end
    740
    8 module Byte: BYTE = functor(Nibble: NIBBLE) ->
     41module Byte(Nibble: NIBBLE): BYTE
     42  with type bit = Nibble.bit and type nibble = Nibble.nibble =
    943struct
     44  type bit = Nibble.bit
    1045  type nibble = Nibble.nibble
     46  type byte = nibble * nibble
    1147end
Note: See TracChangeset for help on using the changeset viewer.