annotate common/RoutingTable.bsv @ 25:220c14f5963c pygar svn.26

[svn r26] Not fully connected but passes audio successfully
author punk
date Wed, 28 Apr 2010 12:01:37 -0400
parents 7e1510b47336
children
rev   line source
punk@16 1 import Trace::*;
punk@16 2 import Vector::*;
punk@16 3 import PathTypes::*;
punk@16 4
punk@16 5 function FullPath genEmptyPaths (Integer a) ;
punk@16 6 FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore};
punk@16 7 return (empt);
punk@16 8 endfunction
punk@16 9
punk@16 10 interface RoutingTable;
punk@16 11 method FullPath getPath(Integer voiceNo);
punk@16 12 endinterface
punk@16 13
punk@16 14 module mkRoutingTable(RoutingTable);
punk@16 15 Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths);
punk@16 16
punk@16 17 function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath);
punk@16 18 CorePath outPath = inPath;
punk@16 19 for(Integer i = 0; i < len; i = i+1)
punk@16 20 inPath[i] = cores[i];
punk@16 21 return outPath;
punk@16 22 endfunction
punk@16 23
punk@16 24 //demonstrate two ways of building the routeTable
punk@16 25 routeTable[0].startAddr = 0; //where is this really going to come from?
punk@16 26 routeTable[0].route[0] = 3;
punk@16 27 routeTable[0].route[1] = mixerId;
punk@16 28 //rest are already initialized toinvalid
punk@16 29
punk@16 30 // or if you just want to update a straight list, this longer emplate works.
punk@16 31 function CorePath createVoice1Route();
punk@16 32 CorePath outPath = emptyCore;
punk@16 33
punk@16 34 Integer len = 3;
punk@16 35 PathId route[len] = {1, 2, mixerId}; //route to update
punk@16 36
punk@16 37 for(Integer i = 0; i < len; i = i+1)
punk@16 38 outPath[i] = route[i];
punk@16 39
punk@16 40 return outPath;
punk@16 41 endfunction
punk@16 42 routeTable[1].route = createVoice1Route;
punk@16 43 routeTable[1].startAddr = 0;
punk@16 44
punk@16 45 //remaining voices are all initialized to empty.
punk@16 46
punk@16 47 method FullPath getPath(Integer a);
punk@16 48 return routeTable[a];
punk@16 49 endmethod
punk@16 50
punk@16 51 endmodule
punk@16 52