otsdaq_prepmodernization  v2_05_02_indev
icmp_ping_checksum_calc.vhd
1 -------------------------------------------------------------------------------
2 --
3 -- Title : No Title
4 -- Design : ethernet_controller
5 -- Author : rrivera
6 -- Company : Fermi National Accelerator Laboratory
7 --
8 -------------------------------------------------------------------------------
9 --
10 -- File : d:\Projects\otsdaq\OtS Ethernet MAC firmware\ActiveHDL_proj\ethernet_controller\compile\icmp_ping_checksum_calc.vhd
11 -- Generated : 02/29/16 11:09:16
12 -- From : d:/Projects/otsdaq/OtS Ethernet MAC firmware/ActiveHDL_proj/ethernet_controller/src/icmp_ping_checksum_calc.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.numeric_std.all;
24 
26  port (
27  clk: in STD_LOGIC;
28  req_chk_sum: in STD_LOGIC_VECTOR (15 downto 0);
29  reset: in STD_LOGIC;
30  trigger: in STD_LOGIC;
31  resp_chk_sum: out STD_LOGIC_VECTOR (15 downto 0));
32 end icmp_ping_checksum_calc;
33 
34 architecture icmp_ping_checksum_calc_arch of icmp_ping_checksum_calc is
35 
36 -- diagram signals declarations
37 signal req_chk_sum_sig: UNSIGNED (16 downto 0);
38 
39 -- SYMBOLIC ENCODED state machine: Sreg0
40 type Sreg0_type is (
41  Init, S1, S2, S3, S4
42 );
43 -- attribute ENUM_ENCODING of Sreg0_type: type is ... -- enum_encoding attribute is not supported for symbolic encoding
44 
45 signal Sreg0: Sreg0_type;
46 
47 begin
48 
49 -- concurrent signals assignments
50 
51 -- Diagram ACTION
52 
53 ----------------------------------------------------------------------
54 -- Machine: Sreg0
55 ----------------------------------------------------------------------
56 Sreg0_machine: process (clk)
57 begin
58  if clk'event and clk = '1' then
59  if reset = '1' then
60  Sreg0 <= Init;
61  -- Set default values for outputs, signals and variables
62  -- ...
63  else
64  -- Set default values for outputs, signals and variables
65  -- ...
66  case Sreg0 is
67  when Init =>
68  Sreg0 <= S1;
69  req_chk_sum_sig <= unsigned('0' & (not req_chk_sum));
70  when S1 =>
71  Sreg0 <= S2;
72  req_chk_sum_sig <= req_chk_sum_sig + ('0' & x"F7FF");
73  when S2 =>
74  Sreg0 <= S3;
75  if req_chk_sum_sig(16) = '1' then
76  req_chk_sum_sig(15 downto 0) <= req_chk_sum_sig(15 downto 0) + 1;
77  req_chk_sum_sig(16) <= '0';
78  end if;
79  when S3 =>
80  Sreg0 <= S4;
81  resp_chk_sum <= not (std_logic_vector(req_chk_sum_sig(15 downto 0)));
82  when S4 =>
83  Sreg0 <= Init;
84 --vhdl_cover_off
85  when others =>
86  null;
87 --vhdl_cover_on
88  end case;
89  end if;
90  end if;
91 end process;
92 
93 end icmp_ping_checksum_calc_arch;