# HG changeset patch # User punk # Date 1273087172 14400 # Node ID 2b18894f75e22c4a2a97c6051aa485b81fc8cb0b # Parent 61f6267cb3dbdfaac10459756584c8240436a7b3 [svn r51] fixed processor- it works diff -r 61f6267cb3db -r 2b18894f75e2 modules/bluespec/Pygar/core/#Processor.bsv# --- a/modules/bluespec/Pygar/core/#Processor.bsv# Wed May 05 14:40:48 2010 -0400 +++ b/modules/bluespec/Pygar/core/#Processor.bsv# Wed May 05 15:19:32 2010 -0400 @@ -81,15 +81,6 @@ endinterface -//The full interface for this is as below in the common file for audioProcessorTypes.bsv -//interface AudioOut; -// interface Get#(AudioProcessorUnit) audioSampleOutput; -//endinterface - -//interface AudioIn; -// interface Put#(AudioProcessorUnit) audioSampleInput; -//endinterface - typedef enum { PCgen, Exec, Writeback } Stage deriving(Eq,Bits); //----------------------------------------------------------- @@ -261,7 +252,7 @@ FIFO#(DataResp) dataRespQ <- mkFIFO(); // Audio I/O - FIFO#(AudioProcessorUnit) inAudioFifo <- mkFIFO; + FIFO#(AudioProcessorUnit) inAudioFifo <- mkSizedFIFO(512); FIFO#(AudioProcessorUnit) outAudioFifo <- mkFIFO; @@ -465,7 +456,7 @@ end tagged JR .it : - begin + begin newPC = rf.rd1(it.rsrc); branchTaken = True; end @@ -488,7 +479,7 @@ tagged MTC0 .it : //Recieve things from host computer begin - $display( " PROCESSOR MTC0 call\n"); +// $display( " PROCESSOR MTC0 call\n"); case ( it.cop0dst ) 5'd10 : cp0_statsEn <= unpack(truncate(rf.rd1(it.rsrc))); 5'd21 : cp0_tohost <= truncate(rf.rd1(it.rsrc)); @@ -503,22 +494,30 @@ //this is host stuff? tagged MFC0 .it : //Things out begin - $display( " PROCESSOR MFC0 call\n"); case ( it.cop0src ) // not actually an ALU instruction but don't have the format otherwise 5'd10 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_statsEn)) }); 5'd20 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_fromhost }); 5'd21 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_tohost }); 5'd25 : begin - $display( "**** EOF Requested\n "); - wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_audioEOF)) }); // Reading clears bit - cp0_audioEOF <= False; +/ $display( "**** EOF Requested\n "); + let sample = inAudioFifo.first(); + case (sample) matches + tagged EndOfFile : + begin + $display("PROCESSOR sent toC EOF"); + wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(True)) }); // Reading clears bit + inAudioFifo.deq; + end + tagged Sample .data: + wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(False)) }); // Reading clears bit + endcase end 5'd28 : begin $display( "***** Reqesting Sample \n"); let sample = inAudioFifo.first(); // is this going to cause perf. delay? if (sample matches tagged Sample .audio) // if it is EOF another rule sets the cp0_audioEOF - wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) }); // do I need pack? + wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) }); // do I need pack? else $display ( "Audio File EOF Reached. Invalid sample request."); inAudioFifo.deq(); end @@ -576,21 +575,22 @@ num_cycles.incr(); endrule - +/* // for now, we don't do anything. -// rule connectAudioReqResp; -// $display("rlm: PROCESSOR copies a datum\n"); -// outAudioFifo.enq(inAudioFifo.first()); -// inAudioFifo.deq; -// endrule - + rule connectAudioReqResp; + $display("rlm: PROCESSOR copies a datum\n"); + outAudioFifo.enq(inAudioFifo.first()); + inAudioFifo.deq; + endrule +*/ +/* rule flagAudioEnd (inAudioFifo.first() matches tagged EndOfFile); - $display (" Proc Says End Audio Flag Set "); + $display (" PROCESSOR End Audio Flag Set "); cp0_audioEOF <= True; inAudioFifo.deq; endrule - - rule sendAudioEnd (cp0_progComp); +*/ + rule sendProcEnd (cp0_progComp); $display (" PROCESSOR Says Program Complete "); outAudioFifo.enq(tagged EndOfFile); cp0_progComp <= False; //only send one. And functions to reset diff -r 61f6267cb3db -r 2b18894f75e2 modules/bluespec/Pygar/core/AudioCoreSystem.cpp --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 05 14:40:48 2010 -0400 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp Wed May 05 15:19:32 2010 -0400 @@ -161,7 +161,7 @@ printf("generate wav done\n"); - printf("If you missed it, core %s", coreFin ? "PASSED\n" : "FAILED\n"); + // printf("If you missed it, core %s", coreFin ? "PASSED\n" : "FAILED\n"); // Dump the stats file STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats(); diff -r 61f6267cb3db -r 2b18894f75e2 modules/bluespec/Pygar/core/Processor.bsv --- a/modules/bluespec/Pygar/core/Processor.bsv Wed May 05 14:40:48 2010 -0400 +++ b/modules/bluespec/Pygar/core/Processor.bsv Wed May 05 15:19:32 2010 -0400 @@ -502,12 +502,21 @@ 5'd20 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_fromhost }); 5'd21 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_tohost }); 5'd25 : begin -// $display( "**** EOF Requested\n "); - wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_audioEOF)) }); // Reading clears bit - cp0_audioEOF <= False; + $display( "**** EOF Requested\n "); + let sample = inAudioFifo.first(); + case (sample) matches + tagged EndOfFile : + begin + $display("PROCESSOR sent toC EOF"); + wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(True)) }); // Reading clears bit + inAudioFifo.deq; + end + tagged Sample .data: + wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(False)) }); // Reading clears bit + endcase end 5'd28 : begin -// $display( "***** Reqesting Sample \n"); + $display( "***** Reqesting Sample \n"); let sample = inAudioFifo.first(); // is this going to cause perf. delay? if (sample matches tagged Sample .audio) // if it is EOF another rule sets the cp0_audioEOF wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) }); // do I need pack? @@ -577,14 +586,14 @@ inAudioFifo.deq; endrule */ - +/* rule flagAudioEnd (inAudioFifo.first() matches tagged EndOfFile); $display (" PROCESSOR End Audio Flag Set "); cp0_audioEOF <= True; inAudioFifo.deq; endrule - - rule sendAudioEnd (cp0_progComp); +*/ + rule sendProcEnd (cp0_progComp); $display (" PROCESSOR Says Program Complete "); outAudioFifo.enq(tagged EndOfFile); cp0_progComp <= False; //only send one. And functions to reset diff -r 61f6267cb3db -r 2b18894f75e2 modules/bluespec/Pygar/core/audioPipeTypes.bsv --- a/modules/bluespec/Pygar/core/audioPipeTypes.bsv Wed May 05 14:40:48 2010 -0400 +++ b/modules/bluespec/Pygar/core/audioPipeTypes.bsv Wed May 05 15:19:32 2010 -0400 @@ -46,5 +46,7 @@ void EndOfFile; } AudioProcessorUnit deriving (Bits,Eq); - - +interface AudioPlugIn; + interface Put#(AudioProcessorUnit) sampleInput; + interface Get#(AudioProcessorUnit) sampleOutput; +endinterface