OpenCores
URL https://opencores.org/ocsvn/sqmusic/sqmusic/trunk

Subversion Repositories sqmusic

[/] [sqmusic/] [trunk/] [cpp/] [sintable.cc] - Diff between revs 18 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 18 Rev 19
Line 88... Line 88...
    cout << sin_tab[i] << "\n";
    cout << sin_tab[i] << "\n";
  }
  }
}
}
 
 
void dump_composite() {
void dump_composite() {
        // cout.setf( ios::hex, ios::basefield );
 
  for( int i=0; i<SIN_LEN; i++ ) {
  for( int i=0; i<SIN_LEN; i++ ) {
    cout << sin_tab[i] << "," << tl_tab[ sin_tab[i] ] << "\n";
    int v = sin_tab[i];
 
    int m = (v>>1)&0xFF;
 
    int lin = tl_tab[m];
 
    int exp = v>>9;
 
    int adj0 = lin>>exp;
 
    int adj1 = (v&1) ? -1*adj0 : adj0;
 
    cout << v << "," << lin << "," << exp << "," << adj0 << "," << adj1 << "\n";
  }
  }
}
}
 
 
unsigned conv( double x ) {
unsigned conv( double x ) {
  double xmax = 0xFFFFF; // 20 bits, all ones
  double xmax = 0xFFFFF; // 20 bits, all ones
Line 107... Line 112...
    "set output to hexadecimal mode" );
    "set output to hexadecimal mode" );
  argument_t arg_sin( legal_args, "sin", argument_t::flag,
  argument_t arg_sin( legal_args, "sin", argument_t::flag,
    "dump sine wave" );
    "dump sine wave" );
  argument_t arg_pow( legal_args, "pow", argument_t::flag,
  argument_t arg_pow( legal_args, "pow", argument_t::flag,
    "dump power table" );
    "dump power table" );
 
  argument_t arg_comp( legal_args, "composite", argument_t::flag,
 
    "dump pow[ sine ] composite function" );
  Args args_parser( argc, argv, legal_args );
  Args args_parser( argc, argv, legal_args );
  if( args_parser.help_request() ) { return 0; }
  if( args_parser.help_request() ) { return 0; }
  if( argc==1 ) { args_parser.show_help(); return 0; }
  if( argc==1 ) { args_parser.show_help(); return 0; }
  init_tables();
  init_tables();
        //dump_composite();
 
        if( arg_hex.is_set() ) cout.setf( ios::hex, ios::basefield );
        if( arg_hex.is_set() ) cout.setf( ios::hex, ios::basefield );
        if( arg_pow.is_set() ) dump_tl_tab();
        if( arg_pow.is_set() ) dump_tl_tab();
        if( arg_sin.is_set() ) dump_sin_tab();
        if( arg_sin.is_set() ) dump_sin_tab();
 
        if( arg_comp.is_set() ) dump_composite();
        return 0;
        return 0;
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.