Mercurial > pygar
comparison modules/bluespec/Pygar/core/RoutingTable.bsv @ 8:74716e9a81cc pygar svn.9
[svn r9] Pygar now has the proper directory structure to play nicely with awb. Also, the apm file for audio-core willcompile successfully.
author | rlm |
---|---|
date | Fri, 23 Apr 2010 02:32:05 -0400 |
parents | |
children | 2c8166d205d5 |
comparison
equal
deleted
inserted
replaced
7:7393cd19371e | 8:74716e9a81cc |
---|---|
1 import Trace::*; | |
2 import Vector::*; | |
3 import PathTypes::*; | |
4 | |
5 function FullPath genEmptyPaths (Integer a) ; | |
6 FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore}; | |
7 return (empt); | |
8 endfunction | |
9 | |
10 interface RoutingTable; | |
11 method FullPath getPath(Integer voiceNo); | |
12 endinterface | |
13 | |
14 module mkRoutingTable(RoutingTable); | |
15 Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths); | |
16 | |
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 | |
23 | |
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 | |
29 | |
30 // or if you just want to update a straight list, this longer emplate works. | |
31 function CorePath createVoice1Route(); | |
32 CorePath outPath = emptyCore; | |
33 | |
34 Integer len = 3; | |
35 PathId route[len] = {1, 2, mixerId}; //route to update | |
36 | |
37 for(Integer i = 0; i < len; i = i+1) | |
38 outPath[i] = route[i]; | |
39 | |
40 return outPath; | |
41 endfunction | |
42 routeTable[1].route = createVoice1Route; | |
43 routeTable[1].startAddr = 0; | |
44 | |
45 //remaining voices are all initialized to empty. | |
46 | |
47 method FullPath getPath(Integer a); | |
48 return routeTable[a]; | |
49 endmethod | |
50 | |
51 endmodule | |
52 |