changeset 54:9b4f237e77e1 pygar svn.55

[svn r55] input a bit more parameterized
author punk
date Sun, 09 May 2010 12:24:35 -0400
parents 2991344775f8
children d0db18cdeacc
files modules/bluespec/Pygar/core/PathTypes.bsv modules/bluespec/Pygar/core/audioCorePipeline.bsv
diffstat 2 files changed, 29 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/modules/bluespec/Pygar/core/PathTypes.bsv	Sun May 09 10:58:40 2010 -0400
     1.2 +++ b/modules/bluespec/Pygar/core/PathTypes.bsv	Sun May 09 12:24:35 2010 -0400
     1.3 @@ -11,7 +11,7 @@
     1.4  // The path is hardwired and so should never be stored in a register.  Therefore int type rather than Bit type
     1.5  
     1.6  typedef Bit#(32) MemAddr;
     1.7 -typedef Int#(TLog#(`MAX_PATH_IDS))  PathId;
     1.8 +typedef Int#(TLog#(`MAX_PATH_IDS)) PathId;
     1.9  //typedef Int#(16) Sample;
    1.10  typedef Int#(TLog#(`MAX_VOICES)) VoiceId;
    1.11  typedef Int#(8) Volume; // This is arbitrarily set to 8 bits or max val 256
     2.1 --- a/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Sun May 09 10:58:40 2010 -0400
     2.2 +++ b/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Sun May 09 12:24:35 2010 -0400
     2.3 @@ -46,17 +46,19 @@
     2.4  `include "asim/rrr/remote_client_stub_AUDIOCORERRR.bsh"
     2.5  `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh"
     2.6  
     2.7 +`define MAX_VOICES       2
     2.8 +
     2.9  module [CONNECTED_MODULE] mkConnectedApplication ();
    2.10 -   Core core <- mkCore(`VDEV_SCRATCH_MEMORYA);
    2.11 -   Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB);
    2.12 -   Vector#(2, Volume) channelVols = replicate(127);
    2.13 -   Mixer mixer <- mkMixer(2, channelVols); //should be max voices but 2 for now
    2.14 +
    2.15 + //  Core core <- mkCore(`VDEV_SCRATCH_MEMORYA);
    2.16 + //  Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB);
    2.17 +   Vector#(`MAX_VOICES, Volume) channelVols = replicate(127);
    2.18 +   Mixer mixer <- mkMixer(`MAX_VOICES, channelVols); //should be max voices but 2 for now
    2.19     
    2.20     Reg#(int) cycle <- mkReg(0);
    2.21     Reg#(int) sampleCount <-mkReg(0);
    2.22     Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False));
    2.23  
    2.24 -//   FIFO#(AudioProcessorUnit) coreOut <- mkFIFO();
    2.25     // Services Samples 
    2.26     ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR();   
    2.27    
    2.28 @@ -66,6 +68,15 @@
    2.29     
    2.30     ServerStub_AUDIOCORERRR server_stub <- mkServerStub_AUDIOCORERRR();   
    2.31  
    2.32 +   // Create Cores
    2.33 +   Vector#(`MAX_VOICES, Core) cores;
    2.34 +   for (Integer n = 0; n < `MAX_VOICES; n = n + 1)
    2.35 +     begin
    2.36 +	 case (n)
    2.37 +	    0 : cores[n] <- mkCore(`VDEV_SCRATCH_MEMORYA);
    2.38 +	    1 : cores[n] <- mkCore(`VDEV_SCRATCH_MEMORYB);
    2.39 +	 endcase
    2.40 +     end
    2.41     
    2.42    // this is for the tracing
    2.43    rule printCycles;
    2.44 @@ -77,15 +88,19 @@
    2.45    // Right now this is sorta retarded in that I pass from the output fifo into a new fifo
    2.46    // But I have to mod a bunch of things to fix this and I am not sure I understand
    2.47    // things well enough to do this quickly.  So here it is as it is for now.
    2.48 -  rule mix;
    2.49 -    let coreOut <- core.sampleOutput.get();
    2.50 -    let anotherOut <- anotherCore.sampleOutput.get();
    2.51 -    mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut});
    2.52 -    mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut});
    2.53 +   rule mix;
    2.54 +      for (Integer i = 0; i < `MAX_VOICES; i = i + 1)
    2.55 +        begin
    2.56 +	   let coreOut <- cores[i].sampleOutput.get();
    2.57 +	   mixer.toMixer(AudioStream {voice : fromInteger(i), data: tagged Valid coreOut});
    2.58 +	end
    2.59 +      
    2.60 +//     let coreOut <- core.sampleOutput.get();
    2.61 +//    mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut});
    2.62 +//    mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut});
    2.63    endrule
    2.64  
    2.65    rule feedOutput;
    2.66 -  //     let pipelineData <- core.sampleOutput.get();
    2.67       let pipeOut <- mixer.mainOut.get();
    2.68       
    2.69       AudioProcessorControl endOfFileTag = EndOfFile;
    2.70 @@ -93,7 +108,7 @@
    2.71  
    2.72       sampleCount <= sampleCount+1;
    2.73       
    2.74 -     $display("PIPE writes sample %x\n", sampleCount);
    2.75 +     $display("PIPE writes sample %d", sampleCount);
    2.76       case (pipeOut) matches
    2.77  	tagged EndOfFile:
    2.78  	   begin
    2.79 @@ -105,27 +120,6 @@
    2.80       endcase
    2.81    endrule
    2.82  
    2.83 -   // Programming ghetto style!
    2.84 -   // right now I am repeating this rule for my second core.
    2.85 -/*    (* conservative_implicit_conditions *)
    2.86 -    rule feedAnotherOutput;
    2.87 -     let pipelineData <- anotherCore.sampleOutput.get();
    2.88 -     AudioProcessorControl endOfFileTag = EndOfFile;
    2.89 -     AudioProcessorControl sampleTag = Data;
    2.90 -
    2.91 -     $display("PIPE writes another sample\n");
    2.92 -     case (pipelineData) matches
    2.93 -	tagged EndOfFile:
    2.94 -	   begin
    2.95 -	      client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
    2.96 -	      ac_fini[1] <= True;
    2.97 -	   end
    2.98 -	tagged Sample .sample:
    2.99 -	   client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample)));
   2.100 -     endcase
   2.101 -   endrule
   2.102 -*/
   2.103 -
   2.104     // Can generally just stick with the EOF but since I have two Cores no mixer...
   2.105    /*(* conservative_implicit_conditions *)
   2.106     rule sendTerminate;
   2.107 @@ -164,10 +158,7 @@
   2.108             inSample = tagged Sample unpack(truncate(command.sample));
   2.109  	end
   2.110  
   2.111 -      case (channel)
   2.112 -	 0 : core.sampleInput.put(inSample);
   2.113 -	 1 : anotherCore.sampleInput.put(inSample);
   2.114 -      endcase
   2.115 +      cores[channel].sampleInput.put(inSample);
   2.116        
   2.117     endrule     
   2.118  endmodule