# HG changeset patch
# User punk
# Date 1273015530 14400
# Node ID 0475235d151311757b99b7df92251917688beb31
# Parent  99519a031813643d8190671691cb8fea2353fb50
[svn r38] fixed audiocorepipe

diff -r 99519a031813 -r 0475235d1513 modules/bluespec/Pygar/core/AudioCoreSystem.cpp
--- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Tue May 04 18:54:54 2010 -0400
+++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Tue May 04 19:25:30 2010 -0400
@@ -64,9 +64,9 @@
 {
   //rlm: two files
   FILE *inputFile;
-  //  FILE *inputFile1;
+//  FILE *inputFile1;
   UINT16 sample;
-  //UINT16 sample1;
+//UINT16 sample1;
 
   //rlm: not sure if normal ints are ok here; using UINT16 because I know it works
   UINT16 channel0 = 0;
@@ -103,35 +103,37 @@
 
   //rlm: here we read both files. later refactor into a function.
   // also, this will terminate when the FIRST file reaches its end.
-  while( (fread(&sample, 2, 1, inputFile)) )//&& (fread(&sample1, 2 , 1, inputFile1))) 
-    {
-    if (!coreFin && (result = clientStub->ReadCPUToHost(0)) != 1) 
-    {
-      sleepCount++;
-      if(sleepCount == 200) {
-	printf("Failed to get response from hardware, bailing\n\n");
-	printf("This means that either your hardware is hanging\n");
-	printf("or that the software hasn't given it enough time\n");
-	printf("to complete.  If you think it needs more time, then\n");
-	printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
-        printf("(connected_application)\n");
+  while( fread(&sample, 2, 1, inputFile)) //&& (fread(&sample1, 2 , 1, inputFile1))) 
+  {
+    printf("hi\n");
+     if (!coreFin && (result = clientStub->ReadCPUToHost(0)) != 1) 
+     {
+       sleepCount++;
+       if(sleepCount == 200) {
+	 printf("Failed to get response from hardware, bailing\n\n");
+	 printf("This means that either your hardware is hanging\n");
+	 printf("or that the software hasn't given it enough time\n");
+	 printf("to complete.  If you think it needs more time, then\n");
+	 printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
+	 printf("(connected_application)\n");
       }
-    }
-    else if (!coreFin && result == 1) 
-      {
-	printf("\n***SOFT_CORE PASSED***\n");
-	coreFin = true;
-      }
+     }
+     else if (!coreFin && result == 1) 
+       {
+	 printf("\n***SOFT_CORE PASSED***\n");
+	 coreFin = true;
+       }
 
-    if(count%1000 == 0)
-      printf("main: %d\n", count);
-    count++;
-    sem_wait(&throttle);
-
+     if(count%1000 == 0)
+     printf("main: %d\n", count);
+     count++;
+     sem_wait(&throttle);
+    
+     printf("sending file\n");
     //rlm: two files.
-    clientStub->SendUnprocessedStream( Data,(UINT32)sample);
-    //clientStub->SendUnprocessedStream(channel0 , Data,(UINT32)sample);
-    //clientStub->SendUnprocessedStream(channel1 , Data,(UINT32)sample1);
+     clientStub->SendUnprocessedStream( Data,(UINT32)sample);
+     //clientStub->SendUnprocessedStream(channel0 , Data,(UINT32)sample);
+     //clientStub->SendUnprocessedStream(channel1 , Data,(UINT32)sample1);
 
   } 
 
diff -r 99519a031813 -r 0475235d1513 modules/bluespec/Pygar/core/Processor.bsv
--- a/modules/bluespec/Pygar/core/Processor.bsv	Tue May 04 18:54:54 2010 -0400
+++ b/modules/bluespec/Pygar/core/Processor.bsv	Tue May 04 19:25:30 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);
 
 //-----------------------------------------------------------
@@ -585,7 +576,7 @@
 //  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
diff -r 99519a031813 -r 0475235d1513 modules/bluespec/Pygar/core/audioCorePipeline.bsv
--- a/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Tue May 04 18:54:54 2010 -0400
+++ b/modules/bluespec/Pygar/core/audioCorePipeline.bsv	Tue May 04 19:25:30 2010 -0400
@@ -107,6 +107,16 @@
 
    //*****  SERVER Side  *****
 
+   (* conservative_implicit_conditions *)
+  rule handleCPUToHost;
+   let req <- server_stub.acceptRequest_ReadCPUToHost();
+    case (req)
+     0: server_stub.sendResponse_ReadCPUToHost(cp0_tohost);
+     1: server_stub.sendResponse_ReadCPUToHost(pc);
+     2: server_stub.sendResponse_ReadCPUToHost(zeroExtend(pack(stage)));
+    endcase
+  endrule
+   
    rule feedInput;
      let command <- server_stub.acceptRequest_SendUnprocessedStream();
      AudioProcessorControl ctrl = unpack(truncate(command.ctrl));