changeset 50:2b18894f75e2 pygar svn.51

[svn r51] fixed processor- it works
author punk
date Wed, 05 May 2010 15:19:32 -0400
parents 61f6267cb3db
children 9fe5ed4af92d
files modules/bluespec/Pygar/core/#Processor.bsv# modules/bluespec/Pygar/core/AudioCoreSystem.cpp modules/bluespec/Pygar/core/Processor.bsv modules/bluespec/Pygar/core/audioPipeTypes.bsv
diffstat 4 files changed, 48 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/modules/bluespec/Pygar/core/#Processor.bsv#	Wed May 05 14:40:48 2010 -0400
     1.2 +++ b/modules/bluespec/Pygar/core/#Processor.bsv#	Wed May 05 15:19:32 2010 -0400
     1.3 @@ -81,15 +81,6 @@
     1.4  	
     1.5  endinterface
     1.6  
     1.7 -//The full interface for this is as below in the common file for audioProcessorTypes.bsv
     1.8 -//interface AudioOut;
     1.9 -//  interface Get#(AudioProcessorUnit) audioSampleOutput;
    1.10 -//endinterface
    1.11 -
    1.12 -//interface AudioIn;
    1.13 -//  interface Put#(AudioProcessorUnit) audioSampleInput;
    1.14 -//endinterface	
    1.15 -
    1.16  typedef enum { PCgen, Exec, Writeback } Stage deriving(Eq,Bits);
    1.17  
    1.18  //-----------------------------------------------------------
    1.19 @@ -261,7 +252,7 @@
    1.20     FIFO#(DataResp) dataRespQ   <- mkFIFO();
    1.21  
    1.22     // Audio I/O
    1.23 -   FIFO#(AudioProcessorUnit) inAudioFifo <- mkFIFO;
    1.24 +   FIFO#(AudioProcessorUnit) inAudioFifo <- mkSizedFIFO(512);
    1.25     FIFO#(AudioProcessorUnit) outAudioFifo <- mkFIFO;
    1.26  
    1.27  
    1.28 @@ -465,7 +456,7 @@
    1.29  	end
    1.30        
    1.31        tagged JR    .it : 
    1.32 -        begin 
    1.33 +        begin
    1.34  	   newPC = rf.rd1(it.rsrc);
    1.35  	   branchTaken = True;
    1.36  	end
    1.37 @@ -488,7 +479,7 @@
    1.38        
    1.39        tagged MTC0  .it : //Recieve things from host computer
    1.40  	 begin
    1.41 -	    $display( " PROCESSOR MTC0 call\n");
    1.42 +//	    $display( " PROCESSOR MTC0 call\n");
    1.43              case ( it.cop0dst )
    1.44  	       5'd10 : cp0_statsEn <= unpack(truncate(rf.rd1(it.rsrc)));
    1.45  	       5'd21 : cp0_tohost  <= truncate(rf.rd1(it.rsrc));
    1.46 @@ -503,22 +494,30 @@
    1.47  //this is host stuff?
    1.48        tagged MFC0  .it :  //Things out
    1.49  	 begin
    1.50 -	    $display( " PROCESSOR MFC0 call\n");
    1.51              case ( it.cop0src )
    1.52  	    // not actually an ALU instruction but don't have the format otherwise
    1.53                 5'd10 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_statsEn)) });
    1.54                 5'd20 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_fromhost });
    1.55                 5'd21 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_tohost   });
    1.56  	       5'd25 : begin
    1.57 -			  $display( "**** EOF Requested\n ");
    1.58 -			  wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_audioEOF)) });  // Reading clears bit
    1.59 -			  cp0_audioEOF <= False;
    1.60 +/			  $display( "**** EOF Requested\n ");
    1.61 +			  let sample = inAudioFifo.first();
    1.62 +			  case (sample) matches
    1.63 +			     tagged EndOfFile :
    1.64 +				begin
    1.65 +				   $display("PROCESSOR sent toC EOF");
    1.66 +				   wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(True)) });  // Reading clears bit
    1.67 +				   inAudioFifo.deq;
    1.68 +			        end
    1.69 +			     tagged Sample .data:
    1.70 +				   wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(False)) });  // Reading clears bit
    1.71 +			  endcase
    1.72  		       end
    1.73  	       5'd28 : begin
    1.74  			  $display( "***** Reqesting Sample \n");
    1.75  			  let sample = inAudioFifo.first();        // is this going to cause perf. delay?
    1.76  			  if (sample matches tagged Sample .audio) // if it is EOF another rule sets the cp0_audioEOF  
    1.77 -	      		     wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) });  // do I need pack?
    1.78 +	     		     wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) });  // do I need pack?
    1.79  			  else $display ( "Audio File EOF Reached.  Invalid sample request.");
    1.80  			  inAudioFifo.deq();
    1.81  		       end
    1.82 @@ -576,21 +575,22 @@
    1.83        num_cycles.incr();
    1.84    endrule
    1.85  
    1.86 -
    1.87 +/*
    1.88   // for now, we don't do anything.
    1.89 -//  rule connectAudioReqResp;
    1.90 -//    $display("rlm: PROCESSOR copies a datum\n");
    1.91 -//    outAudioFifo.enq(inAudioFifo.first());
    1.92 -//    inAudioFifo.deq;
    1.93 -//  endrule
    1.94 -
    1.95 +  rule connectAudioReqResp;
    1.96 +    $display("rlm: PROCESSOR copies a datum\n");
    1.97 +    outAudioFifo.enq(inAudioFifo.first());
    1.98 +    inAudioFifo.deq;
    1.99 +  endrule
   1.100 +*/
   1.101 +/*
   1.102    rule flagAudioEnd (inAudioFifo.first() matches tagged EndOfFile);
   1.103 -     $display (" Proc Says End Audio Flag Set ");
   1.104 +     $display (" PROCESSOR End Audio Flag Set ");
   1.105       cp0_audioEOF <= True;
   1.106       inAudioFifo.deq;
   1.107    endrule
   1.108 -
   1.109 -  rule sendAudioEnd (cp0_progComp);
   1.110 +*/
   1.111 +  rule sendProcEnd (cp0_progComp);
   1.112       $display (" PROCESSOR Says Program Complete ");
   1.113       outAudioFifo.enq(tagged EndOfFile);
   1.114       cp0_progComp <= False;  //only send one.  And functions to reset
     2.1 --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Wed May 05 14:40:48 2010 -0400
     2.2 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Wed May 05 15:19:32 2010 -0400
     2.3 @@ -161,7 +161,7 @@
     2.4  
     2.5    printf("generate wav done\n");
     2.6  
     2.7 -  printf("If you missed it, core %s", coreFin ? "PASSED\n" : "FAILED\n");
     2.8 +  //  printf("If you missed it, core %s", coreFin ? "PASSED\n" : "FAILED\n");
     2.9    // Dump the stats file
    2.10  
    2.11    STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats();
     3.1 --- a/modules/bluespec/Pygar/core/Processor.bsv	Wed May 05 14:40:48 2010 -0400
     3.2 +++ b/modules/bluespec/Pygar/core/Processor.bsv	Wed May 05 15:19:32 2010 -0400
     3.3 @@ -502,12 +502,21 @@
     3.4                 5'd20 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_fromhost });
     3.5                 5'd21 : wbQ.enq(tagged WB_ALU {dest:it.rdst, data:cp0_tohost   });
     3.6  	       5'd25 : begin
     3.7 -//			  $display( "**** EOF Requested\n ");
     3.8 -			  wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(cp0_audioEOF)) });  // Reading clears bit
     3.9 -			  cp0_audioEOF <= False;
    3.10 +			  $display( "**** EOF Requested\n ");
    3.11 +			  let sample = inAudioFifo.first();
    3.12 +			  case (sample) matches
    3.13 +			     tagged EndOfFile :
    3.14 +				begin
    3.15 +				   $display("PROCESSOR sent toC EOF");
    3.16 +				   wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(True)) });  // Reading clears bit
    3.17 +				   inAudioFifo.deq;
    3.18 +			        end
    3.19 +			     tagged Sample .data:
    3.20 +				   wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(False)) });  // Reading clears bit
    3.21 +			  endcase
    3.22  		       end
    3.23  	       5'd28 : begin
    3.24 -//			  $display( "***** Reqesting Sample \n");
    3.25 +			  $display( "***** Reqesting Sample \n");
    3.26  			  let sample = inAudioFifo.first();        // is this going to cause perf. delay?
    3.27  			  if (sample matches tagged Sample .audio) // if it is EOF another rule sets the cp0_audioEOF  
    3.28  	     		     wbQ.enq(tagged WB_ALU {dest:it.rdst, data:zext(pack(audio)) });  // do I need pack?
    3.29 @@ -577,14 +586,14 @@
    3.30      inAudioFifo.deq;
    3.31    endrule
    3.32  */
    3.33 -
    3.34 +/*
    3.35    rule flagAudioEnd (inAudioFifo.first() matches tagged EndOfFile);
    3.36       $display (" PROCESSOR End Audio Flag Set ");
    3.37       cp0_audioEOF <= True;
    3.38       inAudioFifo.deq;
    3.39    endrule
    3.40 -
    3.41 -  rule sendAudioEnd (cp0_progComp);
    3.42 +*/
    3.43 +  rule sendProcEnd (cp0_progComp);
    3.44       $display (" PROCESSOR Says Program Complete ");
    3.45       outAudioFifo.enq(tagged EndOfFile);
    3.46       cp0_progComp <= False;  //only send one.  And functions to reset
     4.1 --- a/modules/bluespec/Pygar/core/audioPipeTypes.bsv	Wed May 05 14:40:48 2010 -0400
     4.2 +++ b/modules/bluespec/Pygar/core/audioPipeTypes.bsv	Wed May 05 15:19:32 2010 -0400
     4.3 @@ -46,5 +46,7 @@
     4.4   void EndOfFile;
     4.5  } AudioProcessorUnit deriving (Bits,Eq);
     4.6  
     4.7 -
     4.8 -
     4.9 +interface AudioPlugIn;
    4.10 +  interface Put#(AudioProcessorUnit) sampleInput;
    4.11 +  interface Get#(AudioProcessorUnit) sampleOutput;
    4.12 +endinterface