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