@@ -84,21 +84,24 @@ module PcapParser
84
84
// fields of interest are U32 so bear in mind the byte ordering when assembling
85
85
// multibyte fields
86
86
r = $fread(packet_header, file);
87
- if (swapped == 1 ) begin
88
- pktSz = {packet_header[11 ],packet_header[10 ],packet_header[9 ] ,packet_header[8 ] };
89
- diskSz = {packet_header[15 ],packet_header[14 ],packet_header[13 ],packet_header[12 ]};
90
- end else begin
91
- pktSz = {packet_header[ 8 ],packet_header[ 9 ],packet_header[10 ],packet_header[11 ]};
92
- diskSz = {packet_header[12 ],packet_header[13 ],packet_header[14 ],packet_header[15 ]};
93
- end
87
+ eof = $feof(file);
94
88
95
- $display (" packet %0d: incl_length %0d orig_length %0d" , pktcount, pktSz, diskSz );
89
+ if ( eof == 0 ) begin
90
+ if (swapped == 1 ) begin
91
+ pktSz = {packet_header[11 ],packet_header[10 ],packet_header[9 ] ,packet_header[8 ] };
92
+ diskSz = {packet_header[15 ],packet_header[14 ],packet_header[13 ],packet_header[12 ]};
93
+ end else begin
94
+ pktSz = {packet_header[ 8 ],packet_header[ 9 ],packet_header[10 ],packet_header[11 ]};
95
+ diskSz = {packet_header[12 ],packet_header[13 ],packet_header[14 ],packet_header[15 ]};
96
+ end
96
97
97
- available <= 1 ;
98
- newpkt <= 1 ;
99
- pktcount <= pktcount + 1 ;
100
- countIPG <= ipg; // reload interpacket gap counter
98
+ $display (" packet %0d: incl_length %0d orig_length %0d eof %0d" , pktcount, pktSz, diskSz, eof );
101
99
100
+ available <= 1 ;
101
+ newpkt <= 1 ;
102
+ pktcount <= pktcount + 1 ;
103
+ countIPG <= ipg; // reload interpacket gap counter
104
+ end
102
105
end else if ( diskSz > 0 ) begin
103
106
104
107
// packet content is byte-aligned, no swapping required
0 commit comments