source: PROJECT_CORE_MPI/MPI_HCL/TRUNK/NOC/Def_Request.vhd

Last change on this file was 135, checked in by rolagamo, 11 years ago
File size: 3.1 KB
Line 
1----------------------------------------------------------------------------------
2-- Company:
3-- Engineer:
4--
5-- Create Date:    17:58:09 04/07/2014
6-- Design Name:
7-- Module Name:    Def_Request - 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.STD_LOGIC_ARITH.ALL;
23use IEEE.STD_LOGIC_UNSIGNED.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 Def_Request is
34generic (NB_IO :positive:=4);
35    Port ( Req : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
36           clk : in  STD_LOGIC;
37           reset : in  STD_LOGIC;
38                          fifo_full : in STD_LOGIC_VECTOR (NB_IO downto 1);
39           priority_rotation : in  STD_LOGIC_VECTOR (NB_IO downto 1);
40           grant : in  STD_LOGIC_VECTOR (NB_IO**2 downto 1);
41           request : out  STD_LOGIC_VECTOR (NB_IO**2 downto 1));
42end Def_Request;
43
44architecture Behavioral of Def_Request is
45constant NB_IO2 :positive:=NB_IO**2; -- le carré du nombre de ports d'E/S
46 Signal Fifo_out_full :  STD_LOGIC_VECTOR (NB_IO downto 1);
47 signal grant_latch : std_logic_vector(NB_IO2 downto 1); 
48 signal priority_rotation_en : std_logic; 
49signal req_grant,Grant_bak :  std_logic_vector(NB_IO2 downto 1):=(others=>'0');
50 signal Mreq :  std_logic_vector(NB_IO2 downto 1):=(others=>'1');
51
52begin
53 Req_grant<=(req and grant );
54 priority_rotation_en <= '1' when   unsigned(priority_rotation) = 2**NB_IO-1 else       '0'; 
55 request<=req and mreq;
56--latch  qui memorise le signal grant pendant la transmission
57 grant_latch_process : process(clk)
58  begin 
59  if rising_edge(clk) then 
60   if reset = '1' then 
61                grant_latch <= (others => '0');
62                Fifo_out_full<=(others => '0');
63         elsif priority_rotation_en = '1' or unsigned(req_grant)=0 then 
64           grant_latch <= Grant;
65           Fifo_out_full<=fifo_full;
66  else
67         grant_latch <= Grant; 
68         Fifo_out_full<=fifo_full; 
69   end if; 
70   end if; 
71
72 end process; 
73 def_mreq: process(grant_latch,fifo_full)
74
75variable t:std_logic_vector(NB_IO2 downto 1):=(others=>'0');
76begin 
77   
78  for i in 0 to NB_IO2-1 loop
79    t(i+1):='0';
80    --sur le front montant de fifo_full sauver l'état Grant courant
81    if fifo_full(i mod NB_IO+1)='1' and  fifo_out_full(i mod NB_IO+1)='0' then
82      Grant_bak(i+1)<= grant_latch(i+1);
83    elsif fifo_full(i mod NB_IO+1)='0' and  fifo_out_full(i mod NB_IO+1)='0'  then
84      Grant_bak(i+1)<='0';
85    end if;
86  for j in 0 to NB_IO-1 loop
87    t(i+1):=t(i+1) or grant_latch(j*NB_IO+1+i mod NB_IO) or fifo_out_full(i mod NB_IO+1);
88   
89  end loop;
90      mreq(i+1)<=not(t(i+1) ) or grant_latch(i+1)or grant_bak(i+1);   
91  end loop;
92end process;
93
94end Behavioral;
95
Note: See TracBrowser for help on using the repository browser.