m'aider à faire face à la programm

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

 
Pouvez-vous s'il vous plaît expliquer ce que tout ce que le code essaie de faire?Un DDS a normalement un accumulateur plus quelques lignes de code pour la recherche de table et de modulation de phase.Un peu comme ceci:
Code:

Haut module (CLK, reset, FC, PC, sinout, cosout);

clk entrée, la remise;

entrée [09:00] CF, PC;

reg [09:00] acc0, phase;

reg [07:00] péché [0:255], cos [0:255]; / / initialisation de ces quelque sorte

reg de sortie [07:00] sinout, cosout;toujours @ (posedge CLK) commencent

acc0 <= reset?
0: acc0 fc;

<= Phase acc0 pc;

<= Sinout phase [péché [09:02]];

<Cosout = cos [phase [09:02]];

fin

endmodule

 
Vérifiez si cela fonctionne pour vous!
Hope this helps!

Code:

module DDS7 (fc, PC, CLK, RSTN, sinout, out, cosout);

sortie [08: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 [08:00] sinout, cosout;

reg [09:00] acc0, ACC1, acc2, acc5;

reg [07:00] ACC3, ACC4, acc6, acc7;

fils [07:00 temp], temp1;

reg [00:00] MSB, smsb, spipe, spipe1;

reg [00:00] CMSB, csmsb, cpipe, cpipe1;toujours @ (posedge CLK) commencent

if (! RSTN) commencent

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;

END ELSE BEGIN

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)toujours @ (posedge CLK) commencent

if (smsb / * acc2 [8] * /)

ACC4 <= ~ ACC3;

d'autre

ACC4 <= ACC3;if (spipe / * acc2 [9] * /)

<Sinout = ~ temp 1;

d'autre

<Sinout = temp;if (csmsb / * acc5 [8] * /)

acc7 <= ~ acc6;

d'autre

acc7 <= acc6;if (cpipe / * acc5 [9] * /)

<= ~ Cosout temp1 1;

d'autre

<Cosout = temp1;

fin / / @ toujours (posedge CLK)

sin romsin (. adresse (ACC4). inclock (CLK),. q (temp));

cos romsin (. adresse (acc7). inclock (CLK),. q (temp1));

endmodule / / DDS7

 
Merci beaucoup

à nand_gates: droit ur, c'est ok!Je vous remercie!Ajouté après 26 minutes:à echo47: Je suis désolé, parce que je suis une nouvelle et mon anglais n'est pas bon,

Je ne sais pas la règle, mais en fait je suis moi-même l'amélioration de maintenant.Merci pour ton conseille!

 

Welcome to EDABoard.com

Sponsor

Back
Top