1 | -- Package File Template |
---|
2 | -- |
---|
3 | -- Purpose: This package defines supplemental types, subtypes, |
---|
4 | -- constants, and functions |
---|
5 | |
---|
6 | |
---|
7 | library IEEE; |
---|
8 | use IEEE.STD_LOGIC_1164.all; |
---|
9 | Library NocLib; |
---|
10 | use NocLib.CoreTypes.all; |
---|
11 | package mpi_pkg is |
---|
12 | -- Declare constants |
---|
13 | |
---|
14 | -- constant <constant_name> : time := <time_unit> ns; |
---|
15 | constant NPROC : positive:= 8; |
---|
16 | |
---|
17 | -- type declaration |
---|
18 | type portio is array(1 to NPROC) of std_logic_vector (Word-1 downto 0); |
---|
19 | -- type <new_type> is |
---|
20 | -- record |
---|
21 | -- <type_name> : std_logic_vector( Word-1 downto 0); |
---|
22 | -- <type_name> : std_logic; |
---|
23 | -- end record; |
---|
24 | |
---|
25 | |
---|
26 | -- Declare signals for interconnections |
---|
27 | |
---|
28 | |
---|
29 | --Inputs |
---|
30 | signal noc_portOut :portio; |
---|
31 | signal noc_portIn :portio; |
---|
32 | |
---|
33 | signal noc_fifo_in_full : std_logic_vector(NPROC downto 1):= (others => '0'); |
---|
34 | signal noc_data_available : std_logic_vector(NPROC downto 1):= (others => '0'); |
---|
35 | signal noc_fifo_in_empty : std_logic_vector(NPROC downto 1):= (others => '0'); |
---|
36 | signal noc_data_in_en : std_logic_vector(NPROC downto 1) := (others => '0'); |
---|
37 | signal noc_data_out_en : std_logic_vector(NPROC downto 1) := (others => '0'); |
---|
38 | signal noc_clk : std_logic := '0'; |
---|
39 | signal noc_reset : std_logic := '0'; |
---|
40 | |
---|
41 | -- Declare components |
---|
42 | COMPONENT SWITCH_GENERIQUE |
---|
43 | GENERIC (number_of_ports : positive := 8); |
---|
44 | PORT( |
---|
45 | Port1_in : IN std_logic_vector(Word-1 downto 0); |
---|
46 | Port2_in : IN std_logic_vector(Word-1 downto 0); |
---|
47 | Port3_in : IN std_logic_vector(Word-1 downto 0); |
---|
48 | Port4_in : IN std_logic_vector(Word-1 downto 0); |
---|
49 | Port5_in : IN std_logic_vector(Word-1 downto 0); |
---|
50 | Port6_in : IN std_logic_vector(Word-1 downto 0); |
---|
51 | Port7_in : IN std_logic_vector(Word-1 downto 0); |
---|
52 | Port8_in : IN std_logic_vector(Word-1 downto 0); |
---|
53 | Port9_in : IN std_logic_vector(Word-1 downto 0); |
---|
54 | Port10_in : IN std_logic_vector(Word-1 downto 0); |
---|
55 | Port11_in : IN std_logic_vector(Word-1 downto 0); |
---|
56 | Port12_in : IN std_logic_vector(Word-1 downto 0); |
---|
57 | Port13_in : IN std_logic_vector(Word-1 downto 0); |
---|
58 | Port14_in : IN std_logic_vector(Word-1 downto 0); |
---|
59 | Port15_in : IN std_logic_vector(Word-1 downto 0); |
---|
60 | Port16_in : IN std_logic_vector(Word-1 downto 0); |
---|
61 | Port1_out : OUT std_logic_vector(Word-1 downto 0); |
---|
62 | Port2_out : OUT std_logic_vector(Word-1 downto 0); |
---|
63 | Port3_out : OUT std_logic_vector(Word-1 downto 0); |
---|
64 | Port4_out : OUT std_logic_vector(Word-1 downto 0); |
---|
65 | Port5_out : OUT std_logic_vector(Word-1 downto 0); |
---|
66 | Port6_out : OUT std_logic_vector(Word-1 downto 0); |
---|
67 | Port7_out : OUT std_logic_vector(Word-1 downto 0); |
---|
68 | Port8_out : OUT std_logic_vector(Word-1 downto 0); |
---|
69 | Port9_out : OUT std_logic_vector(Word-1 downto 0); |
---|
70 | Port10_out : OUT std_logic_vector(Word-1 downto 0); |
---|
71 | Port11_out : OUT std_logic_vector(Word-1 downto 0); |
---|
72 | Port12_out : OUT std_logic_vector(Word-1 downto 0); |
---|
73 | Port13_out : OUT std_logic_vector(Word-1 downto 0); |
---|
74 | Port14_out : OUT std_logic_vector(Word-1 downto 0); |
---|
75 | Port15_out : OUT std_logic_vector(Word-1 downto 0); |
---|
76 | Port16_out : OUT std_logic_vector(Word-1 downto 0); |
---|
77 | data_in_en : IN std_logic_vector(8 downto 1); |
---|
78 | data_out_en : IN std_logic_vector(8 downto 1); |
---|
79 | fifo_in_full : OUT std_logic_vector(8 downto 1); |
---|
80 | fifo_in_empty : OUT std_logic_vector(8 downto 1); |
---|
81 | data_available : OUT std_logic_vector(8 downto 1); |
---|
82 | clk : IN std_logic; |
---|
83 | reset : IN std_logic |
---|
84 | ); |
---|
85 | END COMPONENT; |
---|
86 | COMPONENT CORE_MPI is |
---|
87 | Port ( instruction : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
88 | instruction_en : in STD_LOGIC; |
---|
89 | ram_data_in : in STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
90 | barrier_completed : out STD_LOGIC; |
---|
91 | packet_received : out STD_LOGIC; |
---|
92 | packet_ack : in std_logic; |
---|
93 | PushOut : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
94 | ram_we : out STD_LOGIC; |
---|
95 | ram_address : out STD_LOGIC_VECTOR (15 downto 0); |
---|
96 | ram_data_out : out STD_LOGIC_VECTOR (Word-1 downto 0); |
---|
97 | switch_port_in_wr_en : out STD_LOGIC; -- OK (au switch) pour lire les données |
---|
98 | switch_port_in_full : in STD_LOGIC; -- port d'entréendu switch saturé |
---|
99 | switch_port_in_data : out STD_LOGIC_VECTOR (Word-1 downto 0); -- port de donées d'entrée |
---|
100 | switch_port_out_rd_en : out STD_LOGIC; -- OK (au switch) pour écrire les données |
---|
101 | switch_port_out_data_vailaible : in STD_LOGIC; -- Donnée disponible à la sortie (du switch) |
---|
102 | clk : in STD_LOGIC; |
---|
103 | reset : in STD_LOGIC; |
---|
104 | ram_en : out STD_LOGIC; |
---|
105 | instruction_fifo_full : out STD_LOGIC; |
---|
106 | switch_port_out_data : in STD_LOGIC_VECTOR (Word-1 downto 0)); |
---|
107 | end COMPONENT; |
---|
108 | -- declare functions and procedure |
---|
109 | |
---|
110 | end MPI_PKG; |
---|
111 | |
---|
112 | |
---|
113 | package body MPI_PKG is |
---|
114 | |
---|
115 | -- Example 1 |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | -- cette fonction met en place l'architecture d'exécution de l'environnement |
---|
120 | -- elle permet de construire le Noc et de connecter les différents core MPI |
---|
121 | -- chaque core reçoit un ID qui sera son Rank lors de l'appel à MPI_GET_Rank |
---|
122 | -- faut il créer une petite mémoire chargée de stocker les IDs ? |
---|
123 | -- Oui car cette mémoire sera consultée par la fonction MPI_Init pour associer |
---|
124 | -- un communicateur au MPI Core |
---|
125 | |
---|
126 | |
---|
127 | end MPI_PKG; |
---|