annotate modules/bluespec/Pygar/core/mixer.bsv @ 42:ced2ebd41347 pygar svn.43

[svn r43] bunch of updates that almost work...
author punk
date Wed, 05 May 2010 01:09:09 -0400
parents 2c8166d205d5
children
rev   line source
punk@33 1 // The MIT License
punk@33 2
punk@33 3 // Copyright (c) 2009 Massachusetts Institute of Technology
punk@33 4
punk@33 5 // Permission is hereby granted, free of charge, to any person obtaining a copy
punk@33 6 // of this software and associated documentation files (the "Software"), to deal
punk@33 7 // in the Software without restriction, including without limitation the rights
punk@33 8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
punk@33 9 // copies of the Software, and to permit persons to whom the Software is
punk@33 10 // furnished to do so, subject to the following conditions:
punk@33 11
punk@33 12 // The above copyright notice and this permission notice shall be included in
punk@33 13 // all copies or substantial portions of the Software.
punk@33 14
punk@33 15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
punk@33 16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
punk@33 17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
punk@33 18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
punk@33 19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
punk@33 20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
punk@33 21 // THE SOFTWARE.
punk@33 22
punk@33 23 import Connectable::*;
punk@33 24 import GetPut::*;
punk@33 25 import ClientServer::*;
punk@33 26 import Processor::*;
punk@33 27 import MemArb::*;
punk@33 28 import MemTypes::*;
punk@33 29
punk@33 30 //AWB includes
punk@33 31 `include "asim/provides/low_level_platform_interface.bsh"
punk@33 32 `include "asim/provides/soft_connections.bsh"
punk@33 33 `include "asim/provides/common_services.bsh"
punk@33 34
punk@33 35 // Local includes
punk@33 36 `include "asim/provides/processor_library.bsh"
punk@33 37 `include "asim/provides/audio_pipe_types.bsh"
punk@33 38 `include "asim/provides/path_types.bsh"
punk@33 39
punk@33 40 interface PutMixerIn;
punk@33 41 method Action sendVoiceIn(AudioStream voiceInput);
punk@33 42 endinterface
punk@33 43
punk@33 44 interface Mixer#(Vector#(`MAX_VOICES, Volume));
punk@33 45 interface PutMixerIn toMixer;
punk@33 46 interface Get#(AudioProcessorUnit) mixerOut;
punk@33 47 endinterface
punk@33 48
punk@33 49
punk@33 50 module [CONNECTED_MODULE] mkMixer( Mixer#(Vector(`MAX_VOICES, Volume)));
punk@33 51 // Instantiate the modules
punk@33 52 Vector#(`MAX_VOICES, FIFO#(AudioPipeUnit)) voicesIn <- newVector();
punk@33 53 Vector#(`MAX_VOICES, Bool) voiceEnded <- replicate(False);
punk@33 54
punk@33 55 FIFO#(AudioProcessorUnit) masterFifo <- mkFIFO();
punk@33 56
punk@33 57 rule processSample //implicit on all voiceFifos having data
punk@33 58 endrule
punk@33 59
punk@33 60 // Internal connections
punk@33 61
punk@33 62 interface PutMixerIn toMixer;
punk@33 63 method Action sendVoiceIn(AudioStream voiceInput);
punk@33 64 voicesIn[voiceInput.voice].enq(voiceInput.data);
punk@33 65 endmethod
punk@33 66
punk@33 67 interface Get mixerOut = fifoToGet(masterFifo);
punk@33 68
punk@33 69 endmodule