view common/Mixer.bsv @ 76:8bd0e4d37ad2 pygar svn.77 tip

[svn r77] I don't know why my last change didn't go through grumble grumble....
author rlm
date Wed, 12 May 2010 08:58:23 -0400
parents cdad17407328
children
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 FIFOF
7 method Action stream(); // Outputs muxed data.
8 endinterface
11 method vectorFull?(Vector#(FIFOF#(Sample)) vect)
13 (reduce .notEmpty vect)
15 endmethod
19 module mkMixer(Mixer);
21 FIFO output = mkFIFO();
24 // make vector of fifos, length = MAX_VOICES
25 fifo_vect Vector#(FIFOF#(Sample)) = mkVector(`MAX_VOICES);
28 for $i(1 .. `MAX_VOICES)
29 begin
30 fifo_vect[$i] = mkFIFOF();
31 end
33 rule(vectorFull?(fifo_vect))
35 Sample out = (/ (reduce + fifo_vector) (log `MAX_VOICES))
36 output.enq(out);
38 endrule
41 endmodule