package VRAM; import Connectable::*; import GetPut::*; import ClientServer::*; import Vector::*; import FIFOF::*; import SpecialFIFOs::*; import MemArbiter::*; import VRAMCore::*; // Re-exports from VRAMCore export VRAMAddr, VRAMData, VRAMRequest(..), VRAMResponse(..); export VRAMServer(..); export VRAMClient(..); export VRAM(..), mkVRAM; export mkArbitratedVRAMServers; // A VRAMServer is a memory port. typedef Server#(VRAMRequest, VRAMResponse) VRAMServer; // A VRAMClient is a user of a memory port. typedef Client#(VRAMRequest, VRAMResponse) VRAMClient; // mkArbitratedVRAMServers expands a VRAMServer port into multiple // ports through the use of a MemArbiter. module mkArbitratedVRAMServers(VRAMServer ram, MemArbiter#(n, VRAMAddr) arb, Vector#(n, VRAMServer) ifc) provisos (Min#(n, 1, 1), Alias#(port_idx, UInt#(TLog#(n)))); Vector#(n, FIFOF#(VRAMRequest)) requests <- replicateM(mkBypassFIFOF()); Vector#(n, FIFOF#(VRAMResponse)) responses <- replicateM(mkBypassFIFOF()); Reg#(Maybe#(port_idx)) awaiting_response[2] <- mkCReg(2, tagged Invalid); (* fire_when_enabled *) rule request_ports; for (Integer i=0; i