# HG changeset patch # User rlm # Date 1271271752 14400 # Node ID 996f1d6cd0106674d8813345abefdb12fc8af441 # Parent 91a1f76ddd62f343cc5f7fcf41f38928852a1390 [svn r3] added pseudo code for Mixer, and defined Samples and VoiceID in PathTypes. diff -r 91a1f76ddd62 -r 996f1d6cd010 common/Mixer.bsv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/Mixer.bsv Wed Apr 14 15:02:32 2010 -0400 @@ -0,0 +1,42 @@ +import FIFOF::*; +import FIFO::*; + + +interface Mixer; + method Action feed(Sample samp, VoiceId id); // feed in a sample to a specific FIFOF + method Action stream(); // Outputs muxed data. +endinterface + + +method vectorFull?(Vector#(FIFOF#(Sample)) vect) + + (reduce .notEmpty vect) + +endmethod + + + +module mkMixer(Mixer); + + FIFO output = mkFIFO(); + + + // make vector of fifos, length = MAX_VOICES + fifo_vect Vector#(FIFOF#(Sample)) = mkVector(`MAX_VOICES); + + + for $i(1 .. `MAX_VOICES) + begin + fifo_vect[$i] = mkFIFOF(); + end + + rule(vectorFull?(fifo_vect)) + + Sample out = (/ (reduce + fofo_vector) `MAX_VOICES) + output.enq(out); + + endrule + + +endmodule + diff -r 91a1f76ddd62 -r 996f1d6cd010 core/src/PathTypes.bsv --- a/core/src/PathTypes.bsv Tue Apr 13 17:34:33 2010 -0400 +++ b/core/src/PathTypes.bsv Wed Apr 14 15:02:32 2010 -0400 @@ -10,6 +10,9 @@ typedef Bit#(32) MemAddr; typedef Int#(TLog#(`MAX_PATH_IDS)) PathId; +typedef Int#(24) Sample; +typedef Int#(TLog#(`MAX_VOICES)) VoiceId; + //The mixer is identified as PathId 0, path end is max PathId mixerId = 0;