Mercurial > pygar
diff modules/bluespec/Pygar/core/audioCorePipeline.bsv @ 52:49049f97312c pygar svn.53
[svn r53] sends to two cores (but has issues)
author | punk |
---|---|
date | Thu, 06 May 2010 08:57:53 -0400 |
parents | 9fe5ed4af92d |
children | 2991344775f8 |
line wrap: on
line diff
1.1 --- a/modules/bluespec/Pygar/core/audioCorePipeline.bsv Wed May 05 17:01:04 2010 -0400 1.2 +++ b/modules/bluespec/Pygar/core/audioCorePipeline.bsv Thu May 06 08:57:53 2010 -0400 1.3 @@ -27,6 +27,7 @@ 1.4 import ClientServer::*; 1.5 import FIFO::*; 1.6 import SpecialFIFOs::*; 1.7 +import Vector::*; 1.8 1.9 //AWB includes 1.10 `include "asim/provides/low_level_platform_interface.bsh" 1.11 @@ -48,18 +49,9 @@ 1.12 module [CONNECTED_MODULE] mkConnectedApplication (); 1.13 Core core <- mkCore(`VDEV_SCRATCH_MEMORYA); 1.14 Core anotherCore <- mkCore(`VDEV_SCRATCH_MEMORYB); 1.15 - // RLM:: 1.16 - // the simple existance of this additional core causes the dreaded 1.17 - // beast to emerge --- the ASSERTION FAILURE: sw/model/stats-device.cpp:317 Cycle:0 1.18 - //stats device: Duplicate entry DATA_CACHE_NUM_WRITEBACKS, postion 0 1.19 - //Core core1 <- mkCore; 1.20 + 1.21 Reg#(int) cycle <- mkReg(0); 1.22 - 1.23 -// Reg#(Bit#(32)) ac_fini <- mkReg(0); 1.24 - 1.25 - //External memory 1.26 - // I'm not comfortable assuming that the memory subsystem is in order 1.27 - // So I'll insert a completion buffer here. 1.28 + Vector#(2, Reg#(Bool)) ac_fini <- replicateM(mkReg(False)); 1.29 1.30 // Services Samples 1.31 ClientStub_AUDIOCORERRR client_stub <- mkClientStub_AUDIOCORERRR(); 1.32 @@ -82,40 +74,81 @@ 1.33 AudioProcessorControl endOfFileTag = EndOfFile; 1.34 AudioProcessorControl sampleTag = Data; 1.35 1.36 + $display("PIPE writes sample\n"); 1.37 case (pipelineData) matches 1.38 - tagged EndOfFile: 1.39 - client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); 1.40 - tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); 1.41 + tagged EndOfFile: 1.42 + begin 1.43 + client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); 1.44 + ac_fini[0] <= True; 1.45 + end 1.46 + tagged Sample .sample: 1.47 + client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); 1.48 endcase 1.49 endrule 1.50 1.51 + // Programming ghetto style! 1.52 + // right now I am repeating this rule for my second core. 1.53 + (* conservative_implicit_conditions *) 1.54 + rule feedAnotherOutput; 1.55 + let pipelineData <- anotherCore.sampleOutput.get(); 1.56 + AudioProcessorControl endOfFileTag = EndOfFile; 1.57 + AudioProcessorControl sampleTag = Data; 1.58 + 1.59 + $display("PIPE writes another sample\n"); 1.60 + case (pipelineData) matches 1.61 + tagged EndOfFile: 1.62 + begin 1.63 + client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?); 1.64 + ac_fini[1] <= True; 1.65 + end 1.66 + tagged Sample .sample: 1.67 + client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)), zeroExtend(pack(sample))); 1.68 + endcase 1.69 + endrule 1.70 + 1.71 + 1.72 + // Can generally just stick with the EOF but since I have two Cores no mixer... 1.73 + /*(* conservative_implicit_conditions *) 1.74 + rule sendTerminate; 1.75 + Bool done = True; 1.76 + for (Integer i = 1; i < 2; i = i+1) 1.77 + done = ac_fini[i] && done; 1.78 + 1.79 + if (done) 1.80 + client_stub.makeRequest_SendTerminate(zeroExtend(pack(1))); 1.81 + 1.82 + endrule 1.83 +*/ 1.84 + 1.85 //***** SERVER Side ***** 1.86 1.87 -/* (* conservative_implicit_conditions *) 1.88 - rule handleCPUToHost; 1.89 - let req <- server_stub.acceptRequest_ReadCPUToHost(); 1.90 - case (req) 1.91 - 0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost); 1.92 - endcase 1.93 - endrule 1.94 -*/ 1.95 + (* conservative_implicit_conditions *) 1.96 rule feedInput; 1.97 let command <- server_stub.acceptRequest_SendUnprocessedStream(); 1.98 AudioProcessorControl ctrl = unpack(truncate(command.ctrl)); 1.99 1.100 - Bit#(32) test = unpack(truncate(command.channel)); 1.101 + VoiceId channel = unpack(truncate(command.channel)); 1.102 // $display("rlm: %x", test); 1.103 1.104 - 1.105 - if(ctrl == EndOfFile) 1.106 - begin 1.107 + AudioProcessorUnit inSample; 1.108 + 1.109 + if(ctrl == EndOfFile) 1.110 + begin 1.111 $display("lsp: PIPE received EOF "); 1.112 - core.sampleInput.put(tagged EndOfFile); 1.113 + inSample = tagged EndOfFile; 1.114 +// core.sampleInput.put(tagged EndOfFile); 1.115 end 1.116 else 1.117 begin 1.118 // $display("lsp: PIPE received Data "); 1.119 - core.sampleInput.put(tagged Sample unpack(truncate(command.sample))); 1.120 - end 1.121 +// core.sampleInput.put(tagged Sample unpack(truncate(command.sample))); 1.122 + inSample = tagged Sample unpack(truncate(command.sample)); 1.123 + end 1.124 + 1.125 + case (channel) 1.126 + 0 : core.sampleInput.put(inSample); 1.127 + 1 : anotherCore.sampleInput.put(inSample); 1.128 + endcase 1.129 + 1.130 endrule 1.131 endmodule