changeset 34:1a21b4cd85ee pygar svn.35

[svn r35] fixed the perl scripts and c files to handle multiple voices
author rlm
date Tue, 04 May 2010 12:08:19 -0400
parents 2c8166d205d5
children 14f7a7ace3f5
files config/bm/Pygar/processor_test/audio_core_benchmark.cfx modules/bluespec/Pygar/core/AudioCoreRRR.rrr modules/bluespec/Pygar/core/AudioCoreSystem.cpp scripts/setup-mit-6.375-bmark-audio-core
diffstat 4 files changed, 55 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/config/bm/Pygar/processor_test/audio_core_benchmark.cfx	Tue May 04 10:13:53 2010 -0400
     1.2 +++ b/config/bm/Pygar/processor_test/audio_core_benchmark.cfx	Tue May 04 12:08:19 2010 -0400
     1.3 @@ -25,12 +25,12 @@
     1.4  	      "smipsv2_bgtz",
     1.5  	      "smipsv2_blez");
     1.6  
     1.7 -my @bmarks = ("null.wav", "reuben_james_1sec.wav");
     1.8 +my @bmarks = ("null.wav", "reuben_james_1sec.wav", "rlp.wav");
     1.9  
    1.10  foreach my $test (@tests) {
    1.11      $gcfg->add(name => $test,
    1.12                 tree => [ "tests" ],
    1.13 -               setup => "scripts/setup-mit-6.375-bmark-audio-core --group instruction-tests --isa smips $test --compare=1 --data=../benchmarks/audio_processor_test/reuben_james_quarter_sec.wav --linkto=../tools/audio_processor_test/null/checker", 
    1.14 +               setup => "scripts/setup-mit-6.375-bmark-audio-core --group instruction-tests --isa smips $test --compare=1 --data=../benchmarks/audio_processor_test/rlp.wav --linkto=../tools/audio_processor_test/null/checker", 
    1.15                 feeder => "vcs",
    1.16                 feedflags => "program.0/${test}.smips.vmh",
    1.17  	       ccount => 800000,
     2.1 --- a/modules/bluespec/Pygar/core/AudioCoreRRR.rrr	Tue May 04 10:13:53 2010 -0400
     2.2 +++ b/modules/bluespec/Pygar/core/AudioCoreRRR.rrr	Tue May 04 12:08:19 2010 -0400
     2.3 @@ -3,7 +3,10 @@
     2.4      server hw (bsv, connection) <- sw (cpp, method)
     2.5      {
     2.6          method ReadCPUToHost  (out UINT32[32] regValue, in UINT32[32] dummy);
     2.7 -        method SendUnprocessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
     2.8 +        //method SendUnprocessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
     2.9 +	//rlm: here it is modified to take N
    2.10 +	method   SendUnprocessedStream (in UINT32[32] channel, in UINT32[32] ctrl, in UINT32[32] sample);
    2.11 +
    2.12      };
    2.13  
    2.14      server sw (cpp, method) <- hw (bsv, connection) 
     3.1 --- a/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Tue May 04 10:13:53 2010 -0400
     3.2 +++ b/modules/bluespec/Pygar/core/AudioCoreSystem.cpp	Tue May 04 12:08:19 2010 -0400
     3.3 @@ -62,8 +62,15 @@
     3.4  void
     3.5  CONNECTED_APPLICATION_CLASS::Main()
     3.6  {
     3.7 +  //rlm: two files
     3.8    FILE *inputFile;
     3.9 +  FILE *inputFile1;
    3.10    UINT16 sample;
    3.11 +  UINT16 sample1;
    3.12 +
    3.13 +  //rlm: not sure if normal ints are ok here; using UINT16 because I know it works
    3.14 +  UINT16 channel0 = 0;
    3.15 +  UINT16 channel1 = 1;
    3.16  
    3.17    //init processor 
    3.18    int sleepCount = 0;
    3.19 @@ -71,20 +78,35 @@
    3.20  
    3.21    bool coreFin = false; 
    3.22  
    3.23 +  
    3.24 +
    3.25    fflush(stdout); 
    3.26  
    3.27    // Convert input wav to pcm
    3.28 + 
    3.29 +
    3.30 +  //rlm: for now we are going to going to just have 2 files with "common names"
    3.31 +
    3.32    generate_pcm("input.wav","input.pcm");
    3.33 +  generate_pcm("input1.wav", "input1.pcm");
    3.34 +
    3.35 +
    3.36  
    3.37    //Send data to the machine here.
    3.38 +  //rlm: two files
    3.39    inputFile = fopen("input.pcm","r");
    3.40 +  inputFile = fopen("input1.pcm", "r");
    3.41 +  
    3.42 +  assert(inputFile1);
    3.43    assert(inputFile);
    3.44  
    3.45    int count = 0;
    3.46  
    3.47    printf("main:PROCESSOR about to enter loop %d\n", count);  
    3.48  
    3.49 -  while(fread(&sample, 2, 1, inputFile)) {
    3.50 +  //rlm: here we read both files. later refactor into a function.
    3.51 +  // also, this will terminate when the FIRST file reaches its end.
    3.52 +  while( (fread(&sample, 2, 1, inputFile)) && (fread(&sample1, 2 , 1, inputFile1))) {
    3.53      if (!coreFin && (result = clientStub->ReadCPUToHost(0)) != 1) 
    3.54      {
    3.55        sleepCount++;
    3.56 @@ -107,8 +129,10 @@
    3.57        printf("main: %d\n", count);
    3.58      count++;
    3.59      sem_wait(&throttle);
    3.60 -//    printf("rlm:sending data to processor (%d)\n", count);
    3.61 -    clientStub->SendUnprocessedStream(Data,(UINT32)sample);
    3.62 +
    3.63 +    //rlm: two files.
    3.64 +    clientStub->SendUnprocessedStream(channel0 , Data,(UINT32)sample);
    3.65 +    clientStub->SendUnprocessedStream(channel1 , Data,(UINT32)sample1);
    3.66  
    3.67    } 
    3.68  
    3.69 @@ -116,7 +140,11 @@
    3.70  
    3.71    // Need to put lock here to prevent potential race condition
    3.72    pthread_mutex_lock(&lock);
    3.73 -  clientStub->SendUnprocessedStream(EndOfFile,0);
    3.74 +
    3.75 +  //rlm: have to send end-files to both voices.  
    3.76 +  // all of these operations wil eventually be moved into functions.
    3.77 +  clientStub->SendUnprocessedStream(channel0, EndOfFile,0);
    3.78 +  clientStub->SendUnprocessedStream(channel1, EndOfFile,0);
    3.79  
    3.80    printf("main: wait for end of file\n");
    3.81  
    3.82 @@ -126,6 +154,7 @@
    3.83    printf("main: last data out\n");
    3.84  
    3.85    // Convert input wav to pcm
    3.86 +  // this part is ok because there is always only one input file.
    3.87    generate_wav("out_hw.pcm","input.wav","out_hw.wav");
    3.88  
    3.89    printf("generate wav done\n");
     4.1 --- a/scripts/setup-mit-6.375-bmark-audio-core	Tue May 04 10:13:53 2010 -0400
     4.2 +++ b/scripts/setup-mit-6.375-bmark-audio-core	Tue May 04 12:08:19 2010 -0400
     4.3 @@ -11,7 +11,7 @@
     4.4  #
     4.5  ##############################################################
     4.6  
     4.7 -use strict;
     4.8 +#use strict;
     4.9  use warnings;
    4.10  use File::Basename;
    4.11  use Getopt::Long;
    4.12 @@ -109,8 +109,22 @@
    4.13  	# Copy input data files
    4.14  	if (defined($data)) {
    4.15  	    # No trailing slash. Just link to a single object
    4.16 +	   
    4.17 +
    4.18 +	    # rlm: oh my gosh here we go with TWO files!
    4.19 +	    print "\nRLM: moving TWO files:\n";
    4.20 +	    print "OHYEAH::   $data\n\n";
    4.21 +	    $data =~ m#^.*/([^/]*)\.wav$#;
    4.22 +	    #print "OHYYYYYYEAH::: $1\n\n\n!!!";
    4.23 +	    $newFile = $1."1.wav";
    4.24  	    print "data: $data\n";
    4.25 -	    symlink("${srcdir}/${data}", "input.wav") or die("Failed to link to $data");
    4.26 +	    print "rlm: data2: $newFile\n";
    4.27 +	    print "\nrlm: move  ${srcdir}/${data} to input.wav\n\n";
    4.28 + 
    4.29 +	    symlink("${srcdir}/${data}", "../input.wav") or die("Failed to link to $data");
    4.30 +	    symlink("${srcdir}/../benchmarks/audio_processor_test/$newFile", "../input1.wav") or die("Failed to link to $newFile");
    4.31 +
    4.32 +
    4.33  	}
    4.34  # this came from processor bit and not sure what it is expecting
    4.35          # Copy input data files