source: PROJECT_CORE_MPI/SWITCH_GEN/BRANCHES/OLD_VERSION/proto_send.vhd @ 24

Last change on this file since 24 was 24, checked in by rolagamo, 12 years ago
File size: 3.1 KB
Line 
1----------------------------------------------------------------------------------
2-- Company:
3-- Engineer:
4--
5-- Create Date:    18:01:21 10/23/2012
6-- Design Name:
7-- Module Name:    proto_send - Behavioral
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description:
12--
13-- Dependencies:
14--
15-- Revision:
16-- Revision 0.01 - File Created
17-- Additional Comments:
18--
19----------------------------------------------------------------------------------
20library IEEE;
21use IEEE.STD_LOGIC_1164.ALL;
22USE ieee.numeric_std.ALL;
23use work.CoreTypes.all;
24-- Uncomment the following library declaration if using
25-- arithmetic functions with Signed or Unsigned values
26--use IEEE.NUMERIC_STD.ALL;
27
28-- Uncomment the following library declaration if instantiating
29-- any Xilinx primitives in this code.
30--library UNISIM;
31--use UNISIM.VComponents.all;
32
33entity proto_send is
34generic (sizemem : natural := 64);
35 port (
36 clk,reset : in std_logic;
37 fifo_empty,fifo_full : in std_logic;
38  push : out std_logic:='0';
39 fifo_in : out std_logic_vector(Word-1 downto 0);
40 snd_start : in std_logic; --début de la réception
41 snd_ack :in std_logic;   -- acquittement de la réception
42 snd_comp : out std_logic; -- fin de la réception
43 mem :in memory(0 to sizemem-1));
44
45end proto_send;
46
47architecture Behavioral of proto_send is
48type typ_send is (s_head,s_len,s_len2,s_data,s_pulse,s_end);
49 signal etsnd : typ_send;
50 signal sfifo_in : std_logic_vector(Word-1 downto 0);
51 signal spush : std_logic:='0';
52begin
53
54proc_send : process (clk,reset)
55variable dlen,i: natural range 0 to 255 :=0;
56        begin
57        if reset='1' then 
58                                 etsnd<=s_head;
59                                 
60                                else 
61                                                if rising_edge(clk) then -- le process s'exécute sur chaque front
62                                                                                                                        -- montant de l'horloge
63                                                case etsnd is
64                                                when s_head  =>
65                                                        sfifo_in<=mem(0);
66                                                        snd_comp<='0';
67                                                        i:=0;
68                                                       
69                                                        if fifo_empty='1' and snd_start='1' then
70                                                        spush<='1';
71                                                        snd_comp<='0';
72                                                        etsnd<=s_len;
73                                                        end if;
74                                                when s_pulse =>
75                                                        spush<='1';
76                                                        etsnd<=s_len;
77                                                when s_len  =>
78                                                        sfifo_in<=mem(1); --8 données
79                                                        i:=i+1;
80                                                        dlen:=to_integer(unsigned(mem(i)));
81                                                        spush<='1';
82                                                        snd_comp<='0';
83                                                        etsnd<=s_data;
84                                                when s_len2 =>
85                                                        snd_comp<='0';
86                                                                etsnd<=s_data;
87                                                               
88                                                when s_data  =>
89                                                                if fifo_full='0' then
90                                                                i:=i+1;
91                                                                sfifo_in<=mem(i);
92                                                                        if i=dlen-2 then
93                                                                                etsnd<=s_end;
94                                                                                snd_comp<='1';
95                                                                                spush<='1';
96                                                                        else
97                                                                                spush<='1';
98                                                                        end if;
99                                                                       
100                                                                else
101                                                                spush<='0';
102                                                                end if;
103                                               
104                                                when s_end  =>
105                                                                spush<='0';
106                                                                etsnd<=s_head;
107                                                                sfifo_in<=(others=>'-');
108                                                                if snd_ack='1' then
109                                                                        etsnd<=s_head;
110                                                                end if;
111                                                when others =>
112                                                                spush<='0';
113                                                                etsnd<=s_head;
114                                                                sfifo_in<=(others=>'0');
115                                                end case;
116                                                end if;
117                                end if;
118        end process;
119       
120        -- affectation concurentes
121       
122        push<=spush;
123        fifo_in<=sfifo_in;
124end Behavioral;
125
Note: See TracBrowser for help on using the repository browser.