Display:
PROC [dragon:
DM.Component, out:
IO.
STREAM] = {
tv: AMTypes.TV;
FOR l:
DM.ComponentList ← dragon.subComponents, l.rest
WHILE l#
NIL
DO
TRUSTED{tv ← AMBridge.TVForReferent[l.first]};
PrintTV.Print[tv: tv, put: out, depth: 1000, width: 1000, verbose: FALSE];
out.PutF["\n\n"]
ENDLOOP;
};
StartSimulation: Commander.CommandProc = {
dragon, pbus, processor, mbus, sc: DM.Component;
in, out: IO.STREAM;
Create the components and connect them up:
pbus ← DMPBusModel.Create[];
processor ← DMProcessorModel.Create[
LIST[
NEW [DMProcessorModel.ProcessorCommandRec ← [cmd: Store, adrs: DragOpsCrossUtils.IntToWord[1], data: DragOpsCrossUtils.IntToWord[1010]]],
NEW [DMProcessorModel.ProcessorCommandRec ← [cmd: Store, adrs: DragOpsCrossUtils.IntToWord[2], data: DragOpsCrossUtils.IntToWord[2020]]],
NEW [DMProcessorModel.ProcessorCommandRec ← [cmd: Fetch, adrs: DragOpsCrossUtils.IntToWord[1], data: DM.OnesWord]],
NEW [DMProcessorModel.ProcessorCommandRec ← [cmd: Fetch, adrs: DragOpsCrossUtils.IntToWord[2], data: DM.OnesWord]]],
pbus
];
mbus ← DMMBusModel.Create[];
sc ← DMSmallCacheModel.Create[pbus, mbus];
dragon ← DMDragonModel.Create[LIST[pbus, processor, mbus, sc]];
[in, out] ← ViewerIO.CreateViewerStreams["DMDriver"];
dragon.action[Reset][dragon];
BEGIN
ENABLE DMProcessorModel.EmptyCommandList =>
GOTO Fin;
DO
FOR action: DM.Action IN [PhA..EvPhB] DO DM.Apply[dragon, action] ENDLOOP;
ENDLOOP;
EXITS
Fin => DM.PrintHistory[dragon, out];
END;
};