view core/src/RoutingTable.bsv @ 31:f41eef1bebfc pygar svn.32

[svn r32] Attempting to run soft core and audio
author punk
date Sat, 01 May 2010 11:50:20 -0400
parents 7393cd19371e
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, outVol: 0};
7 return (empt);
8 endfunction
10 interface RoutingTable;
11 method FullPath getPath(Integer voiceNo);
12 method getMixerScalar();
13 endinterface
15 module mkRoutingTable(RoutingTable);
16 Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths);
18 function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath);
19 CorePath outPath = inPath;
20 for(Integer i = 0; i < len; i = i+1)
21 inPath[i] = cores[i];
22 return outPath;
23 endfunction
25 //demonstrate two ways of building the routeTable
26 routeTable[0].startAddr = 0; //where is this really going to come from?
27 routeTable[0].route[0] = 3;
28 routeTable[0].route[1] = mixerId;
29 routeTable[0].outVol = 200;
30 //rest are already initialized toinvalid
32 // or if you just want to update a straight list, this longer emplate works.
33 function CorePath createVoice1Route();
34 CorePath outPath = emptyCore;
36 Integer len = 3;
37 PathId route[len] = {1, 2, mixerId}; //route to update
39 for(Integer i = 0; i < len; i = i+1)
40 outPath[i] = route[i];
42 return outPath;
43 endfunction
44 routeTable[1].route = createVoice1Route;
45 routeTable[1].startAddr = 0;
46 routeTable[1].outVol = 200;
49 //remaining voices are all initialized to empty.
51 method FullPath getPath(Integer a);
52 return routeTable[a];
53 endmethod
55 method Integer(
57 endmodule