<> <> <> DIRECTORY Boole, BooleCore, CoreCreate, EU2DPControl, EU2LeafUtils, EU2Utils, Ports, Rosemary; EU2DPControlImpl: CEDAR PROGRAM IMPORTS Boole, BooleCore, CoreCreate, EU2LeafUtils, EU2Utils EXPORTS EU2DPControl = BEGIN OPEN Boole, BooleCore, CoreCreate, EU2DPControl, EU2Utils; ExprProc: TYPE ~ PROC [i: NAT] RETURNS [Expression]; AppendInput: PROC [name: ROPE, public: Wire, inputD: Inputs] RETURNS [ins: Inputs]~ { wire: Wire _ FindWire[public, name]; inv: CellType _ EU2LeafUtils.AlpsExtract["InputDriver.sch"]; IF wire.size=0 THEN RETURN [CONS[[input: wire, driver: inv], inputD]]; ins _ inputD; FOR i: INT IN [0..wire.size) DO ins _ CONS[[input: Index[wire, i], driver: inv], ins]; ENDLOOP; }; AppendOutput: PROC [wire: WR, expr: Expression, clock: ROPE, outputDrivers: Outputs] RETURNS [Outputs] ~ { out: CellType _ EU2LeafUtils.AlpsExtract["ClockedOutputDriver.sch"]; RETURN [CONS[ [driver: out, pas: LIST[["Clock", clock]], output: wire, expr: expr], outputDrivers]]; }; <<-- Creates the control for the bottom of the Datapath, i.e. everything but the ram and the KBus pads>> CreateDPControl: PUBLIC PROC RETURNS [cellType: CellType] = { MakeSelExpr: PROC [reg: PipeRange, exprProc: ExprProc, clock: ROPE] ~ { FOR i: INT IN [0..sources[reg].sizeSel) DO outputDrivers _ AppendOutput[ wire: Index[sources[reg].nameSel, i], expr: exprProc[i], clock: clock, outputDrivers: outputDrivers]; ENDLOOP; }; inputDrivers: Inputs _ NIL; outputDrivers: Outputs _ NIL; public: Wire _ Union[ -- beware of the order! Wires["hold"], -- a hack for now!!! GenPGnEWires[], GenClockWires[], GenWiresCtrlToPads[], GenWiresPadsToCtrl[], GenWiresDBus[], GenWiresCtrlToRegs[], GenWiresCtrlToALU[], GenWiresCtrlToFU[], GenWiresDPToCtrl[]]; <<-- composite wires to be interpreted as numbers>> leftSrc: Wire _ FindWire[public, "leftSrc"]; rightSrc: Wire _ FindWire[public, "rightSrc"]; st2ASrc: Wire _ FindWire[public, "st2ASrc"]; aluOp: Wire _ FindWire[public, "aluOp"]; fd: Wire _ FindWire[public, "fd"]; insertFd: Wire _ FindWire[fd, "insertFd"]; maskFd: Wire _ FindWire[fd, "maskFd"]; shiftFd: Wire _ FindWire[fd, "shiftFd"]; <<-- expressions on one bit>> reject: Expression _ WireVar[public, "reject"]; -- latched on PhB, simple driver!!! nReject: Expression _ Not[reject]; nHold: Expression _ Not[WireVar[public, "hold"]]; <> st3AisC: Expression _ WireVar[public, "st3AisC"]; fetch: Expression _ WireVar[public, "res3BisP"]; store: Expression _ WireVar[public, "writePBus"]; <<>> <<-- PhA latches>> LeftExpr: ExprProc = {RETURN[And[nReject, nHold, EqualInt[public, leftSrc, i]]]}; -- selLeftSrc[i] _ PhA . (leftSrc=i) . ~reject . ~hold RightExpr: ExprProc = {RETURN[And[nReject, nHold, EqualInt[public, rightSrc, i]]]}; <<-- selRightSrc[i] _ PhA . (rightSrc=i) . ~reject . ~hold>> St2AExpr: ExprProc = {RETURN[And[nReject, nHold, EqualInt[public, st2ASrc, i]]]}; <<-- selSt2ASrc[i] _ PhA . (st2ASrc=i) . ~reject . ~hold>> <> <<-- selFieldSrc _ PhA . loadField . ~reject . ~hold>> R3AExpr: ExprProc = {RETURN[And[nReject, nHold]]}; <<-- selRes3ABSrc _ PhA . ~reject . ~hold>> St3AExpr: ExprProc = {RETURN[ SELECT i FROM 0 => And[nReject, nHold, Not[st3AisC]], 1 => And[nReject, nHold, st3AisC], ENDCASE => ERROR]}; <<-- selSt3ABSrc[st2B] _ PhA . ~st3AisC . ~reject . ~hold>> <<-- selSt3ABSrc[cBus] _ PhA . st3AisC . ~reject . ~hold>> <<-- PhB latches>> KRegExpr: ExprProc = {RETURN[nHold]}; <<-- selKRegAdr _ PhB . ~hold>> R2BExpr: ExprProc = {RETURN[ SELECT i FROM 0 => And[nHold, Nor[ -- aluOut EqualInt[public, aluOp, FOP], -- neither FOP EqualInt[public, aluOp, BndChk]]], -- nor BndChk 1 => And[nHold, EqualInt[public, aluOp, FOP]], -- fuOut 2 => And[nHold, EqualInt[public, aluOp, BndChk]], -- left ENDCASE => ERROR]}; <<-- selRes2BASrc[aluOut] _ PhB . ~hold . (aluOp=FOP)>> <<-- selRes2BASrc[fuOut] _ PhB . ~hold . (aluOp#FOP)>> <<-- selRes2BASrc[left] _ PhB . ~hold . (aluOp=BndChk)>> St2BExpr: ExprProc = {RETURN[nHold]}; <<-- selSt2BASrc _ PhB . ~hold>> R3BExpr: ExprProc = {RETURN[nHold]}; <<-- selRes3BASrc[tBus] _ PhB . ~hold>> DataInExpr: ExprProc = {RETURN[nHold]}; <<-- selDataInSrc _ PhB . ~hold>> <<-- Special guys>> <> <