SynthesisPortsRec:
TYPE =
RECORD[
Lock, LockFall, Control, CK, RegAddress, LockDelay, OverFlow, Sum, Addend, T0, Decrement, DelayEqual: Port ← NIL];
SynthesisTestProc: RosemaryUser.TestProc = {
ports: SynthesisPorts ← SynthesisInitialize[p, cellType.public, Eval ! Rosemary.Stop => IF reason = $BoolWireHasX THEN RESUME ELSE REJECT];
{OPEN ports, BitOps;
freqBitCount: NAT = 16;
freqDoIt: NAT = 0;
freqDisIncDec: NAT = 1;
freqDisableSum: NAT = 2;
freqBitOfData: NAT = 3;
lockDelayReg: NAT = 3;
FreqStore:
PROC [value:
NAT, reg:
NAT] = {
PDW[RegAddress, reg, force];
SynthesisCycleClock[ports, Eval];
FOR bitIndex:
NAT
IN [0..freqBitCount)
DO
b: BitDWord ← bitIndex;
IF EBFD[value, freqBitCount-bitIndex-1, freqBitCount] THEN b ← IBID[TRUE, b, freqBitOfData, 8];
PDW[Control, b, force];
SynthesisCycleClock[ports, Eval];
b ← IBID[TRUE, b, freqDoIt, 8];
PDW[Control, b, force];
THROUGH [1..32] DO SynthesisCycleClock[ports, Eval]; ENDLOOP;
ENDLOOP;
};
CycleLock:
PROC [cycles:
NAT] = {
PB[Lock, TRUE, force];
THROUGH [1..cycles] DO SynthesisCycleClock[ports, Eval]; ENDLOOP;
PB[Lock, FALSE, force];
SynthesisCycleClock[ports, Eval];
PB[LockFall, TRUE, force];
SynthesisCycleClock[ports, Eval];
PB[LockFall, FALSE, force];
THROUGH [1..cycles-2] DO SynthesisCycleClock[ports, Eval]; ENDLOOP;
};
FreqStore[6, lockDelayReg];
THROUGH [1..4]
DO
CycleLock[128];
CycleLock[64];
ENDLOOP;
SynthesisInitialize:
PROC [p: Ports.Port, public: Core.Wire, eval: RosemaryUser.TestEvalProc]
RETURNS [ports: SynthesisPorts]= {
ports ← NEW[SynthesisPortsRec];
{OPEN ports;
[Lock, LockFall, Control, CK, RegAddress, LockDelay, OverFlow, Sum, Addend, T0, Decrement, DelayEqual] ← Ports.BindPorts[public, p, "Lock", "LockFall", "Control", "CK", "RegAddress", "LockDelay", "OverFlow", "Sum", "Addend", "T0", "Decrement", "DelayEqual"];
PB[Lock, FALSE, force];
PB[LockFall, FALSE, force];
PDW[Control, 0, force];
PDW[RegAddress, 0, force];
PB[LockDelay, FALSE, none];
PB[OverFlow, FALSE, none];
PB[Sum, FALSE, none];
PB[Addend, FALSE, none];
PB[T0, FALSE, none];
PB[Decrement, FALSE, none];
PB[DelayEqual, FALSE, none];
SynthesisCycleClock[ports, eval];
}};