diff modules/bluespec/Pygar/core/audioCorePipeline.bsv @ 53:2991344775f8 pygar svn.54

[svn r54] mixer integrated
author punk
date Sun, 09 May 2010 10:58:40 -0400
parents 49049f97312c
children 9b4f237e77e1
line wrap: on
line diff
     1.1 --- a/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Thu May 06 08:57:53 2010 -0400
     1.2 +++ b/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Sun May 09 10:58:40 2010 -0400
     1.3 @@ -49,12 +49,16 @@
     1.4  module [CONNECTED_MODULE] mkConnectedApplication ();
     1.5     Core core <- mkCore(`VDEV_SCRATCH_MEMORYA);
     1.6     Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB);
     1.7 -
     1.8 +   Vector#(2, Volume) channelVols = replicate(127);
     1.9 +   Mixer mixer <- mkMixer(2, channelVols); //should be max voices but 2 for now
    1.10 +   
    1.11     Reg#(int) cycle <- mkReg(0);
    1.12 +   Reg#(int) sampleCount <-mkReg(0);
    1.13     Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False));
    1.14  
    1.15 -  // Services Samples 
    1.16 -  ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();   
    1.17 +//   FIFO#(AudioProcessorUnit) coreOut <- mkFIFO();
    1.18 +   // Services Samples 
    1.19 +   ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();   
    1.20    
    1.21  
    1.22     //-----------------------------------------------------------
    1.23 @@ -69,13 +73,28 @@
    1.24      $fdisplay(stderr, " => Cycle = %d", cycle);
    1.25    endrule
    1.26  
    1.27 +  // Send to Mixer
    1.28 +  // Right now this is sorta retarded in that I pass from the output fifo into a new fifo
    1.29 +  // But I have to mod a bunch of things to fix this and I am not sure I understand
    1.30 +  // things well enough to do this quickly.  So here it is as it is for now.
    1.31 +  rule mix;
    1.32 +    let coreOut <- core.sampleOutput.get();
    1.33 +    let anotherOut <- anotherCore.sampleOutput.get();
    1.34 +    mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut});
    1.35 +    mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut});
    1.36 +  endrule
    1.37 +
    1.38    rule feedOutput;
    1.39 -     let pipelineData <- core.sampleOutput.get();
    1.40 +  //     let pipelineData <- core.sampleOutput.get();
    1.41 +     let pipeOut <- mixer.mainOut.get();
    1.42 +     
    1.43       AudioProcessorControl endOfFileTag = EndOfFile;
    1.44       AudioProcessorControl sampleTag = Data;
    1.45  
    1.46 -     $display("PIPE writes sample\n");
    1.47 -     case (pipelineData) matches
    1.48 +     sampleCount <= sampleCount+1;
    1.49 +     
    1.50 +     $display("PIPE writes sample %x\n", sampleCount);
    1.51 +     case (pipeOut) matches
    1.52  	tagged EndOfFile:
    1.53  	   begin
    1.54  	      client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
    1.55 @@ -84,11 +103,11 @@
    1.56         tagged Sample .sample:
    1.57  	  client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
    1.58       endcase
    1.59 -   endrule
    1.60 +  endrule
    1.61  
    1.62     // Programming ghetto style!
    1.63     // right now I am repeating this rule for my second core.
    1.64 -    (* conservative_implicit_conditions *)
    1.65 +/*    (* conservative_implicit_conditions *)
    1.66      rule feedAnotherOutput;
    1.67       let pipelineData <- anotherCore.sampleOutput.get();
    1.68       AudioProcessorControl endOfFileTag = EndOfFile;
    1.69 @@ -105,7 +124,7 @@
    1.70  	   client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
    1.71       endcase
    1.72     endrule
    1.73 -
    1.74 +*/
    1.75  
    1.76     // Can generally just stick with the EOF but since I have two Cores no mixer...
    1.77    /*(* conservative_implicit_conditions *)