Mercurial > pygar
view common/RoutingTable.bsv @ 47:97d1959f7c5c pygar svn.48
[svn r48] changed sctipt to use our own programs, changed rlp.wav and rlp1.wav to be shorter
author | rlm |
---|---|
date | Wed, 05 May 2010 13:23:58 -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 endfunction10 interface RoutingTable;11 method FullPath getPath(Integer voiceNo);12 endinterface14 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 endfunction24 //demonstrate two ways of building the routeTable25 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 toinvalid30 // 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 update37 for(Integer i = 0; i < len; i = i+1)38 outPath[i] = route[i];40 return outPath;41 endfunction42 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 endmethod51 endmodule