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

Subversion Repositories sqmusic

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 11 to Rev 12
    Reverse comparison

Rev 11 → Rev 12

/sqmusic/trunk/memos/sintable.cc
0,0 → 1,12
#include <iostream>
#include <cmath>
 
using namespace std;
 
int main(void) {
const double pi = 3.141592654;
const double factor = pi / 1024;
for(double i=0; i<1024; i++ )
cout << sin( (2*i+1)*factor ) << "\n";
return 0;
}
/sqmusic/trunk/memos/sin.txt
0,0 → 1,1024
0.00306796
0.00920375
0.0153392
0.0214741
0.0276081
0.0337412
0.0398729
0.0460032
0.0521317
0.0582583
0.0643826
0.0705046
0.0766239
0.0827403
0.0888536
0.0949635
0.10107
0.107172
0.113271
0.119365
0.125455
0.13154
0.13762
0.143695
0.149765
0.155828
0.161886
0.167938
0.173984
0.180023
0.186055
0.19208
0.198098
0.204109
0.210112
0.216107
0.222094
0.228072
0.234042
0.240003
0.245955
0.251898
0.257831
0.263755
0.269668
0.275572
0.281465
0.287347
0.293219
0.29908
0.304929
0.310767
0.316593
0.322408
0.32821
0.334
0.339777
0.345541
0.351293
0.357031
0.362756
0.368467
0.374164
0.379847
0.385516
0.39117
0.39681
0.402435
0.408044
0.413638
0.419217
0.42478
0.430326
0.435857
0.441371
0.446869
0.45235
0.457813
0.46326
0.468689
0.4741
0.479494
0.484869
0.490226
0.495565
0.500885
0.506187
0.511469
0.516732
0.521975
0.527199
0.532403
0.537587
0.542751
0.547894
0.553017
0.558119
0.563199
0.568259
0.573297
0.578314
0.583309
0.588282
0.593232
0.598161
0.603067
0.60795
0.61281
0.617647
0.622461
0.627252
0.632019
0.636762
0.641481
0.646176
0.650847
0.655493
0.660114
0.664711
0.669283
0.673829
0.67835
0.682846
0.687315
0.691759
0.696177
0.700569
0.704934
0.709273
0.713585
0.71787
0.722128
0.726359
0.730563
0.734739
0.738887
0.743008
0.747101
0.751165
0.755201
0.759209
0.763188
0.767139
0.771061
0.774953
0.778817
0.782651
0.786455
0.79023
0.793975
0.797691
0.801376
0.805031
0.808656
0.812251
0.815814
0.819348
0.82285
0.826321
0.829761
0.83317
0.836548
0.839894
0.843208
0.846491
0.849742
0.852961
0.856147
0.859302
0.862424
0.865514
0.868571
0.871595
0.874587
0.877545
0.880471
0.883363
0.886223
0.889048
0.891841
0.894599
0.897325
0.900016
0.902673
0.905297
0.907886
0.910441
0.912962
0.915449
0.917901
0.920318
0.922701
0.925049
0.927363
0.929641
0.931884
0.934093
0.936266
0.938404
0.940506
0.942573
0.944605
0.946601
0.948561
0.950486
0.952375
0.954228
0.956045
0.957826
0.959572
0.96128
0.962953
0.96459
0.96619
0.967754
0.969281
0.970772
0.972226
0.973644
0.975025
0.97637
0.977677
0.978948
0.980182
0.981379
0.982539
0.983662
0.984749
0.985798
0.986809
0.987784
0.988722
0.989622
0.990485
0.991311
0.992099
0.99285
0.993564
0.99424
0.994879
0.995481
0.996045
0.996571
0.99706
0.997511
0.997925
0.998302
0.99864
0.998941
0.999205
0.999431
0.999619
0.999769
0.999882
0.999958
0.999995
0.999995
0.999958
0.999882
0.999769
0.999619
0.999431
0.999205
0.998941
0.99864
0.998302
0.997925
0.997511
0.99706
0.996571
0.996045
0.995481
0.994879
0.99424
0.993564
0.99285
0.992099
0.991311
0.990485
0.989622
0.988722
0.987784
0.986809
0.985798
0.984749
0.983662
0.982539
0.981379
0.980182
0.978948
0.977677
0.97637
0.975025
0.973644
0.972226
0.970772
0.969281
0.967754
0.96619
0.96459
0.962953
0.96128
0.959572
0.957826
0.956045
0.954228
0.952375
0.950486
0.948561
0.946601
0.944605
0.942573
0.940506
0.938404
0.936266
0.934093
0.931884
0.929641
0.927363
0.925049
0.922701
0.920318
0.917901
0.915449
0.912962
0.910441
0.907886
0.905297
0.902673
0.900016
0.897325
0.894599
0.891841
0.889048
0.886223
0.883363
0.880471
0.877545
0.874587
0.871595
0.868571
0.865514
0.862424
0.859302
0.856147
0.852961
0.849742
0.846491
0.843208
0.839894
0.836548
0.83317
0.829761
0.826321
0.82285
0.819348
0.815814
0.812251
0.808656
0.805031
0.801376
0.797691
0.793975
0.79023
0.786455
0.782651
0.778817
0.774953
0.771061
0.767139
0.763188
0.759209
0.755201
0.751165
0.747101
0.743008
0.738887
0.734739
0.730563
0.726359
0.722128
0.71787
0.713585
0.709273
0.704934
0.700569
0.696177
0.691759
0.687315
0.682846
0.67835
0.673829
0.669283
0.664711
0.660114
0.655493
0.650847
0.646176
0.641481
0.636762
0.632019
0.627252
0.622461
0.617647
0.61281
0.60795
0.603067
0.598161
0.593232
0.588282
0.583309
0.578314
0.573297
0.568259
0.563199
0.558119
0.553017
0.547894
0.542751
0.537587
0.532403
0.527199
0.521975
0.516732
0.511469
0.506187
0.500885
0.495565
0.490226
0.484869
0.479494
0.4741
0.468689
0.46326
0.457813
0.45235
0.446869
0.441371
0.435857
0.430326
0.42478
0.419217
0.413638
0.408044
0.402435
0.39681
0.39117
0.385516
0.379847
0.374164
0.368467
0.362756
0.357031
0.351293
0.345541
0.339777
0.334
0.32821
0.322408
0.316593
0.310767
0.304929
0.29908
0.293219
0.287347
0.281465
0.275572
0.269668
0.263755
0.257831
0.251898
0.245955
0.240003
0.234042
0.228072
0.222094
0.216107
0.210112
0.204109
0.198098
0.19208
0.186055
0.180023
0.173984
0.167938
0.161886
0.155828
0.149765
0.143695
0.13762
0.13154
0.125455
0.119365
0.113271
0.107172
0.10107
0.0949635
0.0888536
0.0827403
0.0766239
0.0705046
0.0643826
0.0582583
0.0521317
0.0460032
0.0398729
0.0337412
0.0276081
0.0214741
0.0153392
0.00920375
0.00306796
-0.00306796
-0.00920376
-0.0153392
-0.0214741
-0.0276081
-0.0337412
-0.0398729
-0.0460032
-0.0521317
-0.0582583
-0.0643826
-0.0705046
-0.0766239
-0.0827403
-0.0888536
-0.0949635
-0.10107
-0.107172
-0.113271
-0.119365
-0.125455
-0.13154
-0.13762
-0.143695
-0.149765
-0.155828
-0.161886
-0.167938
-0.173984
-0.180023
-0.186055
-0.19208
-0.198098
-0.204109
-0.210112
-0.216107
-0.222094
-0.228072
-0.234042
-0.240003
-0.245955
-0.251898
-0.257831
-0.263755
-0.269668
-0.275572
-0.281465
-0.287347
-0.293219
-0.29908
-0.304929
-0.310767
-0.316593
-0.322408
-0.32821
-0.334
-0.339777
-0.345541
-0.351293
-0.357031
-0.362756
-0.368467
-0.374164
-0.379847
-0.385516
-0.39117
-0.39681
-0.402435
-0.408044
-0.413638
-0.419217
-0.42478
-0.430326
-0.435857
-0.441371
-0.446869
-0.45235
-0.457813
-0.46326
-0.468689
-0.4741
-0.479494
-0.484869
-0.490226
-0.495565
-0.500885
-0.506187
-0.511469
-0.516732
-0.521975
-0.527199
-0.532403
-0.537587
-0.542751
-0.547894
-0.553017
-0.558119
-0.563199
-0.568259
-0.573297
-0.578314
-0.583309
-0.588282
-0.593232
-0.598161
-0.603067
-0.60795
-0.61281
-0.617647
-0.622461
-0.627252
-0.632019
-0.636762
-0.641481
-0.646176
-0.650847
-0.655493
-0.660114
-0.664711
-0.669283
-0.673829
-0.67835
-0.682846
-0.687315
-0.691759
-0.696177
-0.700569
-0.704934
-0.709273
-0.713585
-0.71787
-0.722128
-0.726359
-0.730563
-0.734739
-0.738887
-0.743008
-0.747101
-0.751165
-0.755201
-0.759209
-0.763188
-0.767139
-0.771061
-0.774953
-0.778817
-0.782651
-0.786455
-0.79023
-0.793975
-0.797691
-0.801376
-0.805031
-0.808656
-0.812251
-0.815814
-0.819348
-0.82285
-0.826321
-0.829761
-0.83317
-0.836548
-0.839894
-0.843208
-0.846491
-0.849742
-0.852961
-0.856147
-0.859302
-0.862424
-0.865514
-0.868571
-0.871595
-0.874587
-0.877545
-0.880471
-0.883363
-0.886223
-0.889048
-0.891841
-0.894599
-0.897325
-0.900016
-0.902673
-0.905297
-0.907886
-0.910441
-0.912962
-0.915449
-0.917901
-0.920318
-0.922701
-0.925049
-0.927363
-0.929641
-0.931884
-0.934093
-0.936266
-0.938404
-0.940506
-0.942573
-0.944605
-0.946601
-0.948561
-0.950486
-0.952375
-0.954228
-0.956045
-0.957826
-0.959572
-0.96128
-0.962953
-0.96459
-0.96619
-0.967754
-0.969281
-0.970772
-0.972226
-0.973644
-0.975025
-0.97637
-0.977677
-0.978948
-0.980182
-0.981379
-0.982539
-0.983662
-0.984749
-0.985798
-0.986809
-0.987784
-0.988722
-0.989622
-0.990485
-0.991311
-0.992099
-0.99285
-0.993564
-0.99424
-0.994879
-0.995481
-0.996045
-0.996571
-0.99706
-0.997511
-0.997925
-0.998302
-0.99864
-0.998941
-0.999205
-0.999431
-0.999619
-0.999769
-0.999882
-0.999958
-0.999995
-0.999995
-0.999958
-0.999882
-0.999769
-0.999619
-0.999431
-0.999205
-0.998941
-0.99864
-0.998302
-0.997925
-0.997511
-0.99706
-0.996571
-0.996045
-0.995481
-0.994879
-0.99424
-0.993564
-0.99285
-0.992099
-0.991311
-0.990485
-0.989622
-0.988722
-0.987784
-0.986809
-0.985798
-0.984749
-0.983662
-0.982539
-0.981379
-0.980182
-0.978948
-0.977677
-0.97637
-0.975025
-0.973644
-0.972226
-0.970772
-0.969281
-0.967754
-0.96619
-0.96459
-0.962953
-0.96128
-0.959572
-0.957826
-0.956045
-0.954228
-0.952375
-0.950486
-0.948561
-0.946601
-0.944605
-0.942573
-0.940506
-0.938404
-0.936266
-0.934093
-0.931884
-0.929641
-0.927363
-0.925049
-0.922701
-0.920318
-0.917901
-0.915449
-0.912962
-0.910441
-0.907886
-0.905297
-0.902673
-0.900016
-0.897325
-0.894599
-0.891841
-0.889048
-0.886223
-0.883363
-0.880471
-0.877545
-0.874587
-0.871595
-0.868571
-0.865514
-0.862424
-0.859302
-0.856147
-0.852961
-0.849742
-0.846491
-0.843208
-0.839894
-0.836548
-0.83317
-0.829761
-0.826321
-0.82285
-0.819348
-0.815814
-0.812251
-0.808656
-0.805031
-0.801376
-0.797691
-0.793975
-0.79023
-0.786455
-0.782651
-0.778817
-0.774953
-0.771061
-0.767139
-0.763188
-0.759209
-0.755201
-0.751165
-0.747101
-0.743008
-0.738887
-0.734739
-0.730563
-0.726359
-0.722128
-0.71787
-0.713585
-0.709273
-0.704934
-0.700569
-0.696177
-0.691759
-0.687315
-0.682846
-0.67835
-0.673829
-0.669283
-0.664711
-0.660114
-0.655493
-0.650847
-0.646176
-0.641481
-0.636762
-0.632019
-0.627252
-0.622461
-0.617647
-0.61281
-0.60795
-0.603067
-0.598161
-0.593232
-0.588282
-0.583309
-0.578314
-0.573297
-0.568259
-0.563199
-0.558119
-0.553017
-0.547894
-0.542751
-0.537587
-0.532403
-0.527199
-0.521975
-0.516732
-0.511469
-0.506187
-0.500885
-0.495565
-0.490226
-0.484869
-0.479494
-0.4741
-0.468689
-0.46326
-0.457813
-0.45235
-0.446869
-0.441371
-0.435857
-0.430326
-0.42478
-0.419217
-0.413638
-0.408044
-0.402435
-0.39681
-0.39117
-0.385516
-0.379847
-0.374164
-0.368467
-0.362756
-0.357031
-0.351293
-0.345541
-0.339777
-0.334
-0.32821
-0.322408
-0.316593
-0.310767
-0.304929
-0.29908
-0.293219
-0.287347
-0.281465
-0.275572
-0.269668
-0.263755
-0.257831
-0.251898
-0.245955
-0.240003
-0.234042
-0.228072
-0.222094
-0.216107
-0.210112
-0.204109
-0.198098
-0.19208
-0.186055
-0.180023
-0.173984
-0.167938
-0.161886
-0.155828
-0.149765
-0.143695
-0.13762
-0.13154
-0.125455
-0.119365
-0.113271
-0.107172
-0.10107
-0.0949635
-0.0888536
-0.0827403
-0.0766239
-0.0705046
-0.0643826
-0.0582583
-0.0521317
-0.0460032
-0.0398729
-0.0337412
-0.0276081
-0.0214741
-0.0153392
-0.00920375
-0.00306796
/sqmusic/trunk/sqm/sq_pg.v
0,0 → 1,46
module sq_pg(
input clk,
input reset_n,
input [10:0] fnumber,
input [2:0] block,
input [3:0] multiple,
output [9:0]phase );
 
reg [19:0] count;
assign phase = count[19:10];
 
wire [19:0]fmult;
 
always @(*) begin
case( multiple )
4'b0: fmult = (phase << block) >> 1'b1;
default: fmult = (phase<<block)*multiple;
endcase
end
 
always @(posedge clk or negedge reset_n ) begin
if( !reset_n )
count <= 20'b0;
else begin
count <= count + fmult;
end
end
 
endmodule
 
module sq_sin(
// input clk,
// input reset_n,
input [9:0]phase,
output [19:0] val
)
 
reg [19:0] sin_table[1023:0];
 
initial begin
$readmemh("sin_table.hex", sin_table);
end
 
assign val = sin_table[phase];
 
end

powered by: WebSVN 2.1.0

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