-- File: [Indigo]<Sakura>Dragon>DragonImpl.sak
--  4-Mar-82 13:46:21

DIRECTORY
  DragonArbiter: TYPE, 
  DragonCache: TYPE, 
  DragonClock: TYPE, 
  DragonMap: TYPE, 
  DragonMemory: TYPE, 
  DragonProcessor: TYPE, 
  SakuraRT: TYPE, 
  SimIO: TYPE;

DragonImpl: MONITOR
  IMPORTS DragonArbiter, DragonCache, DragonClock, DragonMap, DragonMemory, 
          DragonProcessor, SakuraRT, SimIO
  = BEGIN
  SimIO.Start[]; 
  {op: SakuraRT.Handle ← SakuraRT.Create[]; 
   pcdata: SakuraRT.Handle ← SakuraRT.Create[]; 
   pcexception: SakuraRT.Handle ← SakuraRT.Create[]; 
   pcreject: SakuraRT.Handle ← SakuraRT.Create[]; 
   pcreq: SakuraRT.Handle ← SakuraRT.Create[]; 
   cmshared: SakuraRT.Handle ← SakuraRT.Create[]; 
   cmd: SakuraRT.Handle ← SakuraRT.Create[]; 
   cmdata: SakuraRT.Handle ← SakuraRT.Create[]; 
   clockA: SakuraRT.Handle ← SakuraRT.Create[]; 
   clockB: SakuraRT.Handle ← SakuraRT.Create[]; 
   arqp1: SakuraRT.Handle ← SakuraRT.Create[]; 
   agrp1: SakuraRT.Handle ← SakuraRT.Create[]; 
   proc, cache, arbiter, clock, map, memory: PROCESS; 
   SakuraRT.IncCurrent[];
   proc ← FORK DragonProcessor.Processor[ClockA: clockA, ClockB: clockB, 
                                         Op: op, Fault: pcexception, Reject: pcreject, 
                                         InData: pcdata, RQ: pcreq, OutData: pcdata];
   SakuraRT.CatalogProcId[proc]; 
   SakuraRT.IncCurrent[];
   cache ← FORK DragonCache.Cache
     [Op: op, PDataIn: pcdata, MDataIn: cmdata, ClockA: clockA, ClockB: clockB, 
      CMDIn: cmd, RQ: pcreq, SharedIn: cmshared, Grant: agrp1, Exception: pcexception, 
      Reject: pcreject, SharedOut: cmshared, CMDOut: cmd, Rq: arqp1, PDataOut: pcdata, 
      MDataOut: cmdata];SakuraRT.CatalogProcId[cache]; 
   SakuraRT.IncCurrent[];
   arbiter ← FORK DragonArbiter.Arbiter
     [ClockA: clockA, ClockB: clockB, Proc1Rq: arqp1, Proc1Gr: agrp1];
   SakuraRT.CatalogProcId[arbiter]; 
   SakuraRT.IncCurrent[];
   clock ← FORK DragonClock.ClockGenerator[ClockA: clockA, ClockB: clockB];
   SakuraRT.CatalogProcId[clock]; 
   SakuraRT.IncCurrent[];
   map ← FORK DragonMap.MapProcessor[ClockA: clockA, ClockB: clockB, CMDIn: cmd, 
                                     MDataIn: cmdata, CMDOut: cmd, MDataOut: cmdata];
   SakuraRT.CatalogProcId[map]; 
   SakuraRT.IncCurrent[];
   memory ← FORK DragonMemory.Memory
     [ClockA: clockA, ClockB: clockB, CMDIn: cmd, SharedIn: cmshared, MDataIn: cmdata, 
      MDataOut: cmdata];SakuraRT.CatalogProcId[memory]; 
   SakuraRT.DecCurrent[]; 
   SakuraRT.Join[proc]; 
   SakuraRT.Join[cache]; 
   SakuraRT.Join[arbiter]; 
   SakuraRT.Join[clock]; 
   SakuraRT.Join[map]; 
   SakuraRT.Join[memory]; 
   SakuraRT.IncCurrent[]}; 
  SimIO.Stop[]
  END.