Changeset 91


Ignore:
Timestamp:
Sep 20, 2010, 3:30:27 PM (9 years ago)
Author:
mulligan
Message:

Finished porting/fix type errors in physical.

Location:
Deliverables/D4.1
Files:
3 edited

Legend:

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

    r90 r91  
     1open BitVectors;;
    12open Physical;;
    23
     
    78(* no differentiation between internal and external code memory *)
    89type status =
    9  { code_memory: byte WordMap.t;        (* can be reduced *)
    10    low_internal_ram: byte Byte7Map.t;
    11    high_internal_ram: byte Byte7Map.t;
    12    external_ram: byte WordMap.t;
     10 { code_memory: ([`Eight] vect) WordMap.t;        (* can be reduced *)
     11   low_internal_ram: ([`Eight] vect) Byte7Map.t;
     12   high_internal_ram: ([`Eight] vect) Byte7Map.t;
     13   external_ram: ([`Eight] vect) WordMap.t;
    1314
    1415   pc: word;
  • Deliverables/D4.1/physical.ml

    r90 r91  
    88  Map.Make (struct type t = word let compare = Pervasives.compare end)
    99
    10 let byte7_of_byte =
    11  function
    12     (false,b2,b3,b4),n -> (b2,b3,b4,n)
    13   | _ -> raise Byte7_conversion
     10let int_of_bit =
     11  function
     12    false -> 0
     13  | true -> 1
     14
     15let byte7_of_byte b =
     16  let bits = to_bits b in
     17    match bits with
     18      [false;b1;b2;b3;b4;b5;b6;b7] -> mk_byte7 b1 b2 b3 (mk_nibble b4 b5 b6 b7)
     19    | _ -> raise Byte7_conversion
    1420
    1521let add8_with_c b1 b2 c =
     
    2531;;
    2632
    27 let subb8_with_c b1 b2 c =
     33let subb8_with_c (b1 : [`Eight] vect) (b2 : [`Eight] vect) (c : bit) =
    2834 let n1 = int_of_vect b1 in
    2935 let n2 = int_of_vect b2 in
    30  let c = int_of_vect c in
     36 let c = int_of_bit c in
    3137 let res = n1 - n2 - c in
    3238 let ac = n1 mod 16 - n2 mod 16 - c < 0 in
     
    5258
    5359let byte7_of_bit b =
    54   false,false,false,(false,false,false,b)
     60  [false;false;false;false;false;false;b]
    5561;;
    5662
    57 let byte_of_byte7 (b1,b2,b3,n) =
    58         (false,b1,b2,b3),n
     63let byte_of_byte7 ([b1;b2;b3]::n) =
     64        [false;b1;b2;b3]::n
    5965;;
  • Deliverables/D4.1/physical.mli

    r88 r91  
    1 open Bit_vectors
     1open BitVectors;;
    22
    33exception Byte7_conversion
     
    77
    88val byte7_of_byte: byte -> byte7
     9val int_of_bit: bit -> int
    910
    1011val subb8_with_c:
    11  byte -> byte -> bit -> byte * bit * bit * bit (* -, c, ac, ov *)
    12 val dec: byte -> byte (* with roll-over *)
    13 val inc: byte -> byte (* with roll-over *)
     12 byte -> byte -> bit -> ([ `Eight | `Eleven | `Four | `Seven | `Sixteen ] vect) * bit * bit * bit (* -, c, ac, ov *)
     13val dec: byte -> ([ `Eight | `Eleven | `Four | `Seven | `Sixteen ] vect) (* with roll-over *)
     14val inc: byte -> ([ `Eight | `Eleven | `Four | `Seven | `Sixteen ] vect) (* with roll-over *)
Note: See TracChangeset for help on using the changeset viewer.