otsdaq_prepmodernization  v2_05_02_indev
create_packet.vhd
1 -------------------------------------------------------------------------------
2 --
3 -- Title : Create Packet
4 -- Design : ethernet_controller
5 -- Author : Ryan Rivera
6 -- Company : FNAL
7 --
8 -------------------------------------------------------------------------------
9 --
10 -- File : d:\Projects\otsdaq\OtS Ethernet MAC firmware\ActiveHDL_proj\ethernet_controller\compile\create_packet.vhd
11 -- Generated : 02/29/16 11:09:21
12 -- From : d:/Projects/otsdaq/OtS Ethernet MAC firmware/ActiveHDL_proj/ethernet_controller/src/create_packet.asf
13 -- By : FSM2VHDL ver. 5.0.7.2
14 --
15 -------------------------------------------------------------------------------
16 --
17 -- Description :
18 --
19 -------------------------------------------------------------------------------
20 
21 library IEEE;
22 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_arith.all;
24 use IEEE.std_logic_unsigned.all;
25 
26 use work.params_package.all;
27 entity create_packet is
28  port (
29  addrs: in STD_LOGIC_VECTOR (31 downto 0);
30  arp_busy: in STD_LOGIC;
31  checksum: in STD_LOGIC_VECTOR (15 downto 0);
32  clk: in STD_LOGIC;
33  data_length: in STD_LOGIC_VECTOR (10 downto 0);
34  dest_ip: in STD_LOGIC_VECTOR (31 downto 0);
35  dest_mac: in STD_LOGIC_VECTOR (47 downto 0);
36  dest_port: in STD_LOGIC_VECTOR (15 downto 0);
37  four_bit_mode: in STD_LOGIC;
38  icmp_checksum: in STD_LOGIC_VECTOR (15 downto 0);
39  icmp_data: in STD_LOGIC_VECTOR (7 downto 0);
40  icmp_ip: in STD_LOGIC_VECTOR (31 downto 0);
41  icmp_mac: in STD_LOGIC_VECTOR (47 downto 0);
42  icmp_ping: in STD_LOGIC;
43  mac: in STD_LOGIC_VECTOR (47 downto 0);
44  ping: in STD_LOGIC;
45  reset: in STD_LOGIC;
46  trigger: in STD_LOGIC;
47  busy: out STD_LOGIC;
48  checksum_trig: out STD_LOGIC;
49  clken_out: out STD_LOGIC;
50  crc_gen_en: out STD_LOGIC;
51  crc_gen_init: out STD_LOGIC;
52  crc_gen_rd: out STD_LOGIC;
53  dataout: out STD_LOGIC_VECTOR (7 downto 0);
54  en_tx_data: out STD_LOGIC;
55  length_count_out: out STD_LOGIC_VECTOR (10 downto 0);
56  tx_en: out STD_LOGIC;
57  tx_er: out STD_LOGIC;
58  tx_icmp_packet: out STD_LOGIC;
59  udp_data_sel: out STD_LOGIC);
60 end create_packet;
61 
62 architecture create_packet_arch of create_packet is
63 
64 -- diagram signals declarations
65 signal clken: STD_LOGIC;
66 signal delay_count: INTEGER range 0 to 65535;
67 signal icmp_ping_packet: STD_LOGIC;
68 signal IP_length: STD_LOGIC_VECTOR (15 downto 0);
69 signal length_count: STD_LOGIC_VECTOR (10 downto 0);
70 signal ping_packet: STD_LOGIC;
71 signal sleep_count: INTEGER range 0 to 65535;
72 signal test_data: STD_LOGIC_VECTOR (7 downto 0);
73 signal trigger_sig: STD_LOGIC;
74 signal UDP_length: STD_LOGIC_VECTOR (15 downto 0);
75 signal zero_fill_count: STD_LOGIC_VECTOR (10 downto 0);
76 
77 -- SYMBOLIC ENCODED state machine: Sreg0
78 type Sreg0_type is (
79  SendPacket_Dest_S11, SendPacket_Dest_S12, SendPacket_Dest_S13, SendPacket_Dest_S14, SendPacket_Dest_S15, SendPacket_Src_S16, SendPacket_Src_S18,
80  SendPacket_Payload_IP_icmpProtocol, SendPacket_Src_S19, SendPacket_Src_S20, SendPacket_Src_S21, SendPacket_Src_S17, SendPacket_Type_S26,
81  SendPacket_Type_S29, SendPacket_Dest_S22, SendPacket_Payload_IP_TotLength2, SendPacket_Payload_IP_VersionAndHeader, SendPacket_Payload_IP_TotLength1,
82  SendPacket_Payload_IP_ToS1, SendPacket_Payload_UDP_SourcePort1, SendPacket_Payload_UDP_DestPort1, SendPacket_Payload_IP_ID2, SendPacket_Payload_IP_FlagsAndFrag,
83  SendPacket_Payload_IP_FragmentOffset, SendPacket_Payload_IP_icmpTotLength1, SendPacket_Payload_IP_TTL, SendPacket_Payload_IP_Protocol,
84  SendPacket_Payload_IP_Checksum1, SendPacket_Payload_IP_Checksum2, SendPacket_Payload_IP_SourceAddr1, SendPacket_Payload_IP_icmpTotLength2,
85  SendPacket_Payload_IP_SourceAddr2, SendPacket_Payload_IP_SourceAddr3, SendPacket_Payload_IP_ID1, SendPacket_Payload_IP_SourceAddr4,
86  SendPacket_Payload_IP_DestAddr1, SendPacket_Payload_IP_DestAddr2, SendPacket_Payload_IP_DestAddr3, SendPacket_Payload_IP_DestAddr4,
87  SendPacket_Payload_UDP_Length1, SendPacket_Payload_UDP_DestPort2, SendPacket_Payload_UDP_SourcePort2, SendPacket_Payload_UDP_Length2,
88  SendPacket_Payload_UDP_Checksum1, SendPacket_Payload_UDP_Checksum2, SendPacket_Payload_UDP_DataLoop, Idle, sleep, CheckBusy, SendPacket_Preamble_S58,
89  SendPacket_Preamble_S57, SendPacket_CRC_crc4, SendPacket_CRC_crc3, SendPacket_CRC_crc2, SendPacket_CRC_S59, SendPacket_CRC_crc1,
90  SendPacket_CRC_S1, SendPacket_Payload_ICMP_Type, SendPacket_Payload_ICMP_Code, SendPacket_Payload_ICMP_Checksum1, SendPacket_Payload_ICMP_ID1,
91  SendPacket_Payload_ICMP_Checksum2, SendPacket_Payload_ICMP_ID2, SendPacket_Payload_ICMP_SeqNum1, SendPacket_Payload_ICMP_SeqNum2,
92  SendPacket_Payload_ICMP_DataLoop, SendPacket_Dest_S60, SendPacket_Dest_S61, SendPacket_Dest_S62, SendPacket_Dest_S63, SendPacket_Dest_S64,
93  SendPacket_Dest_S65, SendPacket_Payload_IP_DestAddr6, SendPacket_Payload_IP_DestAddr5, SendPacket_Payload_IP_DestAddr8, SendPacket_Payload_IP_DestAddr7
94 );
95 -- attribute ENUM_ENCODING of Sreg0_type: type is ... -- enum_encoding attribute is not supported for symbolic encoding
96 
97 signal Sreg0: Sreg0_type;
98 
99 begin
100 
101 -- concurrent signals assignments
102 
103 -- Diagram ACTION
104 tx_icmp_packet <= icmp_ping_packet;
105 clken_out <= clken;
106 -- NOTE: expect trigger is a single clock width pulse (but it is not from Data Manager and seems to be OK)
107 trigger_sig <= trigger;
108 four_bit_proc : process (clk) -- make trigger sig a single clock width pulse
109 begin
110  if rising_edge(clk) then
111  if (four_bit_mode = '1') then
112  clken <= not clken;
113  else
114  clken <= '1';
115  end if;
116  end if;
117 end process;
118 zero_proc : process(clk)
119 begin
120  if rising_edge(clk) and clken = '1' then
121  if trigger_sig = '1' then
122  IP_length(15 downto 11) <= (others => '0');
123  IP_length(10 downto 0) <= data_length + x"1C";
124 -- IP length = actual data + 20 (IP header) + 8 (UDP header)
125  UDP_length(15 downto 11) <= (others => '0');
126  UDP_length(10 downto 0) <= data_length + x"08";
127 -- UDP length = actual data + 8 (UDP header)
128  if data_length < ("000"&x"12") then
129  zero_fill_count <= ("000"&x"12") - data_length;
130  else
131  zero_fill_count <= (others => '0');
132  end if;
133  elsif icmp_ping_packet = '1' then
134 -- note: for ICMP ping data_length input = ICMP length
135 -- ICMP length = actual data + 20 (IP header) + 8(ICMP header)
136  if data_length < 46 then
137  zero_fill_count <= 46 - data_length;
138  else
139  zero_fill_count <= (others => '0');
140  end if;
141  end if;
142  end if;
143 end process;
144 
145 ----------------------------------------------------------------------
146 -- Machine: Sreg0
147 ----------------------------------------------------------------------
148 Sreg0_machine: process (clk)
149 begin
150  if clk'event and clk = '1' then
151  if reset = '1' then
152  Sreg0 <= Idle;
153  -- Set default values for outputs, signals and variables
154  checksum_trig <= '0';
155  dataout <= x"00";
156  udp_data_sel <= '0';
157  -- used as select line for output mux and to
158 -- lock out arp responses
159  sleep_count <= 50;
160  -- for testing so not triggered twice by accident
161  en_tx_data <= '0';
162  -- a '1' indicates to the user to provide data on
163 -- user_tx_data_in(7:0) starting on the next rising edge and
164 -- continuing on every clock until data is exhausted
165  busy <= '0';
166  -- if set, indicates that trigger will be ignored
167  tx_er <= '0';
168  tx_en <= '0';
169  crc_gen_en <= '0';
170  crc_gen_init <= '0';
171  crc_gen_rd <= '0';
172  ping_packet <= '0';
173  icmp_ping_packet <= '0';
174  else
175  if clken = '1' then
176  -- Set default values for outputs, signals and variables
177  checksum_trig <= '0';
178  case Sreg0 is
179  when Idle =>
180  dataout <= x"00";
181  udp_data_sel <= '0';
182  -- used as select line for output mux and to
183  -- lock out arp responses
184  sleep_count <= 50;
185  -- for testing so not triggered twice by accident
186  en_tx_data <= '0';
187  -- a '1' indicates to the user to provide data on
188  -- user_tx_data_in(7:0) starting on the next rising edge and
189  -- continuing on every clock until data is exhausted
190  busy <= '0';
191  -- if set, indicates that trigger will be ignored
192  tx_er <= '0';
193  tx_en <= '0';
194  crc_gen_en <= '0';
195  crc_gen_init <= '0';
196  crc_gen_rd <= '0';
197  ping_packet <= '0';
198  icmp_ping_packet <= '0';
199  if trigger_sig = '1' then
200  Sreg0 <= CheckBusy;
201  length_count <= data_length;
202  busy <= '1';
203  if ping = '1' then
204  ping_packet <= '1';
205  end if;
206  if icmp_ping = '1' then
207  icmp_ping_packet <= '1';
208  end if;
209  end if;
210  when sleep =>
211  sleep_count <= sleep_count - 1;
212  udp_data_sel <= '0';
213  if sleep_count = 1 then
214  Sreg0 <= Idle;
215  end if;
216  when CheckBusy =>
217  if arp_busy = '0' then
218  Sreg0 <= SendPacket_Preamble_S57;
219  udp_data_sel <= '1';
220  --sel mux output
221  crc_gen_init <= '1';
222  -- init crc
223  delay_count <= 7;
224  end if;
225  when SendPacket_Dest_S11 =>
226  dataout <= dest_mac(39 downto 32);
227  Sreg0 <= SendPacket_Dest_S12;
228  when SendPacket_Dest_S12 =>
229  dataout <= dest_mac(31 downto 24);
230  Sreg0 <= SendPacket_Dest_S13;
231  when SendPacket_Dest_S13 =>
232  dataout <= dest_mac(23 downto 16);
233  Sreg0 <= SendPacket_Dest_S14;
234  when SendPacket_Dest_S14 =>
235  dataout <= dest_mac(15 downto 8);
236  Sreg0 <= SendPacket_Dest_S15;
237  when SendPacket_Dest_S15 =>
238  dataout <= dest_mac(7 downto 0);
239  Sreg0 <= SendPacket_Src_S16;
240  when SendPacket_Dest_S22 =>
241  dataout <= dest_mac(47 downto 40);
242  --first byte of dest MAC
243  crc_gen_en <= '1';
244  Sreg0 <= SendPacket_Dest_S11;
245  when SendPacket_Dest_S60 =>
246  dataout <= icmp_mac(39 downto 32);
247  Sreg0 <= SendPacket_Dest_S61;
248  when SendPacket_Dest_S61 =>
249  dataout <= icmp_mac(31 downto 24);
250  Sreg0 <= SendPacket_Dest_S62;
251  when SendPacket_Dest_S62 =>
252  dataout <= icmp_mac(23 downto 16);
253  Sreg0 <= SendPacket_Dest_S63;
254  when SendPacket_Dest_S63 =>
255  dataout <= icmp_mac(15 downto 8);
256  Sreg0 <= SendPacket_Dest_S64;
257  when SendPacket_Dest_S64 =>
258  dataout <= icmp_mac(7 downto 0);
259  Sreg0 <= SendPacket_Src_S16;
260  when SendPacket_Dest_S65 =>
261  dataout <= icmp_mac(47 downto 40);
262  --first byte of dest MAC
263  crc_gen_en <= '1';
264  Sreg0 <= SendPacket_Dest_S60;
265  when SendPacket_Src_S16 =>
266  dataout <= mac(47 downto 40);
267  --x"00";
268  Sreg0 <= SendPacket_Src_S18;
269  when SendPacket_Src_S18 =>
270  dataout <= mac(39 downto 32);
271  --x"80";
272  Sreg0 <= SendPacket_Src_S17;
273  when SendPacket_Src_S19 =>
274  dataout <= mac(7 downto 0);
275  --addrs;
276  Sreg0 <= SendPacket_Type_S26;
277  when SendPacket_Src_S20 =>
278  dataout <= mac(15 downto 8);
279  --x"00";
280  Sreg0 <= SendPacket_Src_S19;
281  when SendPacket_Src_S21 =>
282  dataout <= mac(23 downto 16);
283  --x"EC";
284  Sreg0 <= SendPacket_Src_S20;
285  when SendPacket_Src_S17 =>
286  dataout <= mac(31 downto 24);
287  --x"55";
288  Sreg0 <= SendPacket_Src_S21;
289  when SendPacket_Type_S26 =>
290  dataout <= x"08";
291  Sreg0 <= SendPacket_Type_S29;
292  when SendPacket_Type_S29 =>
293  dataout <= x"00";
294  Sreg0 <= SendPacket_Payload_IP_VersionAndHeader;
295  when SendPacket_Payload_UDP_SourcePort1 =>
296  dataout <= x"07";
297  -- source port is claimed as 2001... but will receive messages to any port
298  Sreg0 <= SendPacket_Payload_UDP_SourcePort2;
299  when SendPacket_Payload_UDP_DestPort1 =>
300  dataout <= dest_port(15 downto 8);
301  Sreg0 <= SendPacket_Payload_UDP_DestPort2;
302  when SendPacket_Payload_UDP_Length1 =>
303  dataout <= UDP_length(15 downto 8);
304  Sreg0 <= SendPacket_Payload_UDP_Length2;
305  when SendPacket_Payload_UDP_DestPort2 =>
306  dataout <= dest_port(7 downto 0);
307  Sreg0 <= SendPacket_Payload_UDP_Length1;
308  when SendPacket_Payload_UDP_SourcePort2 =>
309  dataout <= x"D1";
310  Sreg0 <= SendPacket_Payload_UDP_DestPort1;
311  when SendPacket_Payload_UDP_Length2 =>
312  dataout <= UDP_length(7 downto 0);
313  -- 13 bytes = 8 header + 5 data
314  Sreg0 <= SendPacket_Payload_UDP_Checksum1;
315  when SendPacket_Payload_UDP_Checksum1 =>
316  dataout <= x"00";
317  -- 0 indicates unused
318  Sreg0 <= SendPacket_Payload_UDP_Checksum2;
319  when SendPacket_Payload_UDP_Checksum2 =>
320  dataout <= x"00";
321  test_data <= ETH_CONTROLLER_VERSION(15 downto 8);
322  -- x"41";
323  -- A
324  if ping_packet = '0' then
325  en_tx_data <= '1';
326  -- indicates to user to have data present on next rising clock edge
327  end if;
328  Sreg0 <= SendPacket_Payload_UDP_DataLoop;
329  when SendPacket_Payload_UDP_DataLoop =>
330  length_count <= length_count - 1;
331  if test_data = x"5A" then -- if Z
332  test_data <= x"41";
333  -- A
334  else
335  test_data <= ETH_CONTROLLER_VERSION(7 downto 0);
336  ----test_data + 1;
337  end if;
338  dataout <= test_data;
339  if length_count = "000" & x"01" then
340  Sreg0 <= SendPacket_CRC_S1;
341  en_tx_data <= '0';
342  -- a delayed by one clock version of this signal will control the udp data mux
343  end if;
344  when SendPacket_Payload_IP_icmpProtocol =>
345  dataout <= x"01";
346  --ICMP
347  Sreg0 <= SendPacket_Payload_IP_Checksum1;
348  when SendPacket_Payload_IP_TotLength2 =>
349  dataout <= IP_length(7 downto 0);
350  -- is length in hex of headers and data
351  Sreg0 <= SendPacket_Payload_IP_ID1;
352  when SendPacket_Payload_IP_VersionAndHeader =>
353  dataout <= x"45";
354  Sreg0 <= SendPacket_Payload_IP_ToS1;
355  when SendPacket_Payload_IP_TotLength1 =>
356  dataout <= IP_length(15 downto 8);
357  Sreg0 <= SendPacket_Payload_IP_TotLength2;
358  when SendPacket_Payload_IP_ToS1 =>
359  dataout <= x"00";
360  if icmp_ping_packet = '1' then
361  Sreg0 <= SendPacket_Payload_IP_icmpTotLength1;
362  else
363  Sreg0 <= SendPacket_Payload_IP_TotLength1;
364  end if;
365  when SendPacket_Payload_IP_ID2 =>
366  dataout <= x"79";
367  Sreg0 <= SendPacket_Payload_IP_FlagsAndFrag;
368  when SendPacket_Payload_IP_FlagsAndFrag =>
369  dataout <= x"00";
370  Sreg0 <= SendPacket_Payload_IP_FragmentOffset;
371  when SendPacket_Payload_IP_FragmentOffset =>
372  dataout <= x"00";
373  Sreg0 <= SendPacket_Payload_IP_TTL;
374  when SendPacket_Payload_IP_icmpTotLength1 =>
375  dataout <= icmp_data;
376  Sreg0 <= SendPacket_Payload_IP_icmpTotLength2;
377  when SendPacket_Payload_IP_TTL =>
378  dataout <= x"80";
379  -- number of hops allowed
380  if icmp_ping_packet = '1' then
381  Sreg0 <= SendPacket_Payload_IP_icmpProtocol;
382  else
383  Sreg0 <= SendPacket_Payload_IP_Protocol;
384  end if;
385  when SendPacket_Payload_IP_Protocol =>
386  dataout <= x"11";
387  --UDP
388  Sreg0 <= SendPacket_Payload_IP_Checksum1;
389  when SendPacket_Payload_IP_Checksum1 =>
390  dataout <= checksum(15 downto 8);
391  Sreg0 <= SendPacket_Payload_IP_Checksum2;
392  when SendPacket_Payload_IP_Checksum2 =>
393  dataout <= checksum(7 downto 0);
394  Sreg0 <= SendPacket_Payload_IP_SourceAddr1;
395  when SendPacket_Payload_IP_SourceAddr1 =>
396  dataout <= addrs(31 downto 24);
397  --x"C0";
398  Sreg0 <= SendPacket_Payload_IP_SourceAddr2;
399  when SendPacket_Payload_IP_icmpTotLength2 =>
400  dataout <= icmp_data;
401  Sreg0 <= SendPacket_Payload_IP_ID1;
402  when SendPacket_Payload_IP_SourceAddr2 =>
403  dataout <= addrs(23 downto 16);
404  --x"A8";
405  Sreg0 <= SendPacket_Payload_IP_SourceAddr3;
406  when SendPacket_Payload_IP_SourceAddr3 =>
407  dataout <= addrs(15 downto 8);
408  --x"85";
409  Sreg0 <= SendPacket_Payload_IP_SourceAddr4;
410  when SendPacket_Payload_IP_ID1 =>
411  dataout <= x"35";
412  Sreg0 <= SendPacket_Payload_IP_ID2;
413  when SendPacket_Payload_IP_SourceAddr4 =>
414  dataout <= addrs(7 downto 0);
415  --addrs;
416  if icmp_ping_packet = '1' then
417  Sreg0 <= SendPacket_Payload_IP_DestAddr6;
418  else
419  Sreg0 <= SendPacket_Payload_IP_DestAddr1;
420  end if;
421  when SendPacket_Payload_IP_DestAddr1 =>
422  dataout <= dest_ip(31 downto 24);
423  -- 192.168.133.1 => 0 x C0 A8 85 01
424  Sreg0 <= SendPacket_Payload_IP_DestAddr2;
425  when SendPacket_Payload_IP_DestAddr2 =>
426  dataout <= dest_ip(23 downto 16);
427  Sreg0 <= SendPacket_Payload_IP_DestAddr3;
428  when SendPacket_Payload_IP_DestAddr3 =>
429  dataout <= dest_ip(15 downto 8);
430  Sreg0 <= SendPacket_Payload_IP_DestAddr4;
431  when SendPacket_Payload_IP_DestAddr4 =>
432  dataout <= dest_ip(7 downto 0);
433  if icmp_ping_packet = '1' then
434  Sreg0 <= SendPacket_Payload_ICMP_Type;
435  else
436  Sreg0 <= SendPacket_Payload_UDP_SourcePort1;
437  end if;
438  when SendPacket_Payload_IP_DestAddr6 =>
439  dataout <= icmp_ip(31 downto 24);
440  -- 192.168.133.1 => 0 x C0 A8 85 01
441  Sreg0 <= SendPacket_Payload_IP_DestAddr5;
442  when SendPacket_Payload_IP_DestAddr5 =>
443  dataout <= icmp_ip(23 downto 16);
444  Sreg0 <= SendPacket_Payload_IP_DestAddr8;
445  when SendPacket_Payload_IP_DestAddr8 =>
446  dataout <= icmp_ip(15 downto 8);
447  Sreg0 <= SendPacket_Payload_IP_DestAddr7;
448  when SendPacket_Payload_IP_DestAddr7 =>
449  dataout <= icmp_ip(7 downto 0);
450  if icmp_ping_packet = '1' then
451  Sreg0 <= SendPacket_Payload_ICMP_Type;
452  else
453  Sreg0 <= SendPacket_Payload_UDP_SourcePort1;
454  end if;
455  when SendPacket_Payload_ICMP_Type =>
456  dataout <= x"00";
457  -- Type: ICMP Ping Response (0x08 is Request)
458  length_count <= data_length - 20;
459  --get icmp payload count
460  Sreg0 <= SendPacket_Payload_ICMP_Code;
461  when SendPacket_Payload_ICMP_Code =>
462  dataout <= icmp_data;
463  Sreg0 <= SendPacket_Payload_ICMP_Checksum1;
464  when SendPacket_Payload_ICMP_Checksum1 =>
465  dataout <= icmp_checksum(15 downto 8);
466  Sreg0 <= SendPacket_Payload_ICMP_Checksum2;
467  when SendPacket_Payload_ICMP_ID1 =>
468  dataout <= icmp_data;
469  Sreg0 <= SendPacket_Payload_ICMP_ID2;
470  when SendPacket_Payload_ICMP_Checksum2 =>
471  dataout <= icmp_checksum(7 downto 0);
472  Sreg0 <= SendPacket_Payload_ICMP_ID1;
473  when SendPacket_Payload_ICMP_ID2 =>
474  dataout <= icmp_data;
475  Sreg0 <= SendPacket_Payload_ICMP_SeqNum1;
476  when SendPacket_Payload_ICMP_SeqNum1 =>
477  dataout <= icmp_data;
478  Sreg0 <= SendPacket_Payload_ICMP_SeqNum2;
479  when SendPacket_Payload_ICMP_SeqNum2 =>
480  dataout <= icmp_data;
481  Sreg0 <= SendPacket_Payload_ICMP_DataLoop;
482  when SendPacket_Payload_ICMP_DataLoop =>
483  length_count <= length_count - 1;
484  dataout <= icmp_data;
485  if length_count = "000" & x"01" then
486  Sreg0 <= SendPacket_CRC_S1;
487  en_tx_data <= '0';
488  -- a delayed by one clock version of this signal will control the udp data mux
489  end if;
490  when SendPacket_Preamble_S58 =>
491  dataout <= x"D5";
492  if icmp_ping_packet = '1' then
493  Sreg0 <= SendPacket_Dest_S65;
494  checksum_trig <= '1';
495  --latch length for checksum
496  length_count_out <= data_length-20;
497  --the length comes a little late.. since the icmp ping is trying to be as responsive as possible
498  else
499  Sreg0 <= SendPacket_Dest_S22;
500  checksum_trig <= '1';
501  --latch length for checksum
502  length_count_out <= length_count;
503  --latch the already latched value for checksum
504  end if;
505  when SendPacket_Preamble_S57 =>
506  delay_count <= delay_count - 1;
507  dataout <= x"55";
508  tx_en <= '1';
509  crc_gen_init <= '0';
510  if delay_count = 1 then
511  Sreg0 <= SendPacket_Preamble_S58;
512  end if;
513  when SendPacket_CRC_crc4 =>
514  Sreg0 <= sleep;
515  crc_gen_rd <= '0';
516  tx_en <= '0';
517  when SendPacket_CRC_crc3 =>
518  Sreg0 <= SendPacket_CRC_crc4;
519  when SendPacket_CRC_crc2 =>
520  Sreg0 <= SendPacket_CRC_crc3;
521  when SendPacket_CRC_S59 =>
522  delay_count <= delay_count - 1;
523  if delay_count = 1 then
524  Sreg0 <= SendPacket_CRC_crc1;
525  crc_gen_rd <= '1';
526  crc_gen_en <= '0';
527  end if;
528  when SendPacket_CRC_crc1 =>
529  Sreg0 <= SendPacket_CRC_crc2;
530  when SendPacket_CRC_S1 =>
531  dataout <= x"00";
532  if zero_fill_count = ("000" & x"00") then
533  Sreg0 <= SendPacket_CRC_crc1;
534  crc_gen_rd <= '1';
535  crc_gen_en <= '0';
536  else
537  Sreg0 <= SendPacket_CRC_S59;
538  delay_count <= conv_integer(zero_fill_count);
539  end if;
540 --vhdl_cover_off
541  when others =>
542  null;
543 --vhdl_cover_on
544  end case;
545  end if;
546  end if;
547  end if;
548 end process;
549 
550 end create_packet_arch;