Mercurial > pygar
view modules/bluespec/Pygar/core/RoutingTable.bsv @ 63:1d5cbb5343d2 pygar svn.64
[svn r64] mods to compile correctly for FPGA
author | punk |
---|---|
date | Mon, 10 May 2010 22:54:54 -0400 |
parents | 2c8166d205d5 |
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 Vector#(`MAX_VOICES, Volume) getMixerScalars();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 template 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;48 //remaining voices are all initialized to empty.50 method FullPath getPath(Integer a);51 return routeTable[a];52 endmethod54 method Vector#(`MAX_VOICES, Volume) getMixerScalars();55 Vector#(`MAX_VOICES, Volume) scalars = newVector();56 for(Integer i = 0; i < `MAX_VOICES; i = i+1)57 scalars[i] = routeTable[i].outVol;58 return scalars;59 endmethod61 endmodule