-- SakuraRT.mesa
-- Last edited by Suzuki: 19-Apr-82 10:04:02
DIRECTORY
Rope;
SakuraRT: DEFINITIONS = {
Choice: TYPE = REF ChoiceNode;
-- This object is created for each CHOICE statement
ChoiceNode: TYPE;
Handle: TYPE = REF Node;
-- One Handle is created for each connection
Node: TYPE;
-- Choice interface
-- Choice statements are of the form
-- CHOICE {
-- WHEN a1 CHANGE => s1 ||
-- WHEN a2 CHANGE => s2}
-- The implementation is to create an object for each Choice stetatement. Each arm of the
--Choice statement is implemented as a process, which is waiting for the Choice object to
--wake up. When a1 or a2 change, it is signaled to the Choice object, and it wakes up the
--the appropriate process, according to which signal it received.
CreateChoice: PROC RETURNS [Choice];
RegisterUp: PROC [choice: Choice, retValue: CARDINAL, port: Handle];
-- Tell the "port" that the "choice" is waiting, and "port" should send "retValue", to
--tell "chice" in order for "choice" to know who woke up the "choice".
RegisterDown: PROC [Choice, CARDINAL, Handle];
RegisterChange: PROC [Choice, CARDINAL, Handle];
GetChoice: PROC [Choice] RETURNS [CARDINAL];
-- Wait until being waken up by one of the ports
-- Ports interface
Create: PROC [size: CARDINAL ← 10] RETURNS [Handle];
Put: PROC [Handle, REF ANY];
GetNew: PROC [n: Handle, v: BOOLEAN];
-- Wait until the value assigned to "n" becomes "v".
GetNewChange: PROC [Handle];
-- Wait until some value assigned to "n".
Get: PROC [Handle] RETURNS [REF ANY];
-- Obtain the value of the port.
GetCard: PROC [tree: Handle] RETURNS [CARDINAL];
-- NARROW[SakuraRT.Get[tree], REF CARDINAL]↑
GetBool: PROC [tree: Handle] RETURNS [BOOLEAN];
-- NARROW[SakuraRT.Get[tree], REF [BOOLEAN]↑
-- MOSSIM interface
SIMGet: PROC [Handle];
-- Obtain the value from MOSSIM
SIMSet: PROC [Handle];
-- Assign the value to MOSSIM
SIMConnect: PROC [node: Handle, name: STRING];
-- Make the connection between "node" of Sakura, and "name" of
--layout
SIMMultiConnectInit: PROC [node: Handle, size: CARDINAL];
-- "node" passes values that need to be represented by "size"
--number of lines
SIMMultiConnectAssign: PROC [node: Handle,
name: STRING, loc: CARDINAL];
-- The line of the layout named "name" constitue "loc"-th position
--construct the value of the "node".
SIMRead: PROC [file: STRING];
-- Read transistors from "file".
SIMStep: PROC;
-- Execute MOSSIM until stabilizes
-- Scheduler interface
-- The processes are either currently running (there is exactly one
--such process), waiting for a condition, or doing nothing until
--woken up at a later time. We call a process to be active if it
--is running or waiting for a condition.
Fork: PROC[PROC] RETURNS[PROCESS];
Join: PROC[PROCESS];
CatalogProcId: PROC [process: PROCESS];
AbortAll: PROC;
NotifyAll: PROC[p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15: Handle ← NIL];
Abort: PROC;
ProcessEnd: PROC;
GetProcessSize: PROC RETURNS[CARDINAL];
Delay: PROC[CARDINAL];
RandomDelay: PROC [min, max: CARDINAL];
-- Delays random number of ticks between min and max
StandardDelay: PROC;
Wait: PROC [LONG POINTER TO CONDITION];
IncCurrent: PROC;
-- Increment the number of currently active processes
DecCurrent: PROC;
}.