diff modules/bluespec/Pygar/core/#Processor.bsv# @ 50:2b18894f75e2 pygar svn.51

[svn r51] fixed processor- it works
author punk
date Wed, 05 May 2010 15:19:32 -0400
parents 99519a031813
children
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