Hvordan sette biblioteket funksjonen til å finne summen .....

S

Sreya39

Guest
Hei,
Jeg ønsker å finne variansen 20 nummer .... For det første jeg nødt til å finne summen av 20 nos .....Jeg har gitt min Verilog koden nedenfor.Det er ingen syntese feil .... men jeg får ikke summen .....Betyr det fungerer hvis biblioteket fil (aritmetikk) er inkludert ...
I så fall hvordan å inkludere biblioteket fungere.
Eller det anyother måte å løse dette problemet ....
hjelpe meg behage ...

Takk og hilsen
Remya: |

<img src="http://www.edaboard.com/images/smiles/icon_neutral.gif" alt="Nøytral" border="0" /><img src="http://www.edaboard.com/images/smiles/icon_neutral.gif" alt="Nøytral" border="0" />modul meansum (klokke, Enable, corrouti1, corrouti2, corrouti3, corrouti4, corrouti5, corrouti6, corrouti7,
corrouti8, corrouti9, corrouti10, corrouti11, corrouti12, corrouti13, corrouti14, corrouti15,
corrouti16, corrouti17, corrouti18, corrouti19, corrouti20, sum);
input clock, Aktiver;
input [9:0] corrouti1, corrouti2, corrouti3, corrouti4, corrouti5, corrouti6, corrouti7,
corrouti8, corrouti9, corrouti10, corrouti11, corrouti12, corrouti13, corrouti14, corrouti15,
corrouti16, corrouti17, corrouti18, corrouti19, corrouti20;
output [9:0] sum;
reg [14:0] sum;
innledende sum = 0;
reg [9:0] R1 [0:19];
heltall i;
alltid @ (posedge klokke) begin
if (Aktiver)
r1 [0] = corrouti1;
r1 [1] = corrouti2;
r1 [2] = corrouti3;
r1 [3] = corrouti4;
r1 [4] = corrouti5;
r1 [5] = corrouti6;
r1 [6] = corrouti7;
r1 [7] = corrouti8;
r1 [8] = corrouti9;
r1 [9] = corrouti10;
r1 [10] = corrouti11;
r1 [11] = corrouti12;
r1 [12] = corrouti13;
r1 [13] = corrouti14;
r1 [14] = corrouti15;
r1 [15] = corrouti16;
r1 [16] = corrouti17;
r1 [17] = corrouti18;
r1 [18] = corrouti19;
r1 [19] = corrouti20;
slutt
alltid @ (posedge klokke) begin
i = 0;
while (i <20) begynne
tildele sum = sum r1 ;
i = i 1;
slutt
slutt
endmodule

 
Først av alt ur gjør feil angående register størrelse

U r prøver å legge til 20; "10 bit" nos og u har tildelt bare 10 bits lengde sum utgang.input [9:0] corrouti1, corrouti2,

?????????????????????

output [9:0] sum;
?????????????????????Så først av alt øker ur produksjonen lengde på minst 16 * output [15:0] sum;Dessuten gjør chk om mens er synthesizable

og summere alle de 20 nos, tror jeg, dont gå i detalj for å skrive kode
bare skrive expressinon
sum = corrouti1 corrouti2 ................... corrouti19 corrouti20;

Hva jeg mener er at prosjektet navigator bør replave tegnet med huggorm circuitary.Prøv det.Jeg håper det skal fungere
* (binære - 1111111111> 1023 - desimal) og (1023 * 20> 20460) slik at summen skal kunne romme 20460 som worst case senario

 

Welcome to EDABoard.com

Sponsor

Back
Top