view common/RoutingTable.bsv @ 68:44cc00df1168 pygar svn.69

[svn r69] runs separate eofs (I think)
author punk
date Wed, 12 May 2010 00:06:05 -0400
parents 7e1510b47336
children
line wrap: on
line source
1 import Trace::*;
2 import Vector::*;
3 import PathTypes::*;
5 function FullPath genEmptyPaths (Integer a) ;
6 FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore};
7 return (empt);
8 endfunction
10 interface RoutingTable;
11 method FullPath getPath(Integer voiceNo);
12 endinterface
14 module mkRoutingTable(RoutingTable);
15 Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths);
17 function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath);
18 CorePath outPath = inPath;
19 for(Integer i = 0; i < len; i = i+1)
20 inPath[i] = cores[i];
21 return outPath;
22 endfunction
24 //demonstrate two ways of building the routeTable
25 routeTable[0].startAddr = 0; //where is this really going to come from?
26 routeTable[0].route[0] = 3;
27 routeTable[0].route[1] = mixerId;
28 //rest are already initialized toinvalid
30 // or if you just want to update a straight list, this longer emplate works.
31 function CorePath createVoice1Route();
32 CorePath outPath = emptyCore;
34 Integer len = 3;
35 PathId route[len] = {1, 2, mixerId}; //route to update
37 for(Integer i = 0; i < len; i = i+1)
38 outPath[i] = route[i];
40 return outPath;
41 endfunction
42 routeTable[1].route = createVoice1Route;
43 routeTable[1].startAddr = 0;
45 //remaining voices are all initialized to empty.
47 method FullPath getPath(Integer a);
48 return routeTable[a];
49 endmethod
51 endmodule