# HG changeset patch # User punk # Date 1273422275 14400 # Node ID 9b4f237e77e1c48770162c0e20a7bbe9662463fe # Parent 2991344775f8aeed66121067cdc9e78b895899ff [svn r55] input a bit more parameterized diff -r 2991344775f8 -r 9b4f237e77e1 modules/bluespec/Pygar/core/PathTypes.bsv --- a/modules/bluespec/Pygar/core/PathTypes.bsv Sun May 09 10:58:40 2010 -0400 +++ b/modules/bluespec/Pygar/core/PathTypes.bsv Sun May 09 12:24:35 2010 -0400 @@ -11,7 +11,7 @@ // The path is hardwired and so should never be stored in a register. Therefore int type rather than Bit type typedef Bit#(32) MemAddr; -typedef Int#(TLog#(`MAX_PATH_IDS)) PathId; +typedef Int#(TLog#(`MAX_PATH_IDS)) PathId; //typedef Int#(16) Sample; typedef Int#(TLog#(`MAX_VOICES)) VoiceId; typedef Int#(8) Volume; // This is arbitrarily set to 8 bits or max val 256 diff -r 2991344775f8 -r 9b4f237e77e1 modules/bluespec/Pygar/core/audioCorePipeline.bsv --- a/modules/bluespec/Pygar/core/audioCorePipeline.bsv Sun May 09 10:58:40 2010 -0400 +++ b/modules/bluespec/Pygar/core/audioCorePipeline.bsv Sun May 09 12:24:35 2010 -0400 @@ -46,17 +46,19 @@ `include "asim/rrr/remote_client_stub_AUDIOCORERRR.bsh" `include "asim/rrr/remote_server_stub_AUDIOCORERRR.bsh" +`define MAX_VOICES 2 + module [CONNECTED_MODULE] mkConnectedApplication (); - Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); - Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); - Vector#(2, Volume) channelVols = replicate(127); - Mixer mixer <- mkMixer(2, channelVols); //should be max voices but 2 for now + + // Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); + // Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); + Vector#(`MAX_VOICES, Volume) channelVols = replicate(127); + Mixer mixer <- mkMixer(`MAX_VOICES, channelVols); //should be max voices but 2 for now Reg#(int) cycle <- mkReg(0); Reg#(int) sampleCount <-mkReg(0); Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False)); -// FIFO#(AudioProcessorUnit) coreOut <- mkFIFO(); // Services Samples ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); @@ -66,6 +68,15 @@ ServerStub_AUDIOCORERRR server_stub <- mkServerStub_AUDIOCORERRR(); + // Create Cores + Vector#(`MAX_VOICES, Core) cores; + for (Integer n = 0; n < `MAX_VOICES; n = n + 1) + begin + case (n) + 0 : cores[n] <- mkCore(`VDEV_SCRATCH_MEMORYA); + 1 : cores[n] <- mkCore(`VDEV_SCRATCH_MEMORYB); + endcase + end // this is for the tracing rule printCycles; @@ -77,15 +88,19 @@ // Right now this is sorta retarded in that I pass from the output fifo into a new fifo // But I have to mod a bunch of things to fix this and I am not sure I understand // things well enough to do this quickly. So here it is as it is for now. - rule mix; - let coreOut <- core.sampleOutput.get(); - let anotherOut <- anotherCore.sampleOutput.get(); - mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut}); - mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut}); + rule mix; + for (Integer i = 0; i < `MAX_VOICES; i = i + 1) + begin + let coreOut <- cores[i].sampleOutput.get(); + mixer.toMixer(AudioStream {voice : fromInteger(i), data: tagged Valid coreOut}); + end + +// let coreOut <- core.sampleOutput.get(); +// mixer.toMixer(AudioStream {voice : 0, data : tagged Valid coreOut}); +// mixer.toMixer(AudioStream {voice : 1, data : tagged Valid anotherOut}); endrule rule feedOutput; - // let pipelineData <- core.sampleOutput.get(); let pipeOut <- mixer.mainOut.get(); AudioProcessorControl endOfFileTag = EndOfFile; @@ -93,7 +108,7 @@ sampleCount <= sampleCount+1; - $display("PIPE writes sample %x\n", sampleCount); + $display("PIPE writes sample %d", sampleCount); case (pipeOut) matches tagged EndOfFile: begin @@ -105,27 +120,6 @@ endcase endrule - // Programming ghetto style! - // right now I am repeating this rule for my second core. -/* (* conservative_implicit_conditions *) - rule feedAnotherOutput; - let pipelineData <- anotherCore.sampleOutput.get(); - AudioProcessorControl endOfFileTag = EndOfFile; - AudioProcessorControl sampleTag = Data; - - $display("PIPE writes another sample\n"); - case (pipelineData) matches - tagged EndOfFile: - begin - client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); - ac_fini[1] <= True; - end - tagged Sample .sample: - client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); - endcase - endrule -*/ - // Can generally just stick with the EOF but since I have two Cores no mixer... /*(* conservative_implicit_conditions *) rule sendTerminate; @@ -164,10 +158,7 @@ inSample = tagged Sample unpack(truncate(command.sample)); end - case (channel) - 0 : core.sampleInput.put(inSample); - 1 : anotherCore.sampleInput.put(inSample); - endcase + cores[channel].sampleInput.put(inSample); endrule endmodule