annotate modules/bluespec/Pygar/core/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 74716e9a81cc
children 2c8166d205d5
rev   line source
rlm@8 1 import Trace::*;
rlm@8 2 import Vector::*;
rlm@8 3 import PathTypes::*;
rlm@8 4
rlm@8 5 function FullPath genEmptyPaths (Integer a) ;
rlm@8 6 FullPath empt = FullPath {voice: fromInteger(a), startAddr: 0, route: emptyCore};
rlm@8 7 return (empt);
rlm@8 8 endfunction
rlm@8 9
rlm@8 10 interface RoutingTable;
rlm@8 11 method FullPath getPath(Integer voiceNo);
rlm@8 12 endinterface
rlm@8 13
rlm@8 14 module mkRoutingTable(RoutingTable);
rlm@8 15 Vector#(`MAX_VOICES, FullPath) routeTable = genWith(genEmptyPaths);
rlm@8 16
rlm@8 17 function CorePath updateVoice0(Integer len, Vector#(len, PathId) cores, CorePath inPath);
rlm@8 18 CorePath outPath = inPath;
rlm@8 19 for(Integer i = 0; i < len; i = i+1)
rlm@8 20 inPath[i] = cores[i];
rlm@8 21 return outPath;
rlm@8 22 endfunction
rlm@8 23
rlm@8 24 //demonstrate two ways of building the routeTable
rlm@8 25 routeTable[0].startAddr = 0; //where is this really going to come from?
rlm@8 26 routeTable[0].route[0] = 3;
rlm@8 27 routeTable[0].route[1] = mixerId;
rlm@8 28 //rest are already initialized toinvalid
rlm@8 29
rlm@8 30 // or if you just want to update a straight list, this longer emplate works.
rlm@8 31 function CorePath createVoice1Route();
rlm@8 32 CorePath outPath = emptyCore;
rlm@8 33
rlm@8 34 Integer len = 3;
rlm@8 35 PathId route[len] = {1, 2, mixerId}; //route to update
rlm@8 36
rlm@8 37 for(Integer i = 0; i < len; i = i+1)
rlm@8 38 outPath[i] = route[i];
rlm@8 39
rlm@8 40 return outPath;
rlm@8 41 endfunction
rlm@8 42 routeTable[1].route = createVoice1Route;
rlm@8 43 routeTable[1].startAddr = 0;
rlm@8 44
rlm@8 45 //remaining voices are all initialized to empty.
rlm@8 46
rlm@8 47 method FullPath getPath(Integer a);
rlm@8 48 return routeTable[a];
rlm@8 49 endmethod
rlm@8 50
rlm@8 51 endmodule
rlm@8 52