FPGA 实现 DDS 源码分享

先上DDS 源码, 配套的testbench见一楼答案。

DDS_32.v

//verilog实现的sin波dds
//输出频率F = Fclk/(2^32)*phase
module dds_32(
input                        clk      ,
input                        rst      ,
input                        en       ,
input           [31:0]       phase    ,//频率累加字
output  reg                  dout_vld , 
output  reg     [15:0]       cos_wave 
);

parameter                    INIT = 0;

wire    signed  [15:0]       sin_table[1023:0];
reg             [31:0]       freq_cnt;
//sin wave table 1024point
assign                       sin_table[0000] = 16384;
assign                       sin_table[0001] = 16384;
assign                       sin_table[0002] = 16383;
assign                       sin_table[0003] = 16381;
assign                       sin_table[0004] = 16379;
assign                       sin_table[0005] = 16376;
assign                       sin_table[0006] = 16373;
assign                       sin_table[0007] = 16369;
assign                       sin_table[0008] = 16364;
assign                       sin_table[0009] = 16359;
assign                       sin_table[0010] = 16353;
assign                       sin_table[0011] = 16347;
assign                       sin_table[0012] = 16340;
assign                       sin_table[0013] = 16332;
assign                       sin_table[0014] = 16324;
assign                       sin_table[0015] = 16315;
assign                       sin_table[0016] = 16305;
assign                       sin_table[0017] = 16295;
assign                       sin_table[0018] = 16284;
assign                       sin_table[0019] = 16273;
assign                       sin_table[0020] = 16261;
assign                       sin_table[0021] = 16248;
assign                       sin_table[0022] = 16235;
assign                       sin_table[0023] = 16221;
assign                       sin_table[0024] = 16207;
assign                       sin_table[0025] = 16192;
assign                       sin_table[0026] = 16176;
assign                       sin_table[0027] = 16160;
assign                       sin_table[0028] = 16143;
assign                       sin_table[0029] = 16125;
assign                       sin_table[0030] = 16107;
assign                       sin_table[0031] = 16088;
assign                       sin_table[0032] = 16069;
assign                       sin_table[0033] = 16049;
assign                       sin_table[0034] = 16029;
assign                       sin_table[0035] = 16008;
assign                       sin_table[0036] = 15986;
assign                       sin_table[0037] = 15964;
assign                       sin_table[0038] = 15941;
assign                       sin_table[0039] = 15917;
assign                       sin_table[0040] = 15893;
assign                       sin_table[0041] = 15868;
assign                       sin_table[0042] = 15843;
assign                       sin_table[0043] = 15817;
assign                       sin_table[0044] = 15791;
assign                       sin_table[0045] = 15763;
assign                       sin_table[0046] = 15736;
assign                       sin_table[0047] = 15707;
assign                       sin_table[0048] = 15679;
assign                       sin_table[0049] = 15649;
assign                       sin_table[0050] = 15619;
assign                       sin_table[0051] = 15588;
assign                       sin_table[0052] = 15557;
assign                       sin_table[0053] = 15525;
assign                       sin_table[0054] = 15493;
assign                       sin_table[0055] = 15460;
assign                       sin_table[0056] = 15426;
assign                       sin_table[0057] = 15392;
assign                       sin_table[0058] = 15357;
assign                       sin_table[0059] = 15322;
assign                       sin_table[0060] = 15286;
assign                       sin_table[0061] = 15250;
assign                       sin_table[0062] = 15213;
assign                       sin_table[0063] = 15175;
assign                       sin_table[0064] = 15137;
assign                       sin_table[0065] = 15098;
assign                       sin_table[0066] = 15059;
assign                       sin_table[0067] = 15019;
assign                       sin_table[0068] = 14978;
assign                       sin_table[0069] = 14937;
assign                       sin_table[0070] = 14896;
assign                       sin_table[0071] = 14854;
assign                       sin_table[0072] = 14811;
assign                       sin_table[0073] = 14768;
assign                       sin_table[0074] = 14724;
assign                       sin_table[0075] = 14680;
assign                       sin_table[0076] = 14635;
assign                       sin_table[0077] = 14589;
assign                       sin_table[0078] = 14543;
assign                       sin_table[0079] = 14497;
assign                       sin_table[0080] = 14449;
assign                       sin_table[0081] = 14402;
assign                       sin_table[0082] = 14354;
assign                       sin_table[0083] = 14305;
assign                       sin_table[0084] = 14256;
assign                       sin_table[0085] = 14206;
assign                       sin_table[0086] = 14155;
assign                       sin_table[0087] = 14104;
assign                       sin_table[0088] = 14053;
assign                       sin_table[0089] = 14001;
assign                       sin_table[0090] = 13949;
assign                       sin_table[0091] = 13896;
assign                       sin_table[0092] = 13842;
assign                       sin_table[0093] = 13788;
assign                       sin_table[0094] = 13733;
assign                       sin_table[0095] = 13678;
assign                       sin_table[0096] = 13623;
assign                       sin_table[0097] = 13567;
assign                       sin_table[0098] = 13510;
assign                       sin_table[0099] = 13453;
assign                       sin_table[0100] = 13395;
assign                       sin_table[0101] = 13337;
assign                       sin_table[0102] = 13279;
assign                       sin_table[0103] = 13219;
assign                       sin_table[0104] = 13160;
assign                       sin_table[0105] = 13100;
assign                       sin_table[0106] = 13039;
assign                       sin_table[0107] = 12978;
assign                       sin_table[0108] = 12916;
assign                       sin_table[0109] = 12854;
assign                       sin_table[0110] = 12792;
assign                       sin_table[0111] = 12729;
assign                       sin_table[0112] = 12665;
assign                       sin_table[0113] = 12601;
assign                       sin_table[0114] = 12537;
assign                       sin_table[0115] = 12472;
assign                       sin_table[0116] = 12406;
assign                       sin_table[0117] = 12340;
assign                       sin_table[0118] = 12274;
assign                       sin_table[0119] = 12207;
assign                       sin_table[0120] = 12140;
assign                       sin_table[0121] = 12072;
assign                       sin_table[0122] = 12004;
assign                       sin_table[0123] = 11935;
assign                       sin_table[0124] = 11866;
assign                       sin_table[0125] = 11797;
assign                       sin_table[0126] = 11727;
assign                       sin_table[0127] = 11656;
assign                       sin_table[0128] = 11585;
assign                       sin_table[0129] = 11514;
assign                       sin_table[0130] = 11442;
assign                       sin_table[0131] = 11370;
assign                       sin_table[0132] = 11297;
assign                       sin_table[0133] = 11224;
assign                       sin_table[0134] = 11151;
assign                       sin_table[0135] = 11077;
assign                       sin_table[0136] = 11003;
assign                       sin_table[0137] = 10928;
assign                       sin_table[0138] = 10853;
assign                       sin_table[0139] = 10778;
assign                       sin_table[0140] = 10702;
assign                       sin_table[0141] = 10625;
assign                       sin_table[0142] = 10549;
assign                       sin_table[0143] = 10471;
assign                       sin_table[0144] = 10394;
assign                       sin_table[0145] = 10316;
assign                       sin_table[0146] = 10238;
assign                       sin_table[0147] = 10159;
assign                       sin_table[0148] = 10080;
assign                       sin_table[0149] = 10001;
assign                       sin_table[0150] = 9921;
assign                       sin_table[0151] = 9841;
assign                       sin_table[0152] = 9760;
assign                       sin_table[0153] = 9679;
assign                       sin_table[0154] = 9598;
assign                       sin_table[0155] = 9516;
assign                       sin_table[0156] = 9434;
assign                       sin_table[0157] = 9352;
assign                       sin_table[0158] = 9269;
assign                       sin_table[0159] = 9186;
assign                       sin_table[0160] = 9102;
assign                       sin_table[0161] = 9019;
assign                       sin_table[0162] = 8935;
assign                       sin_table[0163] = 8850;
assign                       sin_table[0164] = 8765;
assign                       sin_table[0165] = 8680;
assign                       sin_table[0166] = 8595;
assign                       sin_table[0167] = 8509;
assign                       sin_table[0168] = 8423;
assign                       sin_table[0169] = 8337;
assign                       sin_table[0170] = 8250;
assign                       sin_table[0171] = 8163;
assign                       sin_table[0172] = 8076;
assign                       sin_table[0173] = 7988;
assign                       sin_table[0174] = 7900;
assign                       sin_table[0175] = 7812;
assign                       sin_table[0176] = 7723;
assign                       sin_table[0177] = 7635;
assign                       sin_table[0178] = 7545;
assign                       sin_table[0179] = 7456;
assign                       sin_table[0180] = 7366;
assign                       sin_table[0181] = 7276;
assign                       sin_table[0182] = 7186;
assign                       sin_table[0183] = 7096;
assign                       sin_table[0184] = 7005;
assign                       sin_table[0185] = 6914;
assign                       sin_table[0186] = 6823;
assign                       sin_table[0187] = 6731;
assign                       sin_table[0188] = 6639;
assign                       sin_table[0189] = 6547;
assign                       sin_table[0190] = 6455;
assign                       sin_table[0191] = 6363;
assign                       sin_table[0192] = 6270;
assign                       sin_table[0193] = 6177;
assign                       sin_table[0194] = 6084;
assign                       sin_table[0195] = 5990;
assign                       sin_table[0196] = 5897;
assign                       sin_table[0197] = 5803;
assign                       sin_table[0198] = 5708;
assign                       sin_table[0199] = 5614;
assign                       sin_table[0200] = 5520;
assign                       sin_table[0201] = 5425;
assign                       sin_table[0202] = 5330;
assign                       sin_table[0203] = 5235;
assign                       sin_table[0204] = 5139;
assign                       sin_table[0205] = 5044;
assign                       sin_table[0206] = 4948;
assign                       sin_table[0207] = 4852;
assign                       sin_table[0208] = 4756;
assign                       sin_table[0209] = 4660;
assign                       sin_table[0210] = 4563;
assign                       sin_table[0211] = 4467;
assign                       sin_table[0212] = 4370;
assign                       sin_table[0213] = 4273;
assign                       sin_table[0214] = 4176;
assign                       sin_table[0215] = 4078;
assign                       sin_table[0216] = 3981;
assign                       sin_table[0217] = 3883;
assign                       sin_table[0218] = 3786;
assign                       sin_table[0219] = 3688;
assign                       sin_table[0220] = 3590;
assign                       sin_table[0221] = 3492;
assign                       sin_table[0222] = 3393;
assign                       sin_table[0223] = 3295;
assign                       sin_table[0224] = 3196;
assign                       sin_table[0225] = 3098;
assign                       sin_table[0226] = 2999;
assign                       sin_table[0227] = 2900;
assign                       sin_table[0228] = 2801;
assign                       sin_table[0229] = 2702;
assign                       sin_table[0230] = 2603;
assign                       sin_table[0231] = 2503;
assign                       sin_table[0232] = 2404;
assign                       sin_table[0233] = 2305;
assign                       sin_table[0234] = 2205;
assign                       sin_table[0235] = 2105;
assign                       sin_table[0236] = 2006;
assign                       sin_table[0237] = 1906;
assign                       sin_table[0238] = 1806;
assign                       sin_table[0239] = 1706;
assign                       sin_table[0240] = 1606;
assign                       sin_table[0241] = 1506;
assign                       sin_table[0242] = 1406;
assign                       sin_table[0243] = 1306;
assign                       sin_table[0244] = 1205;
assign                       sin_table[0245] = 1105;
assign                       sin_table[0246] = 1005;
assign                       sin_table[0247] = 904;
assign                       sin_table[0248] = 804;
assign                       sin_table[0249] = 704;
assign                       sin_table[0250] = 603;
assign                       sin_table[0251] = 503;
assign                       sin_table[0252] = 402;
assign                       sin_table[0253] = 302;
assign                       sin_table[0254] = 201;
assign                       sin_table[0255] = 101;
assign                       sin_table[0256] = 0;
assign                       sin_table[0257] = -101;
assign                       sin_table[0258] = -201;
assign                       sin_table[0259] = -302;
assign                       sin_table[0260] = -402;
assign                       sin_table[0261] = -503;
assign                       sin_table[0262] = -603;
assign                       sin_table[0263] = -704;
assign                       sin_table[0264] = -804;
assign                       sin_table[0265] = -904;
assign                       sin_table[0266] = -1005;
assign                       sin_table[0267] = -1105;
assign                       sin_table[0268] = -1205;
assign                       sin_table[0269] = -1306;
assign                       sin_table[0270] = -1406;
assign                       sin_table[0271] = -1506;
assign                       sin_table[0272] = -1606;
assign                       sin_table[0273] = -1706;
assign                       sin_table[0274] = -1806;
assign                       sin_table[0275] = -1906;
assign                       sin_table[0276] = -2006;
assign                       sin_table[0277] = -2105;
assign                       sin_table[0278] = -2205;
assign                       sin_table[0279] = -2305;
assign                       sin_table[0280] = -2404;
assign                       sin_table[0281] = -2503;
assign                       sin_table[0282] = -2603;
assign                       sin_table[0283] = -2702;
assign                       sin_table[0284] = -2801;
assign                       sin_table[0285] = -2900;
assign                       sin_table[0286] = -2999;
assign                       sin_table[0287] = -3098;
assign                       sin_table[0288] = -3196;
assign                       sin_table[0289] = -3295;
assign                       sin_table[0290] = -3393;
assign                       sin_table[0291] = -3492;
assign                       sin_table[0292] = -3590;
assign                       sin_table[0293] = -3688;
assign                       sin_table[0294] = -3786;
assign                       sin_table[0295] = -3883;
assign                       sin_table[0296] = -3981;
assign                       sin_table[0297] = -4078;
assign                       sin_table[0298] = -4176;
assign                       sin_table[0299] = -4273;
assign                       sin_table[0300] = -4370;
assign                       sin_table[0301] = -4467;
assign                       sin_table[0302] = -4563;
assign                       sin_table[0303] = -4660;
assign                       sin_table[0304] = -4756;
assign                       sin_table[0305] = -4852;
assign                       sin_table[0306] = -4948;
assign                       sin_table[0307] = -5044;
assign                       sin_table[0308] = -5139;
assign                       sin_table[0309] = -5235;
assign                       sin_table[0310] = -5330;
assign                       sin_table[0311] = -5425;
assign                       sin_table[0312] = -5520;
assign                       sin_table[0313] = -5614;
assign                       sin_table[0314] = -5708;
assign                       sin_table[0315] = -5803;
assign                       sin_table[0316] = -5897;
assign                       sin_table[0317] = -5990;
assign                       sin_table[0318] = -6084;
assign                       sin_table[0319] = -6177;
assign                       sin_table[0320] = -6270;
assign                       sin_table[0321] = -6363;
assign                       sin_table[0322] = -6455;
assign                       sin_table[0323] = -6547;
assign                       sin_table[0324] = -6639;
assign                       sin_table[0325] = -6731;
assign                       sin_table[0326] = -6823;
assign                       sin_table[0327] = -6914;
assign                       sin_table[0328] = -7005;
assign                       sin_table[0329] = -7096;
assign                       sin_table[0330] = -7186;
assign                       sin_table[0331] = -7276;
assign                       sin_table[0332] = -7366;
assign                       sin_table[0333] = -7456;
assign                       sin_table[0334] = -7545;
assign                       sin_table[0335] = -7635;
assign                       sin_table[0336] = -7723;
assign                       sin_table[0337] = -7812;
assign                       sin_table[0338] = -7900;
assign                       sin_table[0339] = -7988;
assign                       sin_table[0340] = -8076;
assign                       sin_table[0341] = -8163;
assign                       sin_table[0342] = -8250;
assign                       sin_table[0343] = -8337;
assign                       sin_table[0344] = -8423;
assign                       sin_table[0345] = -8509;
assign                       sin_table[0346] = -8595;
assign                       sin_table[0347] = -8680;
assign                       sin_table[0348] = -8765;
assign                       sin_table[0349] = -8850;
assign                       sin_table[0350] = -8935;
assign                       sin_table[0351] = -9019;
assign                       sin_table[0352] = -9102;
assign                       sin_table[0353] = -9186;
assign                       sin_table[0354] = -9269;
assign                       sin_table[0355] = -9352;
assign                       sin_table[0356] = -9434;
assign                       sin_table[0357] = -9516;
assign                       sin_table[0358] = -9598;
assign                       sin_table[0359] = -9679;
assign                       sin_table[0360] = -9760;
assign                       sin_table[0361] = -9841;
assign                       sin_table[0362] = -9921;
assign                       sin_table[0363] = -10001;
assign                       sin_table[0364] = -10080;
assign                       sin_table[0365] = -10159;
assign                       sin_table[0366] = -10238;
assign                       sin_table[0367] = -10316;
assign                       sin_table[0368] = -10394;
assign                       sin_table[0369] = -10471;
assign                       sin_table[0370] = -10549;
assign                       sin_table[0371] = -10625;
assign                       sin_table[0372] = -10702;
assign                       sin_table[0373] = -10778;
assign                       sin_table[0374] = -10853;
assign                       sin_table[0375] = -10928;
assign                       sin_table[0376] = -11003;
assign                       sin_table[0377] = -11077;
assign                       sin_table[0378] = -11151;
assign                       sin_table[0379] = -11224;
assign                       sin_table[0380] = -11297;
assign                       sin_table[0381] = -11370;
assign                       sin_table[0382] = -11442;
assign                       sin_table[0383] = -11514;
assign                       sin_table[0384] = -11585;
assign                       sin_table[0385] = -11656;
assign                       sin_table[0386] = -11727;
assign                       sin_table[0387] = -11797;
assign                       sin_table[0388] = -11866;
assign                       sin_table[0389] = -11935;
assign                       sin_table[0390] = -12004;
assign                       sin_table[0391] = -12072;
assign                       sin_table[0392] = -12140;
assign                       sin_table[0393] = -12207;
assign                       sin_table[0394] = -12274;
assign                       sin_table[0395] = -12340;
assign                       sin_table[0396] = -12406;
assign                       sin_table[0397] = -12472;
assign                       sin_table[0398] = -12537;
assign                       sin_table[0399] = -12601;
assign                       sin_table[0400] = -12665;
assign                       sin_table[0401] = -12729;
assign                       sin_table[0402] = -12792;
assign                       sin_table[0403] = -12854;
assign                       sin_table[0404] = -12916;
assign                       sin_table[0405] = -12978;
assign                       sin_table[0406] = -13039;
assign                       sin_table[0407] = -13100;
assign                       sin_table[0408] = -13160;
assign                       sin_table[0409] = -13219;
assign                       sin_table[0410] = -13279;
assign                       sin_table[0411] = -13337;
assign                       sin_table[0412] = -13395;
assign                       sin_table[0413] = -13453;
assign                       sin_table[0414] = -13510;
assign                       sin_table[0415] = -13567;
assign                       sin_table[0416] = -13623;
assign                       sin_table[0417] = -13678;
assign                       sin_table[0418] = -13733;
assign                       sin_table[0419] = -13788;
assign                       sin_table[0420] = -13842;
assign                       sin_table[0421] = -13896;
assign                       sin_table[0422] = -13949;
assign                       sin_table[0423] = -14001;
assign                       sin_table[0424] = -14053;
assign                       sin_table[0425] = -14104;
assign                       sin_table[0426] = -14155;
assign                       sin_table[0427] = -14206;
assign                       sin_table[0428] = -14256;
assign                       sin_table[0429] = -14305;
assign                       sin_table[0430] = -14354;
assign                       sin_table[0431] = -14402;
assign                       sin_table[0432] = -14449;
assign                       sin_table[0433] = -14497;
assign                       sin_table[0434] = -14543;
assign                       sin_table[0435] = -14589;
assign                       sin_table[0436] = -14635;
assign                       sin_table[0437] = -14680;
assign                       sin_table[0438] = -14724;
assign                       sin_table[0439] = -14768;
assign                       sin_table[0440] = -14811;
assign                       sin_table[0441] = -14854;
assign                       sin_table[0442] = -14896;
assign                       sin_table[0443] = -14937;
assign                       sin_table[0444] = -14978;
assign                       sin_table[0445] = -15019;
assign                       sin_table[0446] = -15059;
assign                       sin_table[0447] = -15098;
assign                       sin_table[0448] = -15137;
assign                       sin_table[0449] = -15175;
assign                       sin_table[0450] = -15213;
assign                       sin_table[0451] = -15250;
assign                       sin_table[0452] = -15286;
assign                       sin_table[0453] = -15322;
assign                       sin_table[0454] = -15357;
assign                       sin_table[0455] = -15392;
assign                       sin_table[0456] = -15426;
assign                       sin_table[0457] = -15460;
assign                       sin_table[0458] = -15493;
assign                       sin_table[0459] = -15525;
assign                       sin_table[0460] = -15557;
assign                       sin_table[0461] = -15588;
assign                       sin_table[0462] = -15619;
assign                       sin_table[0463] = -15649;
assign                       sin_table[0464] = -15679;
assign                       sin_table[0465] = -15707;
assign                       sin_table[0466] = -15736;
assign                       sin_table[0467] = -15763;
assign                       sin_table[0468] = -15791;
assign                       sin_table[0469] = -15817;
assign                       sin_table[0470] = -15843;
assign                       sin_table[0471] = -15868;
assign                       sin_table[0472] = -15893;
assign                       sin_table[0473] = -15917;
assign                       sin_table[0474] = -15941;
assign                       sin_table[0475] = -15964;
assign                       sin_table[0476] = -15986;
assign                       sin_table[0477] = -16008;
assign                       sin_table[0478] = -16029;
assign                       sin_table[0479] = -16049;
assign                       sin_table[0480] = -16069;
assign                       sin_table[0481] = -16088;
assign                       sin_table[0482] = -16107;
assign                       sin_table[0483] = -16125;
assign                       sin_table[0484] = -16143;
assign                       sin_table[0485] = -16160;
assign                       sin_table[0486] = -16176;
assign                       sin_table[0487] = -16192;
assign                       sin_table[0488] = -16207;
assign                       sin_table[0489] = -16221;
assign                       sin_table[0490] = -16235;
assign                       sin_table[0491] = -16248;
assign                       sin_table[0492] = -16261;
assign                       sin_table[0493] = -16273;
assign                       sin_table[0494] = -16284;
assign                       sin_table[0495] = -16295;
assign                       sin_table[0496] = -16305;
assign                       sin_table[0497] = -16315;
assign                       sin_table[0498] = -16324;
assign                       sin_table[0499] = -16332;
assign                       sin_table[0500] = -16340;
assign                       sin_table[0501] = -16347;
assign                       sin_table[0502] = -16353;
assign                       sin_table[0503] = -16359;
assign                       sin_table[0504] = -16364;
assign                       sin_table[0505] = -16369;
assign                       sin_table[0506] = -16373;
assign                       sin_table[0507] = -16376;
assign                       sin_table[0508] = -16379;
assign                       sin_table[0509] = -16381;
assign                       sin_table[0510] = -16383;
assign                       sin_table[0511] = -16384;
assign                       sin_table[0512] = -16384;
assign                       sin_table[0513] = -16384;
assign                       sin_table[0514] = -16383;
assign                       sin_table[0515] = -16381;
assign                       sin_table[0516] = -16379;
assign                       sin_table[0517] = -16376;
assign                       sin_table[0518] = -16373;
assign                       sin_table[0519] = -16369;
assign                       sin_table[0520] = -16364;
assign                       sin_table[0521] = -16359;
assign                       sin_table[0522] = -16353;
assign                       sin_table[0523] = -16347;
assign                       sin_table[0524] = -16340;
assign                       sin_table[0525] = -16332;
assign                       sin_table[0526] = -16324;
assign                       sin_table[0527] = -16315;
assign                       sin_table[0528] = -16305;
assign                       sin_table[0529] = -16295;
assign                       sin_table[0530] = -16284;
assign                       sin_table[0531] = -16273;
assign                       sin_table[0532] = -16261;
assign                       sin_table[0533] = -16248;
assign                       sin_table[0534] = -16235;
assign                       sin_table[0535] = -16221;
assign                       sin_table[0536] = -16207;
assign                       sin_table[0537] = -16192;
assign                       sin_table[0538] = -16176;
assign                       sin_table[0539] = -16160;
assign                       sin_table[0540] = -16143;
assign                       sin_table[0541] = -16125;
assign                       sin_table[0542] = -16107;
assign                       sin_table[0543] = -16088;
assign                       sin_table[0544] = -16069;
assign                       sin_table[0545] = -16049;
assign                       sin_table[0546] = -16029;
assign                       sin_table[0547] = -16008;
assign                       sin_table[0548] = -15986;
assign                       sin_table[0549] = -15964;
assign                       sin_table[0550] = -15941;
assign                       sin_table[0551] = -15917;
assign                       sin_table[0552] = -15893;
assign                       sin_table[0553] = -15868;
assign                       sin_table[0554] = -15843;
assign                       sin_table[0555] = -15817;
assign                       sin_table[0556] = -15791;
assign                       sin_table[0557] = -15763;
assign                       sin_table[0558] = -15736;
assign                       sin_table[0559] = -15707;
assign                       sin_table[0560] = -15679;
assign                       sin_table[0561] = -15649;
assign                       sin_table[0562] = -15619;
assign                       sin_table[0563] = -15588;
assign                       sin_table[0564] = -15557;
assign                       sin_table[0565] = -15525;
assign                       sin_table[0566] = -15493;
assign                       sin_table[0567] = -15460;
assign                       sin_table[0568] = -15426;
assign                       sin_table[0569] = -15392;
assign                       sin_table[0570] = -15357;
assign                       sin_table[0571] = -15322;
assign                       sin_table[0572] = -15286;
assign                       sin_table[0573] = -15250;
assign                       sin_table[0574] = -15213;
assign                       sin_table[0575] = -15175;
assign                       sin_table[0576] = -15137;
assign                       sin_table[0577] = -15098;
assign                       sin_table[0578] = -15059;
assign                       sin_table[0579] = -15019;
assign                       sin_table[0580] = -14978;
assign                       sin_table[0581] = -14937;
assign                       sin_table[0582] = -14896;
assign                       sin_table[0583] = -14854;
assign                       sin_table[0584] = -14811;
assign                       sin_table[0585] = -14768;
assign                       sin_table[0586] = -14724;
assign                       sin_table[0587] = -14680;
assign                       sin_table[0588] = -14635;
assign                       sin_table[0589] = -14589;
assign                       sin_table[0590] = -14543;
assign                       sin_table[0591] = -14497;
assign                       sin_table[0592] = -14449;
assign                       sin_table[0593] = -14402;
assign                       sin_table[0594] = -14354;
assign                       sin_table[0595] = -14305;
assign                       sin_table[0596] = -14256;
assign                       sin_table[0597] = -14206;
assign                       sin_table[0598] = -14155;
assign                       sin_table[0599] = -14104;
assign                       sin_table[0600] = -14053;
assign                       sin_table[0601] = -14001;
assign                       sin_table[0602] = -13949;
assign                       sin_table[0603] = -13896;
assign                       sin_table[0604] = -13842;
assign                       sin_table[0605] = -13788;
assign                       sin_table[0606] = -13733;
assign                       sin_table[0607] = -13678;
assign                       sin_table[0608] = -13623;
assign                       sin_table[0609] = -13567;
assign                       sin_table[0610] = -13510;
assign                       sin_table[0611] = -13453;
assign                       sin_table[0612] = -13395;
assign                       sin_table[0613] = -13337;
assign                       sin_table[0614] = -13279;
assign                       sin_table[0615] = -13219;
assign                       sin_table[0616] = -13160;
assign                       sin_table[0617] = -13100;
assign                       sin_table[0618] = -13039;
assign                       sin_table[0619] = -12978;
assign                       sin_table[0620] = -12916;
assign                       sin_table[0621] = -12854;
assign                       sin_table[0622] = -12792;
assign                       sin_table[0623] = -12729;
assign                       sin_table[0624] = -12665;
assign                       sin_table[0625] = -12601;
assign                       sin_table[0626] = -12537;
assign                       sin_table[0627] = -12472;
assign                       sin_table[0628] = -12406;
assign                       sin_table[0629] = -12340;
assign                       sin_table[0630] = -12274;
assign                       sin_table[0631] = -12207;
assign                       sin_table[0632] = -12140;
assign                       sin_table[0633] = -12072;
assign                       sin_table[0634] = -12004;
assign                       sin_table[0635] = -11935;
assign                       sin_table[0636] = -11866;
assign                       sin_table[0637] = -11797;
assign                       sin_table[0638] = -11727;
assign                       sin_table[0639] = -11656;
assign                       sin_table[0640] = -11585;
assign                       sin_table[0641] = -11514;
assign                       sin_table[0642] = -11442;
assign                       sin_table[0643] = -11370;
assign                       sin_table[0644] = -11297;
assign                       sin_table[0645] = -11224;
assign                       sin_table[0646] = -11151;
assign                       sin_table[0647] = -11077;
assign                       sin_table[0648] = -11003;
assign                       sin_table[0649] = -10928;
assign                       sin_table[0650] = -10853;
assign                       sin_table[0651] = -10778;
assign                       sin_table[0652] = -10702;
assign                       sin_table[0653] = -10625;
assign                       sin_table[0654] = -10549;
assign                       sin_table[0655] = -10471;
assign                       sin_table[0656] = -10394;
assign                       sin_table[0657] = -10316;
assign                       sin_table[0658] = -10238;
assign                       sin_table[0659] = -10159;
assign                       sin_table[0660] = -10080;
assign                       sin_table[0661] = -10001;
assign                       sin_table[0662] = -9921;
assign                       sin_table[0663] = -9841;
assign                       sin_table[0664] = -9760;
assign                       sin_table[0665] = -9679;
assign                       sin_table[0666] = -9598;
assign                       sin_table[0667] = -9516;
assign                       sin_table[0668] = -9434;
assign                       sin_table[0669] = -9352;
assign                       sin_table[0670] = -9269;
assign                       sin_table[0671] = -9186;
assign                       sin_table[0672] = -9102;
assign                       sin_table[0673] = -9019;
assign                       sin_table[0674] = -8935;
assign                       sin_table[0675] = -8850;
assign                       sin_table[0676] = -8765;
assign                       sin_table[0677] = -8680;
assign                       sin_table[0678] = -8595;
assign                       sin_table[0679] = -8509;
assign                       sin_table[0680] = -8423;
assign                       sin_table[0681] = -8337;
assign                       sin_table[0682] = -8250;
assign                       sin_table[0683] = -8163;
assign                       sin_table[0684] = -8076;
assign                       sin_table[0685] = -7988;
assign                       sin_table[0686] = -7900;
assign                       sin_table[0687] = -7812;
assign                       sin_table[0688] = -7723;
assign                       sin_table[0689] = -7635;
assign                       sin_table[0690] = -7545;
assign                       sin_table[0691] = -7456;
assign                       sin_table[0692] = -7366;
assign                       sin_table[0693] = -7276;
assign                       sin_table[0694] = -7186;
assign                       sin_table[0695] = -7096;
assign                       sin_table[0696] = -7005;
assign                       sin_table[0697] = -6914;
assign                       sin_table[0698] = -6823;
assign                       sin_table[0699] = -6731;
assign                       sin_table[0700] = -6639;
assign                       sin_table[0701] = -6547;
assign                       sin_table[0702] = -6455;
assign                       sin_table[0703] = -6363;
assign                       sin_table[0704] = -6270;
assign                       sin_table[0705] = -6177;
assign                       sin_table[0706] = -6084;
assign                       sin_table[0707] = -5990;
assign                       sin_table[0708] = -5897;
assign                       sin_table[0709] = -5803;
assign                       sin_table[0710] = -5708;
assign                       sin_table[0711] = -5614;
assign                       sin_table[0712] = -5520;
assign                       sin_table[0713] = -5425;
assign                       sin_table[0714] = -5330;
assign                       sin_table[0715] = -5235;
assign                       sin_table[0716] = -5139;
assign                       sin_table[0717] = -5044;
assign                       sin_table[0718] = -4948;
assign                       sin_table[0719] = -4852;
assign                       sin_table[0720] = -4756;
assign                       sin_table[0721] = -4660;
assign                       sin_table[0722] = -4563;
assign                       sin_table[0723] = -4467;
assign                       sin_table[0724] = -4370;
assign                       sin_table[0725] = -4273;
assign                       sin_table[0726] = -4176;
assign                       sin_table[0727] = -4078;
assign                       sin_table[0728] = -3981;
assign                       sin_table[0729] = -3883;
assign                       sin_table[0730] = -3786;
assign                       sin_table[0731] = -3688;
assign                       sin_table[0732] = -3590;
assign                       sin_table[0733] = -3492;
assign                       sin_table[0734] = -3393;
assign                       sin_table[0735] = -3295;
assign                       sin_table[0736] = -3196;
assign                       sin_table[0737] = -3098;
assign                       sin_table[0738] = -2999;
assign                       sin_table[0739] = -2900;
assign                       sin_table[0740] = -2801;
assign                       sin_table[0741] = -2702;
assign                       sin_table[0742] = -2603;
assign                       sin_table[0743] = -2503;
assign                       sin_table[0744] = -2404;
assign                       sin_table[0745] = -2305;
assign                       sin_table[0746] = -2205;
assign                       sin_table[0747] = -2105;
assign                       sin_table[0748] = -2006;
assign                       sin_table[0749] = -1906;
assign                       sin_table[0750] = -1806;
assign                       sin_table[0751] = -1706;
assign                       sin_table[0752] = -1606;
assign                       sin_table[0753] = -1506;
assign                       sin_table[0754] = -1406;
assign                       sin_table[0755] = -1306;
assign                       sin_table[0756] = -1205;
assign                       sin_table[0757] = -1105;
assign                       sin_table[0758] = -1005;
assign                       sin_table[0759] = -904;
assign                       sin_table[0760] = -804;
assign                       sin_table[0761] = -704;
assign                       sin_table[0762] = -603;
assign                       sin_table[0763] = -503;
assign                       sin_table[0764] = -402;
assign                       sin_table[0765] = -302;
assign                       sin_table[0766] = -201;
assign                       sin_table[0767] = -101;
assign                       sin_table[0768] = -0;
assign                       sin_table[0769] = 101;
assign                       sin_table[0770] = 201;
assign                       sin_table[0771] = 302;
assign                       sin_table[0772] = 402;
assign                       sin_table[0773] = 503;
assign                       sin_table[0774] = 603;
assign                       sin_table[0775] = 704;
assign                       sin_table[0776] = 804;
assign                       sin_table[0777] = 904;
assign                       sin_table[0778] = 1005;
assign                       sin_table[0779] = 1105;
assign                       sin_table[0780] = 1205;
assign                       sin_table[0781] = 1306;
assign                       sin_table[0782] = 1406;
assign                       sin_table[0783] = 1506;
assign                       sin_table[0784] = 1606;
assign                       sin_table[0785] = 1706;
assign                       sin_table[0786] = 1806;
assign                       sin_table[0787] = 1906;
assign                       sin_table[0788] = 2006;
assign                       sin_table[0789] = 2105;
assign                       sin_table[0790] = 2205;
assign                       sin_table[0791] = 2305;
assign                       sin_table[0792] = 2404;
assign                       sin_table[0793] = 2503;
assign                       sin_table[0794] = 2603;
assign                       sin_table[0795] = 2702;
assign                       sin_table[0796] = 2801;
assign                       sin_table[0797] = 2900;
assign                       sin_table[0798] = 2999;
assign                       sin_table[0799] = 3098;
assign                       sin_table[0800] = 3196;
assign                       sin_table[0801] = 3295;
assign                       sin_table[0802] = 3393;
assign                       sin_table[0803] = 3492;
assign                       sin_table[0804] = 3590;
assign                       sin_table[0805] = 3688;
assign                       sin_table[0806] = 3786;
assign                       sin_table[0807] = 3883;
assign                       sin_table[0808] = 3981;
assign                       sin_table[0809] = 4078;
assign                       sin_table[0810] = 4176;
assign                       sin_table[0811] = 4273;
assign                       sin_table[0812] = 4370;
assign                       sin_table[0813] = 4467;
assign                       sin_table[0814] = 4563;
assign                       sin_table[0815] = 4660;
assign                       sin_table[0816] = 4756;
assign                       sin_table[0817] = 4852;
assign                       sin_table[0818] = 4948;
assign                       sin_table[0819] = 5044;
assign                       sin_table[0820] = 5139;
assign                       sin_table[0821] = 5235;
assign                       sin_table[0822] = 5330;
assign                       sin_table[0823] = 5425;
assign                       sin_table[0824] = 5520;
assign                       sin_table[0825] = 5614;
assign                       sin_table[0826] = 5708;
assign                       sin_table[0827] = 5803;
assign                       sin_table[0828] = 5897;
assign                       sin_table[0829] = 5990;
assign                       sin_table[0830] = 6084;
assign                       sin_table[0831] = 6177;
assign                       sin_table[0832] = 6270;
assign                       sin_table[0833] = 6363;
assign                       sin_table[0834] = 6455;
assign                       sin_table[0835] = 6547;
assign                       sin_table[0836] = 6639;
assign                       sin_table[0837] = 6731;
assign                       sin_table[0838] = 6823;
assign                       sin_table[0839] = 6914;
assign                       sin_table[0840] = 7005;
assign                       sin_table[0841] = 7096;
assign                       sin_table[0842] = 7186;
assign                       sin_table[0843] = 7276;
assign                       sin_table[0844] = 7366;
assign                       sin_table[0845] = 7456;
assign                       sin_table[0846] = 7545;
assign                       sin_table[0847] = 7635;
assign                       sin_table[0848] = 7723;
assign                       sin_table[0849] = 7812;
assign                       sin_table[0850] = 7900;
assign                       sin_table[0851] = 7988;
assign                       sin_table[0852] = 8076;
assign                       sin_table[0853] = 8163;
assign                       sin_table[0854] = 8250;
assign                       sin_table[0855] = 8337;
assign                       sin_table[0856] = 8423;
assign                       sin_table[0857] = 8509;
assign                       sin_table[0858] = 8595;
assign                       sin_table[0859] = 8680;
assign                       sin_table[0860] = 8765;
assign                       sin_table[0861] = 8850;
assign                       sin_table[0862] = 8935;
assign                       sin_table[0863] = 9019;
assign                       sin_table[0864] = 9102;
assign                       sin_table[0865] = 9186;
assign                       sin_table[0866] = 9269;
assign                       sin_table[0867] = 9352;
assign                       sin_table[0868] = 9434;
assign                       sin_table[0869] = 9516;
assign                       sin_table[0870] = 9598;
assign                       sin_table[0871] = 9679;
assign                       sin_table[0872] = 9760;
assign                       sin_table[0873] = 9841;
assign                       sin_table[0874] = 9921;
assign                       sin_table[0875] = 10001;
assign                       sin_table[0876] = 10080;
assign                       sin_table[0877] = 10159;
assign                       sin_table[0878] = 10238;
assign                       sin_table[0879] = 10316;
assign                       sin_table[0880] = 10394;
assign                       sin_table[0881] = 10471;
assign                       sin_table[0882] = 10549;
assign                       sin_table[0883] = 10625;
assign                       sin_table[0884] = 10702;
assign                       sin_table[0885] = 10778;
assign                       sin_table[0886] = 10853;
assign                       sin_table[0887] = 10928;
assign                       sin_table[0888] = 11003;
assign                       sin_table[0889] = 11077;
assign                       sin_table[0890] = 11151;
assign                       sin_table[0891] = 11224;
assign                       sin_table[0892] = 11297;
assign                       sin_table[0893] = 11370;
assign                       sin_table[0894] = 11442;
assign                       sin_table[0895] = 11514;
assign                       sin_table[0896] = 11585;
assign                       sin_table[0897] = 11656;
assign                       sin_table[0898] = 11727;
assign                       sin_table[0899] = 11797;
assign                       sin_table[0900] = 11866;
assign                       sin_table[0901] = 11935;
assign                       sin_table[0902] = 12004;
assign                       sin_table[0903] = 12072;
assign                       sin_table[0904] = 12140;
assign                       sin_table[0905] = 12207;
assign                       sin_table[0906] = 12274;
assign                       sin_table[0907] = 12340;
assign                       sin_table[0908] = 12406;
assign                       sin_table[0909] = 12472;
assign                       sin_table[0910] = 12537;
assign                       sin_table[0911] = 12601;
assign                       sin_table[0912] = 12665;
assign                       sin_table[0913] = 12729;
assign                       sin_table[0914] = 12792;
assign                       sin_table[0915] = 12854;
assign                       sin_table[0916] = 12916;
assign                       sin_table[0917] = 12978;
assign                       sin_table[0918] = 13039;
assign                       sin_table[0919] = 13100;
assign                       sin_table[0920] = 13160;
assign                       sin_table[0921] = 13219;
assign                       sin_table[0922] = 13279;
assign                       sin_table[0923] = 13337;
assign                       sin_table[0924] = 13395;
assign                       sin_table[0925] = 13453;
assign                       sin_table[0926] = 13510;
assign                       sin_table[0927] = 13567;
assign                       sin_table[0928] = 13623;
assign                       sin_table[0929] = 13678;
assign                       sin_table[0930] = 13733;
assign                       sin_table[0931] = 13788;
assign                       sin_table[0932] = 13842;
assign                       sin_table[0933] = 13896;
assign                       sin_table[0934] = 13949;
assign                       sin_table[0935] = 14001;
assign                       sin_table[0936] = 14053;
assign                       sin_table[0937] = 14104;
assign                       sin_table[0938] = 14155;
assign                       sin_table[0939] = 14206;
assign                       sin_table[0940] = 14256;
assign                       sin_table[0941] = 14305;
assign                       sin_table[0942] = 14354;
assign                       sin_table[0943] = 14402;
assign                       sin_table[0944] = 14449;
assign                       sin_table[0945] = 14497;
assign                       sin_table[0946] = 14543;
assign                       sin_table[0947] = 14589;
assign                       sin_table[0948] = 14635;
assign                       sin_table[0949] = 14680;
assign                       sin_table[0950] = 14724;
assign                       sin_table[0951] = 14768;
assign                       sin_table[0952] = 14811;
assign                       sin_table[0953] = 14854;
assign                       sin_table[0954] = 14896;
assign                       sin_table[0955] = 14937;
assign                       sin_table[0956] = 14978;
assign                       sin_table[0957] = 15019;
assign                       sin_table[0958] = 15059;
assign                       sin_table[0959] = 15098;
assign                       sin_table[0960] = 15137;
assign                       sin_table[0961] = 15175;
assign                       sin_table[0962] = 15213;
assign                       sin_table[0963] = 15250;
assign                       sin_table[0964] = 15286;
assign                       sin_table[0965] = 15322;
assign                       sin_table[0966] = 15357;
assign                       sin_table[0967] = 15392;
assign                       sin_table[0968] = 15426;
assign                       sin_table[0969] = 15460;
assign                       sin_table[0970] = 15493;
assign                       sin_table[0971] = 15525;
assign                       sin_table[0972] = 15557;
assign                       sin_table[0973] = 15588;
assign                       sin_table[0974] = 15619;
assign                       sin_table[0975] = 15649;
assign                       sin_table[0976] = 15679;
assign                       sin_table[0977] = 15707;
assign                       sin_table[0978] = 15736;
assign                       sin_table[0979] = 15763;
assign                       sin_table[0980] = 15791;
assign                       sin_table[0981] = 15817;
assign                       sin_table[0982] = 15843;
assign                       sin_table[0983] = 15868;
assign                       sin_table[0984] = 15893;
assign                       sin_table[0985] = 15917;
assign                       sin_table[0986] = 15941;
assign                       sin_table[0987] = 15964;
assign                       sin_table[0988] = 15986;
assign                       sin_table[0989] = 16008;
assign                       sin_table[0990] = 16029;
assign                       sin_table[0991] = 16049;
assign                       sin_table[0992] = 16069;
assign                       sin_table[0993] = 16088;
assign                       sin_table[0994] = 16107;
assign                       sin_table[0995] = 16125;
assign                       sin_table[0996] = 16143;
assign                       sin_table[0997] = 16160;
assign                       sin_table[0998] = 16176;
assign                       sin_table[0999] = 16192;
assign                       sin_table[1000] = 16207;
assign                       sin_table[1001] = 16221;
assign                       sin_table[1002] = 16235;
assign                       sin_table[1003] = 16248;
assign                       sin_table[1004] = 16261;
assign                       sin_table[1005] = 16273;
assign                       sin_table[1006] = 16284;
assign                       sin_table[1007] = 16295;
assign                       sin_table[1008] = 16305;
assign                       sin_table[1009] = 16315;
assign                       sin_table[1010] = 16324;
assign                       sin_table[1011] = 16332;
assign                       sin_table[1012] = 16340;
assign                       sin_table[1013] = 16347;
assign                       sin_table[1014] = 16353;
assign                       sin_table[1015] = 16359;
assign                       sin_table[1016] = 16364;
assign                       sin_table[1017] = 16369;
assign                       sin_table[1018] = 16373;
assign                       sin_table[1019] = 16376;
assign                       sin_table[1020] = 16379;
assign                       sin_table[1021] = 16381;
assign                       sin_table[1022] = 16383;
assign                       sin_table[1023] = 16384;

always@(posedge clk)
begin
   cos_wave <= sin_table[freq_cnt[31:22]];
end


always@(posedge clk)
begin
   if(rst)
   begin
      freq_cnt <= INIT;
   end
   else if(en)
   begin
      freq_cnt <= freq_cnt + phase;
   end
end

always@(posedge clk) dout_vld <= en;
endmodule
请登录后发表评论

    • popomao的头像-ChipDebugpopomaoLV2作者0