MCCounter.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Created by: Sindhu, June 20, 1985 7:04:53 pm PDT
Last Edited by: Sindhu, July 8, 1985 12:54:24 pm PDT
DIRECTORY
AlpsBool, MC, MCCtl, PW;
MCCounter: CEDAR PROGRAM
IMPORTS AlpsBool, MC, MCCtl, PW
EXPORTS MCCtl =
BEGIN OPEN AlpsBool, MCCtl;
Counter: PUBLIC PROC [table: TableOfVariables] = {
numBits: INT = PW.Log2[MC.nLines];
Since the counter is a power of 2, we don't care where the counter starts on ResetxAB, so for the debug version we leave ResetxAB out of the picture.
The inputs to the counter are ArrayAdrsxBA and Incr; the outputs are ArrayAdrsxAB
FOR index: INT IN [0..numBits) DO
me: Expression ← Find[table, MC.IndexedName["ArrayAdrsxBA", index]];
allUnderAreOnes: Expression ← true;
expr: Expression;
FOR under: INT IN (index .. numBits) DO
allUnderAreOnes ← And[table,
allUnderAreOnes,
Find[table, MC.IndexedName["ArrayAdrsxBA", under]]];
ENDLOOP;
expr ← If[table,
Find[table, "Incr"],
If[table, allUnderAreOnes, Not[me], me],
me];
AddOutput[table, NEW[OutputRec ← [
name: MC.IndexedName["ArrayAdrsxAB", index],
type: latch,
fedBackInput: FindInternal[table, MC.IndexedName["ArrayAdrsxBA", index]],
expr: expr]]];
ENDLOOP;
};
END.