Mercurial > pygar
view modules/bluespec/Pygar/core/RoutingTable.bsv @ 15:a1833d9f6e3d pygar svn.16
[svn r16] Recent
author | punk |
---|---|
date | Tue, 27 Apr 2010 13:11:45 -0400 |
parents | 74716e9a81cc |
children | 2c8166d205d5 |
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