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