M
magma1981
Guest
J'ai fait un programm sur le format DDS
module DDS7 (fc, PC, CLK, RSTN, sinout, out, cosout);
sortie [07:00 sinout], cosout;
sortie [09:00] à;
entrée [09:00] fc / / fc est fréq.mot contrôlée
entrée [07:00] pc; / / PC est contrôlé de phase mot
clk entrée, RSTN;
reg [07:00] sinout, cosout;
reg [09:00] acc0, ACC1, acc2, acc5;
reg [07:00] ACC3, ACC4, acc6, acc7, temp, temp1;
reg [00:00] MSB, smsb, spipe, spipe1;
reg [00:00] CMSB, csmsb, cpipe, cpipe1;
toujours @ (posedge CLK)
commencer
if (! RSTN)
commencer
acc0 <= 10'b0000000000;
ACC1 <= 10'b0000000000;
ACC2 <= 10'b0000000000;
ACC3 <= 8'b00000000;
acc6 <= 8'b00000000;
MSB <= 1'b0;
smsb <= 1'b0;
CMSB <= 1'b0;
csmsb <= 1'b0;
<= Spipe 1'b0;
<= Cpipe 1'b0;
spipe1 <= 1'b0;
cpipe1 <= 1'b0;
fin
d'autre
commencer
acc0 <= ACC1 fc;
ACC1 <= acc0;
ACC2 <= ACC1 pc;
acc5 <= acc2 256;
acc6 <= acc5 [07:00];
ACC3 <= acc2 [07:00];
<= Spipe acc2 [9];
spipe1 <= spipe; / / pipeline rempli
<MSB = spipe1;
<= Smsb acc2 [8];
<= Cpipe acc5 [9];
cpipe1 <= cpipe;
<= CMSB cpipe1;
<= Csmsb acc5 [8];
fin
fin
toujours @ (posedge CLK)
commencer
if (smsb)
commencer
if ((acc2 == 256) | | (acc2 == 768))
commencer
ACC4 <= ~ ACC3;
fin
d'autre
commencer
ACC4 <= ~ ACC3 1;
fin
fin
d'autre
commencer
ACC4 <= ACC3;
fin
if (MSB)
commencer
<Sinout = ~ temp 1;
fin
d'autre
commencer
<Sinout = temp;
fin
if (csmsb)
commencer
if ((acc5 == 256) | | (acc5 == 768))
commencer
acc7 <= ~ acc6;
fin
d'autre
commencer
acc7 <= ~ acc6 1;
fin
fin
d'autre
commencer
acc7 <= acc6;
fin
if (CMSB)
commencer
<= ~ Cosout temp1 1;
fin
d'autre
commencer
<Cosout = temp1;
fin
fin
sin romsin (. adresse (ACC4). inclock (CLK),. q (temp));
cos romsin (. adresse (acc7). inclock (CLK),. q (temp1));
endmodule
le nombre de ROM a été 2 ^ 8, environ 1 / 4 sine
les données a été obtenu par sine matlab x = 0h02 * pi/1024: 2 * 255 * pi/1024;
y = round (sin (x) * 127)
quand simulé la forme d'onde, j'ai trouvé que les résultats du Sine et du COS ne sont pas mes besoins quand acc2 était égal à 256 ou 768, lorsque acc2 est égal à 256, la sortie du Sine était de 127 et 0, mais ce dont j'ai besoin devrait être 127.127 ;
c'est-à-dire qu'il ya certains probloms avec mon programm, mais je ne sais pas comment régler le problème
plz.m'aider, Merci beaucoup
module DDS7 (fc, PC, CLK, RSTN, sinout, out, cosout);
sortie [07:00 sinout], cosout;
sortie [09:00] à;
entrée [09:00] fc / / fc est fréq.mot contrôlée
entrée [07:00] pc; / / PC est contrôlé de phase mot
clk entrée, RSTN;
reg [07:00] sinout, cosout;
reg [09:00] acc0, ACC1, acc2, acc5;
reg [07:00] ACC3, ACC4, acc6, acc7, temp, temp1;
reg [00:00] MSB, smsb, spipe, spipe1;
reg [00:00] CMSB, csmsb, cpipe, cpipe1;
toujours @ (posedge CLK)
commencer
if (! RSTN)
commencer
acc0 <= 10'b0000000000;
ACC1 <= 10'b0000000000;
ACC2 <= 10'b0000000000;
ACC3 <= 8'b00000000;
acc6 <= 8'b00000000;
MSB <= 1'b0;
smsb <= 1'b0;
CMSB <= 1'b0;
csmsb <= 1'b0;
<= Spipe 1'b0;
<= Cpipe 1'b0;
spipe1 <= 1'b0;
cpipe1 <= 1'b0;
fin
d'autre
commencer
acc0 <= ACC1 fc;
ACC1 <= acc0;
ACC2 <= ACC1 pc;
acc5 <= acc2 256;
acc6 <= acc5 [07:00];
ACC3 <= acc2 [07:00];
<= Spipe acc2 [9];
spipe1 <= spipe; / / pipeline rempli
<MSB = spipe1;
<= Smsb acc2 [8];
<= Cpipe acc5 [9];
cpipe1 <= cpipe;
<= CMSB cpipe1;
<= Csmsb acc5 [8];
fin
fin
toujours @ (posedge CLK)
commencer
if (smsb)
commencer
if ((acc2 == 256) | | (acc2 == 768))
commencer
ACC4 <= ~ ACC3;
fin
d'autre
commencer
ACC4 <= ~ ACC3 1;
fin
fin
d'autre
commencer
ACC4 <= ACC3;
fin
if (MSB)
commencer
<Sinout = ~ temp 1;
fin
d'autre
commencer
<Sinout = temp;
fin
if (csmsb)
commencer
if ((acc5 == 256) | | (acc5 == 768))
commencer
acc7 <= ~ acc6;
fin
d'autre
commencer
acc7 <= ~ acc6 1;
fin
fin
d'autre
commencer
acc7 <= acc6;
fin
if (CMSB)
commencer
<= ~ Cosout temp1 1;
fin
d'autre
commencer
<Cosout = temp1;
fin
fin
sin romsin (. adresse (ACC4). inclock (CLK),. q (temp));
cos romsin (. adresse (acc7). inclock (CLK),. q (temp1));
endmodule
le nombre de ROM a été 2 ^ 8, environ 1 / 4 sine
les données a été obtenu par sine matlab x = 0h02 * pi/1024: 2 * 255 * pi/1024;
y = round (sin (x) * 127)
quand simulé la forme d'onde, j'ai trouvé que les résultats du Sine et du COS ne sont pas mes besoins quand acc2 était égal à 256 ou 768, lorsque acc2 est égal à 256, la sortie du Sine était de 127 et 0, mais ce dont j'ai besoin devrait être 127.127 ;
c'est-à-dire qu'il ya certains probloms avec mon programm, mais je ne sais pas comment régler le problème
plz.m'aider, Merci beaucoup