attuazione CRC32 in ETHERNET: modo esatto

D

dilan2005

Guest
salve,

Ho bisogno di sapere come ottenere FCS ethernet!

Posso implementare CRC32 generici, ma ci sono alcune altre cose particolari da fare prima che i dati messi al generatore CRC32 e dopo Gert CRC32 checksum del generatore alcune inversioni di bit / integrazionenessuno può darmi una forma breve punto il processo di installazione dei pacchetti Ethernet.
(NO necessità di spiegare crc32 processo gen)

Se si può spiegare i seguenti pacchetti Ethernet e come finale FCS formato è molto meglio.
55 55 55 55 55 55 55 D5 / / inizio del frame

00 0A E6 F0 05 A3 00 12 34 56 78 90 08 00 45 00 00 30 B3 FE 00 00 80 11 72 BA 0A 00 00 03 0A 00 00 02 04 00 04 00 00 1C 89 4D 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13

D5 7A 6B B3 / / frame checksum

Grazie!
saluti
dilan

 
Prova questo programma in C.Esso presuppone 'int' è a 32 bit e 'char' è di 8 bit.

L'output del programma è il seguente: 7A D5 6B B3

Codice:

# include <stdio.h>int main ()

(

unsigned char dati [] =

(

0x00, 0x0A, 0xE6, 0xF0, 0x05, 0xA3, 0x00, 0x12,

0x34, 0x56, 0x78, 0x90, 0x08, 0x00, 0x45, 0x00,

0x00, 0x30, 0xB3, 0xFE, 0x00, 0x00, 0x80, 0x11,

0x72, 0xBA, 0x0A, 0x00, 0x00, 0x03, 0x0A, 0x00,

0x00, 0x02, 0x04, 0x00, 0x04, 0x00, 0x00, 0x1C,

0x89, 0x4D, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,

0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D,

0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13

);

unsigned int crc_table [] =

(

0x4DBDF21C, 0x500AE278, 0x76D3D2D4, 0x6B64C2B0,

0x3B61B38C, 0x26D6A3E8, 0x000F9344, 0x1DB88320,

0xA005713C, 0xBDB26158, 0x9B6B51F4, 0x86DC4190,

0xD6D930AC, 0xCB6E20C8, 0xEDB71064, 0xF0000000

);

unsigned int n, crc = 0;for (n = 0; n <sizeof (dati); n )

(

crc = (crc>> 4) ^ crc_table [(CRC ^ (dati [n]>> 0)) & 0x0F]; / * nibble inferiore * /

crc = (crc>> 4) ^ crc_table [(CRC ^ (dati [n]>> 4)) & 0x0F]; / * nibble superiore * /

)

for (n = 0; n <4; n ) / * visualizza la CRC, inferiori primo byte * /

(

printf ( "% 02X", CRC & 0xff);

crc>> = 8;

)

printf ( "\ n");

return 0;

)
 
thank you very much echo47, andrò tramite il codice
rgds
dilan

 
FCS il valore è calcolato in funzione del contenuto delle indirizzo sorgente, indirizzo di destinazione, il tipo / lunghezza e dati (ad esempio, tutti i campi ad eccezione del preambolo, SFD, FCS, e l'estensione).
Qui è possibile trovare ulteriori informazioni (pagina 16):
http://www.analog.com/UploadedFiles/Application_Notes/458197465EE269v01.pdf
e questo
http://www.lammertbies.nl/comm/info/crc-calculation.html
e questo
http://www.easics.be/webtools/crctool
può essere utile per voi.

 
grazie benradu.

documentazione di anlog dispositivi di aiuto much.try il vostro passo di sé con l'esempio e calucaltor online, doesent work.i constatato che da un altro forum "CRC32 AUTODIN II" algo devono essere used.i dont 'know sopra c programma algo nome

alcun modo, ho cercato di applicare sopra c codice Verilog, ma mi danno torto answer.can qualsiasi controllo uno seguente codice Verilog per me

Codice:FCS_CAL modulo (clk, dati, attivare, crc_out, reset);

input clk;input [7:0] dati;

ingresso enable;

ingresso di reset;output [31:0] crc_out;reg [31:0] crc_out;

reg [3:0] crc_table_adr;

reg [31:0] crc_table_data;sempre @ (crc_table_adr) begin

caso (crc_table_adr)

4'h0: crc_table_data = 32'h4DBDF21C;

4'h1: crc_table_data = 32'h500AE278;

4'h2: crc_table_data = 32'h76D3D2D4;

4'h3: crc_table_data = 32'h6B64C2B0;

4'h4: crc_table_data = 32'h3B61B38C;

4'h5: crc_table_data = 32'h26D6A3E8;

4'h6: crc_table_data = 32'h000F9344;

4'h7: crc_table_data = 32'h1DB88320;

4'h8: crc_table_data = 32'hA005713C;

4'h9: crc_table_data = 32'hBDB26158;

4'hA: crc_table_data = 32'h9B6B51F4;

4'hB: crc_table_data = 32'h86DC4190;

4'hC: crc_table_data = 32'hD6D930AC;

4'hD: crc_table_data = 32'hCB6E20C8;

4'hE: crc_table_data = 32'hEDB71064;

4'hF: crc_table_data = 32'hF0000000;endcase

finesempre @ (posedge clk) begin

if (reset == 1 & & consentire == 0) crc_out = 32'h00000000;if (reset == 0 & & consentire == 1) begin/ / crc = (crc>> 4) ^ crc_table [(CRC ^ (dati [n]>> 0)) & 0x0F]; / * nibble inferiore * /crc_table_adr = crc_out [3:0] ^ data1 [3:0];

# 100 crc_out = (crc_out>> 4) ^ crc_table_data;/ / crc = (crc>> 4) ^ crc_table [(CRC ^ (dati [n]>> 4)) & 0x0F]; / * nibble superiore * /crc_table_adr = crc_out [3:0] ^ data1 [7:4];

d_out = crc_table_adr;

# 100 crc_out = (crc_out>> 4) ^ crc_table_data;

finefine

endmodule

 
Ci dispiace, ma non so Verilog troppo.
Ho usato lo strumento CRC (il terzo link che ti ho dato) per generare un pacchetto VHDL.
Ho usato questo in un progetto e grandi opere.
Lo strumento di calcolo online CRC funziona anche bene per me.Io lo uso per tutto il tempo ho bisogno di raddoppiare il controllo di un CRC.
Ecco il pacchetto VHDL
Codice:-------------------------------------------------- ---------------------

- File: PCK_CRC32_D8.vhd

- Date: Mon Oct 29 15:04:32 2007

--

- Copyright (C) 1999-2003 Easics NV.

- Questo file sorgente può essere usato e distribuito senza limitazioni

- A condizione che questa dichiarazione di copyright non viene rimosso dal file

- E che ogni opera derivata contiene l'avviso del copyright

- E il disclaimer associati.

--

- Questo file di origine È FORNITO "COSÌ COM'È" E SENZA ALCUNA ESPRESSA

- O GARANZIE IMPLICITE, INCLUSE, SENZA LIMITAZIONI, IL SILENZIO

- GARANZIE DI COMMERCIABILITÀ E IDONEITÀ PER UNO SCOPO PARTICOLARE.

--

- Oggetto: VHDL pacchetto contenente una funzione CRC sintetizzabile

- * Polinomio: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)

- * Larghezza di dati: 8

--

- Strumenti Info: (a) easics.be

- Http://www.easics.com

-------------------------------------------------- ---------------------library IEEE;

uso IEEE.std_logic_1164.ali;PCK_CRC32_D8 pacchetto è- Polinomio: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)

- Ampiezza dati: 8

- Convenzione: la prima serie di dati bit è D (7)

funzione nextCRC32_D8

(Data: std_logic_vector (7 downto 0);

CRC: std_logic_vector (31 downto 0))

return std_logic_vector;fine PCK_CRC32_D8;library IEEE;

uso IEEE.std_logic_1164.ali;PCK_CRC32_D8 corpo pacchetto è- Polinomio: (0 1 2 4 5 7 8 10 11 12 16 22 23 26 32)

- Ampiezza dati: 8

- Convenzione: la prima serie di dati bit è D (7)

funzione nextCRC32_D8

(Data: std_logic_vector (7 downto 0);

CRC: std_logic_vector (31 downto 0))

std_logic_vector di ritorno èvariabile D: std_logic_vector (7 downto 0);

variabile C: std_logic_vector (31 downto 0);

variabile NewCRC: std_logic_vector (31 downto 0);iniziareD: = Data;

C: = CRC;NewCRC (0): = D (6) XOR D (0) XOR C (24) XOR C (30);

NewCRC (1): = D (7) xor D (6) xor D (1) XOR D (0) XOR C (24) XOR C (25) xor

C (30) XOR C (31);

NewCRC (2): = D (7) xor D (6) xor D (2) xor D (1) XOR D (0) XOR C (24) xor

C (25) XOR C (26) XOR C (30) XOR C (31);

NewCRC (3): = D (7) xor D (3) xor D (2) xor D (1) XOR C (25) XOR C (26) xor

C (27) XOR C (31);

NewCRC (4): = D (6) xor D (4) xor D (3) xor D (2) XOR D (0) XOR C (24) xor

C (26) XOR C (27) XOR C (28) XOR C (30);

NewCRC (5): = D (7) xor D (6) xor D (5) xor D (4) xor D (3) xor D (1) xor

D (0) XOR C (24) XOR C (25) XOR C (27) XOR C (28) XOR C (29) xor

C (30) XOR C (31);

NewCRC (6): = D (7) xor D (6) xor D (5) xor D (4) xor D (2) xor D (1) xor

C (25) XOR C (26) XOR C (28) XOR C (29) XOR C (30) XOR C (31);

NewCRC (7): = D (7) xor D (5) xor D (3) xor D (2) XOR D (0) XOR C (24) xor

C (26) XOR C (27) XOR C (29) XOR C (31);

NewCRC (8): D = (4) xor D (3) xor D (1) XOR D (0) XOR C (0) XOR C (24) xor

C (25) XOR C (27) XOR C (28);

NewCRC (9): = D (5) xor D (4) xor D (2) xor D (1) XOR C (1) XOR C (25) xor

C (26) XOR C (28) XOR C (29);

NewCRC (10): = D (5) xor D (3) xor D (2) XOR D (0) XOR C (2) XOR C (24) xor

C (26) XOR C (27) XOR C (29);

NewCRC (11): = D (4) xor D (3) xor D (1) XOR D (0) XOR C (3) XOR C (24) xor

C (25) XOR C (27) XOR C (28);

NewCRC (12): = D (6) xor D (5) xor D (4) xor D (2) xor D (1) XOR D (0) xor

C (4) XOR C (24) XOR C (25) XOR C (26) XOR C (28) XOR C (29) xor

C (30);

NewCRC (13): = D (7) xor D (6) xor D (5) xor D (3) xor D (2) xor D (1) xor

C (5) XOR C (25) XOR C (26) XOR C (27) XOR C (29) XOR C (30) xor

C (31);

NewCRC (14): = D (7) xor D (6) xor D (4) xor D (3) xor D (2) XOR C (6) xor

C (26) XOR C (27) XOR C (28) XOR C (30) XOR C (31);

NewCRC (15): = D (7) xor D (5) xor D (4) xor D (3) XOR C (7) XOR C (27) xor

C (28) XOR C (29) XOR C (31);

NewCRC (16): = D (5) xor D (4) XOR D (0) XOR C (8) XOR C (24) XOR C (28) xor

C (29);

NewCRC (17): = D (6) xor D (5) xor D (1) XOR C (9) XOR C (25) XOR C (29) xor

C (30);

NewCRC (18): = D (7) xor D (6) xor D (2) XOR C (10) XOR C (26) XOR C (30) xor

C (31);

NewCRC (19): = D (7) xor D (3) XOR C (11) XOR C (27) XOR C (31);

NewCRC (20): = D (4) XOR C (12) XOR C (28);

NewCRC (21): = D (5) XOR C (13) XOR C (29);

NewCRC (22): = D (0) XOR C (14) XOR C (24);

NewCRC (23): = D (6) xor D (1) XOR D (0) XOR C (15) XOR C (24) XOR C (25) xor

C (30);

NewCRC (24): = D (7) xor D (2) xor D (1) XOR C (16) XOR C (25) XOR C (26) xor

C (31);

NewCRC (25): = D (3) xor D (2) XOR C (17) XOR C (26) XOR C (27);

NewCRC (26): = D (6) xor D (4) xor D (3) XOR D (0) XOR C (18) XOR C (24) xor

C (27) XOR C (28) XOR C (30);

NewCRC (27): = D (7) xor D (5) xor D (4) xor D (1) XOR C (19) XOR C (25) xor

C (28) XOR C (29) XOR C (31);

NewCRC (28): = D (6) xor D (5) xor D (2) XOR C (20) XOR C (26) XOR C (29) xor

C (30);

NewCRC (29): = D (7) xor D (6) xor D (3) XOR C (21) XOR C (27) XOR C (30) xor

C (31);

NewCRC (30): = D (7) xor D (4) XOR C (22) XOR C (28) XOR C (31);

NewCRC (31): = D (5) XOR C (23) XOR C (29);return NewCRC;fine nextCRC32_D8;fine PCK_CRC32_D8;
 
Hi dilan2005, non ho tempo adesso di studiare il codice, mi spiace, ma quelli '=' incarichi di blocco e # 100 ritardi non sono buone in stile Verilog sintetizzabile.Provare a scrivere codice completamente sincrono, e forse il problema scomparirà.Buona fortuna.

 
grazie a tutti per avermi aiutato a this.sick di crc ora e cercare di fare il bussiness il modo originale. sezione specifica IEEE802.3 1,Ho scritto di codice seguente per i testCodice:`1ns tempi / 1PSCCCC modulo (clk, CRC_out);

input clk;

output [31:0] CRC_out;

reg [31:0] CRC_out;

reg [32:0] CRCPoly;

reg [32:0] CRC, crc_temp;

reg [7:0] j, k;

reg [15:0] temp_buf;

reg [7:0] Inbuff [90:0];

reg first_time;sempre @ (posedge clk) beginInbuff [0] = 8'h55;

Inbuff [1] = 8'h55;

Inbuff [2] = 8'h55;

Inbuff [3] = 8'h55;

Inbuff [4] = 8'h55;

Inbuff [5] = 8'h55;

Inbuff [6] = 8'h55;

Inbuff [7] = 8'hD5;Inbuff [8] = 8'h00; / FF / non invertita

Inbuff [9] = 8'h0A; / / non inveted AF

Inbuff [10] = 8'hE6; / / ~ inverterd 98

Inbuff [11] = 8'hF0; / / ~ F0 invertitaInbuff [12] = 8'h05;

Inbuff [13] = 8'hA3;

Inbuff [14] = 8'h00;

Inbuff [15] = 8'h12;

Inbuff [16] = 8'h34;

Inbuff [17] = 8'h56;

Inbuff [18] = 8'h78;

Inbuff [19] = 8'h90;

Inbuff [20] = 8'h08;

Inbuff [21] = 8'h00;

Inbuff [22] = 8'h45;

Inbuff [23] = 8'h00;

Inbuff [24] = 8'h00;

Inbuff [25] = 8'h30;

Inbuff [26] = 8'hB3;

Inbuff [27] = 8'hFE;

Inbuff [28] = 8'h00;

Inbuff [29] = 8'h00;

Inbuff [30] = 8'h80;

Inbuff [31] = 8'h11;

Inbuff [32] = 8'h72;

Inbuff [33] = 8'hBA;

Inbuff [34] = 8'h0A;

Inbuff [35] = 8'h00;

Inbuff [36] = 8'h00;

Inbuff [37] = 8'h03;

Inbuff [38] = 8'h0A;

Inbuff [39] = 8'h00;

Inbuff [40] = 8'h00;

Inbuff [41] = 8'h02;

Inbuff [42] = 8'h04;

Inbuff [43] = 8'h00;

Inbuff [44] = 8'h04;

Inbuff [45] = 8'h00;

Inbuff [46] = 8'h00;

Inbuff [47] = 8'h1C;

Inbuff [48] = 8'h89;

Inbuff [49] = 8'h4D;

Inbuff [50] = 8'h00;

Inbuff [51] = 8'h01;

Inbuff [52] = 8'h02;

Inbuff [53] = 8'h03;

Inbuff [54] = 8'h04;

Inbuff [55] = 8'h05;

Inbuff [56] = 8'h06;

Inbuff [57] = 8'h07;

Inbuff [58] = 8'h08;

Inbuff [59] = 8'h09;

Inbuff [60] = 8'h0A;

Inbuff [61] = 8'h0B;

Inbuff [62] = 8'h0C;

Inbuff [63] = 8'h0D;

Inbuff [64] = 8'h0E;

Inbuff [65] = 8'h0F;

Inbuff [66] = 8'h10;

Inbuff [67] = 8'h11;

Inbuff [68] = 8'h12;

Inbuff [69] = 8'h13;

Inbuff [70] = 8'h00;

Inbuff [71] = 8'h00; / / 7AD5;

Inbuff [72] = 8'h00;

Inbuff [73] = 8'h00; / / 6BB3;CRCPoly = 33'b100000100110000010001110110110111;

CRC [32:0] = 33'h0FFAF98F0; / / IEEE chiesto di integrare 32bits prima di mettere al generatore di CRCfor (j = 12; j <= 69; j = j 1) begin

for (k = 0; k <= 7; k = k 1) begin

= temp_buf Inbuff [j];CRC = (CRC [32:1], temp_buf [k]); / / LSB messo al primo gen crcif (CRC [32] == 1'b1) CRC = CRC ^ CRCPoly;

fine

fine

CRC_out = ~ CRC [31:0];

fine

endmodule

 
Non ho studiato il modulo cccc, ma quelli 'per il' loop stanno cercando di calcolare il CRC del pacchetto intero in un ciclo di clock.

Provare questa versione Verilog del mio esempio C.Il 'pulse pronta' individua il valore di CRC finale:
Codice:

Top Module (clk, CRC, pronto);

input clk;

reg [7:0] dati [0:69];

reg [6:0] addr = 8;

wire [31:0] crc1, crc2;

reg output [31:0] crc = 0;

uscita reg pronto = 0;iniziale di iniziare

data [0] = 8'h55; dati [1] = 8'h55; data [2] = 8'h55; dati [3] = 8'h55;

data [4] = 8'h55; dati [5] = 8'h55; dati [6] = 8'h55; dati [7] = 8'hD5;

dati [8] = 8'h00; dati [9] = 8'h0A; dati [10] = 8'hE6; dati [11] = 8'hF0;

data [12] = 8'h05; dati [13] = 8'hA3; dati [14] = 8'h00; dati [15] = 8'h12;

data [16] = 8'h34; dati [17] = 8'h56; dati [18] = 8'h78; dati [19] = 8'h90;

data [20] = 8'h08; dati [21] = 8'h00; dati [22] = 8'h45; dati [23] = 8'h00;

data [24] = 8'h00; dati [25] = 8'h30; dati [26] = 8'hB3; dati [27] = 8'hFE;

data [28] = 8'h00; dati [29] = 8'h00; dati [30] = 8'h80; dati [31] = 8'h11;

data [32] = 8'h72; dati [33] = 8'hBA; dati [34] = 8'h0A; dati [35] = 8'h00;

data [36] = 8'h00; dati [37] = 8'h03; dati [38] = 8'h0A; dati [39] = 8'h00;

data [40] = 8'h00; dati [41] = 8'h02; dati [42] = 8'h04; dati [43] = 8'h00;

data [44] = 8'h04; dati [45] = 8'h00; dati [46] = 8'h00; dati [47] = 8'h1C;

data [48] = 8'h89; dati [49] = 8'h4D; dati [50] = 8'h00; dati [51] = 8'h01;

data [52] = 8'h02; dati [53] = 8'h03; dati [54] = 8'h04; dati [55] = 8'h05;

data [56] = 8'h06; dati [57] = 8'h07; dati [58] = 8'h08; dati [59] = 8'h09;

data [60] = 8'h0A; dati [61] = 8'h0B; dati [62] = 8'h0C; dati [63] = 8'h0D;

data [64] = 8'h0E; dati [65] = 8'h0F; dati [66] = 8'h10; dati [67] = 8'h11;

data [68] = 8'h12; dati [69] = 8'h13;

finefunction [31:0] crc_table;

input [3:0] addr;

caso (addr)

0: crc_table = 32'h4DBDF21C;

1: crc_table = 32'h500AE278;

2: crc_table = 32'h76D3D2D4;

3: crc_table = 32'h6B64C2B0;

4: crc_table = 32'h3B61B38C;

5: crc_table = 32'h26D6A3E8;

6: crc_table = 32'h000F9344;

7: crc_table = 32'h1DB88320;

8: crc_table = 32'hA005713C;

9: crc_table = 32'hBDB26158;

10: crc_table = 32'h9B6B51F4;

11: crc_table = 32'h86DC4190;

12: crc_table = 32'hD6D930AC;

13: crc_table = 32'hCB6E20C8;

14: crc_table = 32'hEDB71064;

15: crc_table = 32'hF0000000;

default: crc_table = 32'bx;

endcase

EndFunctionassegnare crc1 = CRC [31:4] ^ crc_table (CRC [3:0] ^ dati [addr] [3:0]);

assegnare crc2 = crc1 [31:4] ^ crc_table (crc1 [3:0] ^ dati [addr] [7:4]);sempre @ (posedge clk) begin

crc <= crc2;

addr <= addr 1;

ready <= (addr == 69);

fine

endmodule
 
grazie.

<img src="http://www.edaboard.com/images/smiles/icon_biggrin.gif" alt="Very Happy" border="0" />

echo47 che le grandi opere: Di saranno in grado di finire la mia parte tx pacchetto UDP oggi.

come passare attraverso il tuo codice mi sento che mi manca qualche codifica practices.is Esiste un modo per migliorare il mio stile di codifica Verilog. (libri, siti)

Grazie
rgds
dilan

 
finalmente in grado di scrivere il mio semplice modulo TX Ethernet MAC con crc.i davvero apprciate sostegno dato dai ragazzi sul forum.un ringraziamento speciale a echo47 usando il suo codice Verilog i suoi è stato in grado di generare CRC sul fly.and mettere il risultato al PHY.i registreremo il mio pulizia Verilog codice sorgente del mio semplice tx ETH presto.

 

Welcome to EDABoard.com

Sponsor

Back
Top