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