diff modules/bluespec/Pygar/core/AudioCoreSystem.cpp @ 31:f41eef1bebfc pygar svn.32

[svn r32] Attempting to run soft core and audio
author punk
date Sat, 01 May 2010 11:50:20 -0400
parents 220c14f5963c
children 0c775e733b81
line wrap: on
line diff
     1.1 --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Fri Apr 30 09:14:40 2010 -0400
     1.2 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Sat May 01 11:50:20 2010 -0400
     1.3 @@ -64,7 +64,15 @@
     1.4  {
     1.5    FILE *inputFile;
     1.6    UINT16 sample;
     1.7 -  
     1.8 +
     1.9 +  //init processor 
    1.10 +  int sleepCount = 0;
    1.11 +  int result = 0;
    1.12 +
    1.13 +  bool coreFin = false; 
    1.14 +
    1.15 +  fflush(stdout); 
    1.16 +
    1.17    // Convert input wav to pcm
    1.18    generate_pcm("input.wav","input.pcm");
    1.19  
    1.20 @@ -72,18 +80,36 @@
    1.21    inputFile = fopen("input.pcm","r");
    1.22    assert(inputFile);
    1.23  
    1.24 -
    1.25    int count = 0;
    1.26  
    1.27    printf("main:PROCESSOR about to enter loop %d\n", count);  
    1.28  
    1.29    while(fread(&sample, 2, 1, inputFile)) {
    1.30 +    if (!coreFin && (result = clientStub->ReadCPUToHost(0)) != 1) 
    1.31 +    {
    1.32 +      sleepCount++;
    1.33 +      if(sleepCount == 200) {
    1.34 +	printf("Failed to get response from hardware, bailing\n\n");
    1.35 +	printf("This means that either your hardware is hanging\n");
    1.36 +	printf("or that the software hasn't given it enough time\n");
    1.37 +	printf("to complete.  If you think it needs more time, then\n");
    1.38 +	printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
    1.39 +        printf("(connected_application)\n");
    1.40 +      }
    1.41 +    }
    1.42 +    else if (!coreFin && result == 1) 
    1.43 +      {
    1.44 +	printf("\n***SOFT_CORE PASSED***\n");
    1.45 +	coreFin = true;
    1.46 +      }
    1.47 +
    1.48      if(count%1000 == 0)
    1.49        printf("main: %d\n", count);
    1.50      count++;
    1.51      sem_wait(&throttle);
    1.52  //    printf("rlm:sending data to processor (%d)\n", count);
    1.53      clientStub->SendUnprocessedStream(Data,(UINT32)sample);
    1.54 +
    1.55    } 
    1.56  
    1.57    printf("main: out of loop\n");
    1.58 @@ -104,45 +130,12 @@
    1.59  
    1.60    printf("generate wav done\n");
    1.61  
    1.62 -  fflush(stdout);
    1.63 -  exit(0);
    1.64 -}
    1.65 -
    1.66 -/*    THIS IS THE CODE HANDLING FROM THE REGULAR SOFT-CORE
    1.67 -TO BE INCORPORATED 
    1.68 -// main
    1.69 -void
    1.70 -CONNECTED_APPLICATION_CLASS::Main()
    1.71 -{
    1.72 -  int sleepCount = 0;
    1.73 -  int result = 0;
    1.74 -
    1.75 -  fflush(stdout); 
    1.76 -
    1.77 -  while ((result = clientStub->ReadCPUToHost(0)) != 1) {
    1.78 -    sleep(1);
    1.79 -    //printf("System controller sleeps with result: %d\n", result);
    1.80 -    sleepCount++;
    1.81 -    if(sleepCount == 100) {
    1.82 -      printf("Failed to get response from hardware, bailing\n\n");
    1.83 -      printf("This means that either your hardware is hanging\n");
    1.84 -      printf("or that the software hasn't given it enough time\n");
    1.85 -      printf("to complete.  If you think it needs more time, then\n");
    1.86 -      printf("edit CONNECTED_APPLICATION_CLASS::Main() in ProcessorSystem.cpp\n");
    1.87 -      printf("(connected_application)\n");
    1.88 -      exit(0);
    1.89 -    }
    1.90 -  }
    1.91 - 
    1.92 -  if(result == 1) {
    1.93 -    printf("\n***PASSED***\n");
    1.94 -  }
    1.95 -
    1.96 +  printf("If you missed it, core ", coreFin ? "PASSED\n" : "FAILED\n");
    1.97    // Dump the stats file
    1.98  
    1.99    STATS_DEVICE_SERVER_CLASS::GetInstance()->DumpStats();
   1.100    STATS_DEVICE_SERVER_CLASS::GetInstance()->EmitFile();
   1.101  
   1.102 -  fflush(stdout); 
   1.103 +  fflush(stdout);
   1.104    exit(0);
   1.105 -}*/
   1.106 +}