Mercurial > pygar
view common/Mixer.bsv @ 3:5e0595db14f6 pygar svn.4
[svn r4] added bluespec manual to documents
author | rlm |
---|---|
date | Tue, 20 Apr 2010 20:09:46 -0400 |
parents | 996f1d6cd010 |
children | cdad17407328 |
line wrap: on
line source
1 import FIFOF::*;2 import FIFO::*;5 interface Mixer;6 method Action feed(Sample samp, VoiceId id); // feed in a sample to a specific FIFOF7 method Action stream(); // Outputs muxed data.8 endinterface11 method vectorFull?(Vector#(FIFOF#(Sample)) vect)13 (reduce .notEmpty vect)15 endmethod19 module mkMixer(Mixer);21 FIFO output = mkFIFO();24 // make vector of fifos, length = MAX_VOICES25 fifo_vect Vector#(FIFOF#(Sample)) = mkVector(`MAX_VOICES);28 for $i(1 .. `MAX_VOICES)29 begin30 fifo_vect[$i] = mkFIFOF();31 end33 rule(vectorFull?(fifo_vect))35 Sample out = (/ (reduce + fofo_vector) `MAX_VOICES)36 output.enq(out);38 endrule41 endmodule