Mercurial > pygar
view core/src/RoutingTable.bsv @ 20:a346d9e5118a pygar svn.21
[svn r21] deleted emacs save files
author | rlm |
---|---|
date | Tue, 27 Apr 2010 23:43:41 -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 endfunction10 interface RoutingTable;11 method FullPath getPath(Integer voiceNo);12 method getMixerScalar();13 endinterface15 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 endfunction25 //demonstrate two ways of building the routeTable26 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 toinvalid32 // 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 update39 for(Integer i = 0; i < len; i = i+1)40 outPath[i] = route[i];42 return outPath;43 endfunction44 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 endmethod55 method Integer(57 endmodule