IOBridge.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Jean-Marc Frailong, December 1, 1987 5:25:54 pm PST
Description of some wire icons in IOBDesign. Most of them could/should be replaced by schematics now that wire icons are correctly supported in Sisyph.
Command to switch wire sizes between regular & bus-size
DIRECTORY
CD USING [Design],
CDEnvironment USING [StuffToCommandTool],
CDViewer USING [FindDesign],
Core USING [Wire, Wires],
CoreCreate USING [Range, Seq],
CoreOps USING [SetShortWireName],
ProcessProps USING [GetProp],
Rope USING [ROPE];
IOBridge: CEDAR PROGRAM
IMPORTS CDEnvironment, CDViewer, CoreCreate, CoreOps, ProcessProps
~ BEGIN
Design Constants
CacheType: INT ← 001H; -- Constant defined in DynaBus protocol, Appendix B
IOWRQ: INT ← 012H; -- Constant defined by the DynaBus protocol
BIOWRQ: INT ← 014H; -- Constant defined by the DynaBus protocol
ByteType: INT ← 02H; -- Constant defined by the IOBridge specs
WordType: INT ← 03H; -- Constant defined by the IOBridge specs
LongType: INT ← 04H; -- Constant defined by the IOBridge specs
IOType: INT ← 02H; -- Constant defined by the IOBridge specs
Structured buses
Fields: TYPE ~ LIST OF Field;
Field: TYPE ~ REF FieldRep;
FieldRep: TYPE ~ RECORD [name: Rope.ROPE, size: NAT]; -- size 0 means field is atomic wire
Fld: PROC [name: Rope.ROPE, size: NAT ← 0] RETURNS [Field] ~ INLINE {
RETURN [NEW[FieldRep ← [name, size]]]
};
BusStructure: PROC [name: Rope.ROPE, size: NAT, fields: Fields] RETURNS [public: Core.Wires] ~ {
bus: Core.Wire ← CoreCreate.Seq[name, size];
base: NAT ← 0;
public ← LIST [bus];
WHILE fields#NIL DO
f : Field = fields.first;
IF f.size=0 THEN { -- Extraction of an atomic field
public ← CONS [CoreOps.SetShortWireName[bus[base], f.name], public];
base ← base+1;
}
ELSE { -- Extraction of a regular field
public ← CONS [CoreCreate.Range[bus, base, f.size, f.name], public];
base ← base+f.size;
};
fields ← fields.rest;
ENDLOOP;
IF size#base THEN ERROR; -- the sum of field sizes is not equal to the bus size!
};
Request: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "Request", size: 81, fields: LIST[
Fld["Cmd", 5],
Fld["Mode"],
Fld["IORange"],
Fld["DeviceID", 10],
Fld["Address", 32],
Fld["Data", 32]]];
};
RequestH: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "RequestH", size: 49, fields: LIST[
Fld["Cmd", 5],
Fld["Mode"],
Fld["IORange"],
Fld["DeviceID", 10],
Fld["Address", 32]]];
};
Header: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "Header", size: 64, fields: LIST[
Fld["Cmd", 5],
Fld["ModeError"],
Fld["Shared"],
Fld["DeviceID", 10],
Fld["Address", 47]]];
};
IOAddress: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "IOA", size: 47, fields: LIST[
Fld["ZA", 15],
Fld["Addr", 32]]];
};
IOLargeAddr: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "IOLarge", size: 32, fields: LIST[
Fld["DevT", 4],
Fld["DevN", 4],
Fld["DevSA", 24]]];
};
IOMediumAddr: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "IOMedium", size: 32, fields: LIST[
Fld["DevT", 8],
Fld["DevN", 8],
Fld["DevSA", 16]]];
};
IOSmallAddr: PROC [] RETURNS [public: Core.Wires] ~ {
public ← BusStructure[name: "IOSmall", size: 32, fields: LIST[
Fld["DevT", 12],
Fld["DevN", 10],
Fld["DevSA", 10]]];
};
Hack for command tool / interpreter interface
GetDesign: PROC [] RETURNS [design: CD.Design] ~ {
design ← CDViewer.FindDesign["IOBridge"];
IF design=NIL THEN {
[] ← CDEnvironment.StuffToCommandTool["CDRead +R -P +X -S IOBridge", NARROW[ProcessProps.GetProp[$WorkingDirectory], Rope.ROPE]];
design ← CDViewer.FindDesign["IOBridge"];
};
IF design=NIL THEN ERROR; -- don't bother ...
};
END.