comparison common/Mixer.bsv @ 2:996f1d6cd010 pygar svn.3

[svn r3] added pseudo code for Mixer, and defined Samples and VoiceID in PathTypes.
author rlm
date Wed, 14 Apr 2010 15:02:32 -0400
parents
children cdad17407328
comparison
equal deleted inserted replaced
1:91a1f76ddd62 2:996f1d6cd010
1 import FIFOF::*;
2 import FIFO::*;
3
4
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
9
10
11 method vectorFull?(Vector#(FIFOF#(Sample)) vect)
12
13 (reduce .notEmpty vect)
14
15 endmethod
16
17
18
19 module mkMixer(Mixer);
20
21 FIFO output = mkFIFO();
22
23
24 // make vector of fifos, length = MAX_VOICES
25 fifo_vect Vector#(FIFOF#(Sample)) = mkVector(`MAX_VOICES);
26
27
28 for $i(1 .. `MAX_VOICES)
29 begin
30 fifo_vect[$i] = mkFIFOF();
31 end
32
33 rule(vectorFull?(fifo_vect))
34
35 Sample out = (/ (reduce + fofo_vector) `MAX_VOICES)
36 output.enq(out);
37
38 endrule
39
40
41 endmodule
42