Ignore:
Timestamp:
Nov 3, 2010, 5:34:45 PM (9 years ago)
Author:
mulligan
Message:

Started implementation of interrupts.

File:
1 edited

Legend:

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

    r213 r214  
    13571357                       (* Explanation: 8 bit asynchronous communication.  There's a delay (epsilon)
    13581358                          which needs taking care of.  If we're trying to communicate at the same time
    1359                           an existing communication is occurring, we assert false (else claus of first
     1359                          an existing communication is occurring, we assert false (else clause of first
    13601360                          if). *)
    13611361                       if status.serial_epsilon_in = None && status.serial_v_in = None then
    13621362                         if status.clock >= time then
    1363                            (* waiting for nine bits, multiprocessor communication mode requires nine bits *)
     1363                           (* Waiting for nine bits, multiprocessor communication mode requires nine bits *)
    13641364                           if get_bit status.scon 5 then
    13651365                             assert false (* really: crash! *)
     
    14471447;;
    14481448
     1449let external_serial_interrupt status esi =
     1450  if esi then
     1451    assert false
     1452  else
     1453    status
     1454;;
     1455
     1456let external0_interrupt status e0i =
     1457  if e0i then
     1458    assert false
     1459  else
     1460    status
     1461;;
     1462
     1463let external1_interrupt status e1i =
     1464  if e1i then
     1465    assert false
     1466  else
     1467    status
     1468;;
     1469
     1470let timer0_interrupt status t0i =
     1471  if t0i then
     1472    assert false
     1473  else
     1474    status
     1475;;
     1476
     1477let timer1_interrupt status t1i =
     1478  if t1i then
     1479    assert false
     1480  else
     1481    status
     1482;;
     1483
    14491484let interrupts status =
    14501485  let (ea,_,_,es), (et1,ex1,et0,ex0) = bits_of_byte status.ie in
     
    14521487    (* DPM: are interrupts enabled? *)
    14531488    if ea then
    1454       match (es,et1,ex1,et0,ex0) with
    1455         | (false,false,false,false,false) ->
    1456             (* no interrupts set *)
     1489      match (pt1,px1,pt0,px0) with
     1490        (* Check priorities of interrupts *)
     1491        (false,false,false,false) ->
     1492          let status = external0_interrupt status ex0 in
     1493          let status = timer0_interrupt status et0 in
     1494          let status = external1_interrupt status ex1 in
     1495          let status = timer1_interrupt status et1 in
     1496          let status = external_serial_interrupt status es in
    14571497            status
    1458         | _ -> assert false
     1498         (* DPM: todo --- need to add flags to status to signal an interrupt
     1499                 is currently active *)
     1500      | _ -> assert false
    14591501    else
    14601502      status
Note: See TracChangeset for help on using the changeset viewer.