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]; 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], expr: expr]]]; ENDLOOP; }; END. ψMCCounter.mesa Copyright c 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 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 type: latch, fedBackInput: FindInternal[table, MC.IndexedName["ArrayAdrsxBA", index]], Κƒ˜code™Kšœ Οmœ1™