rlm@8: import Trace::*; rlm@8: import Vector::*; rlm@8: import PathTypes::*; rlm@8: rlm@8: function FullPath genEmptyPaths (Integer a) ; rlm@8: FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore}; rlm@8: return (empt); rlm@8: endfunction rlm@8: rlm@8: interface RoutingTable; rlm@8: method FullPath getPath(Integer voiceNo); rlm@8: endinterface rlm@8: rlm@8: module mkRoutingTable(RoutingTable); rlm@8: Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths); rlm@8: rlm@8: function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath); rlm@8: CorePath outPath = inPath; rlm@8: for(Integer i = 0; i < len; i = i+1) rlm@8: inPath[i] = cores[i]; rlm@8: return outPath; rlm@8: endfunction rlm@8: rlm@8: //demonstrate two ways of building the routeTable rlm@8: routeTable[0].startAddr = 0; //where is this really going to come from? rlm@8: routeTable[0].route[0] = 3; rlm@8: routeTable[0].route[1] = mixerId; rlm@8: //rest are already initialized toinvalid rlm@8: rlm@8: // or if you just want to update a straight list, this longer emplate works. rlm@8: function CorePath createVoice1Route(); rlm@8: CorePath outPath = emptyCore; rlm@8: rlm@8: Integer len = 3; rlm@8: PathId route[len] = {1, 2, mixerId}; //route to update rlm@8: rlm@8: for(Integer i = 0; i < len; i = i+1) rlm@8: outPath[i] = route[i]; rlm@8: rlm@8: return outPath; rlm@8: endfunction rlm@8: routeTable[1].route = createVoice1Route; rlm@8: routeTable[1].startAddr = 0; rlm@8: rlm@8: //remaining voices are all initialized to empty. rlm@8: rlm@8: method FullPath getPath(Integer a); rlm@8: return routeTable[a]; rlm@8: endmethod rlm@8: rlm@8: endmodule rlm@8: