# HG changeset patch # User punk # Date 1271847071 14400 # Node ID c4438eca4bc4c040d0f06d8b8bec04b8e9764605 # Parent 5e0595db14f6a2f81d87df753ad101c1b014d4b0 [svn r5] Updates to PathTypes and addition of RoutingTable diff -r 5e0595db14f6 -r c4438eca4bc4 core/src/PathTypes.bsv --- a/core/src/PathTypes.bsv Tue Apr 20 20:09:46 2010 -0400 +++ b/core/src/PathTypes.bsv Wed Apr 21 06:51:11 2010 -0400 @@ -20,15 +20,12 @@ // Path is array of path ids typedef Vector#(`MAX_PATH_LENGTH, PathId) CorePath; +CorePath emptyCore = replicate(endId); + typedef struct { + VoiceId voice; MemAddr startAddr; CorePath route; - } FullPath deriving(Eq, Bits); - -vector#(`MAX_VOICES, FullPath) routeTable; -CorePath aroute = {1, 2}; -routeTable = {{12, aroute},{1, aroute}}; +} FullPath deriving (Bits, Eq); - - diff -r 5e0595db14f6 -r c4438eca4bc4 core/src/RoutingTable.bsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/src/RoutingTable.bsv Wed Apr 21 06:51:11 2010 -0400 @@ -0,0 +1,52 @@ +import Trace::*; +import Vector::*; +import PathTypes::*; + +function FullPath genEmptyPaths (Integer a) ; + FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore}; + return (empt); +endfunction + +interface RoutingTable; + method FullPath getPath(Integer voiceNo); +endinterface + +module mkRoutingTable(RoutingTable); + Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths); + + function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath); + CorePath outPath = inPath; + for(Integer i = 0; i < len; i = i+1) + inPath[i] = cores[i]; + return outPath; + endfunction + + //demonstrate two ways of building the routeTable + routeTable[0].startAddr = 0; //where is this really going to come from? + routeTable[0].route[0] = 3; + routeTable[0].route[1] = mixerId; + //rest are already initialized toinvalid + + // or if you just want to update a straight list, this longer emplate works. + function CorePath createVoice1Route(); + CorePath outPath = emptyCore; + + Integer len = 3; + PathId route[len] = {1, 2, mixerId}; //route to update + + for(Integer i = 0; i < len; i = i+1) + outPath[i] = route[i]; + + return outPath; + endfunction + routeTable[1].route = createVoice1Route; + routeTable[1].startAddr = 0; + + //remaining voices are all initialized to empty. + + method FullPath getPath(Integer a); + return routeTable[a]; + endmethod + +endmodule +