| 1 | -------------------------------------------------------------------------------- |
|---|
| 2 | -- Company: |
|---|
| 3 | -- Engineer: GAMOM Roland Christian |
|---|
| 4 | -- |
|---|
| 5 | -- Create Date: 16:44:13 08/01/2012 |
|---|
| 6 | -- Design Name: |
|---|
| 7 | -- Module Name: C:/Core MPI/CORE_MPI/MultiMPITest.vhd |
|---|
| 8 | -- Project Name: MPI_CORE_COMPONENTS |
|---|
| 9 | -- Target Device: |
|---|
| 10 | -- Tool versions: |
|---|
| 11 | -- Description: |
|---|
| 12 | -- |
|---|
| 13 | -- VHDL Test Bench Created by ISE for module: MPI_NOC |
|---|
| 14 | -- |
|---|
| 15 | -- Dependencies: |
|---|
| 16 | -- |
|---|
| 17 | -- Revision: |
|---|
| 18 | -- Revision 0.01 - File Created |
|---|
| 19 | -- Additional Comments: |
|---|
| 20 | -- |
|---|
| 21 | -- |
|---|
| 22 | -- |
|---|
| 23 | -------------------------------------------------------------------------------- |
|---|
| 24 | LIBRARY ieee; |
|---|
| 25 | USE ieee.std_logic_1164.ALL; |
|---|
| 26 | |
|---|
| 27 | library NocLib ; |
|---|
| 28 | |
|---|
| 29 | use NocLib.CoreTypes.all; |
|---|
| 30 | use work.Packet_type.all; |
|---|
| 31 | |
|---|
| 32 | USE ieee.numeric_std.ALL; |
|---|
| 33 | |
|---|
| 34 | ENTITY MultiMPITest IS |
|---|
| 35 | --port (clkm : in std_logic; |
|---|
| 36 | --reset : in std_logic; |
|---|
| 37 | --result : out std_logic_vector(Word-1 downto 0)); |
|---|
| 38 | END MultiMPITest; |
|---|
| 39 | |
|---|
| 40 | ARCHITECTURE behavior OF MultiMPITest IS |
|---|
| 41 | |
|---|
| 42 | -- Component Declaration for the Unit Under Test (UUT) |
|---|
| 43 | |
|---|
| 44 | COMPONENT MPI_NOC |
|---|
| 45 | generic (NPROC: natural:=2); |
|---|
| 46 | PORT( |
|---|
| 47 | MPI_Node_in : IN Ar_MPIPort_in(1 to NPROC); |
|---|
| 48 | MPI_Node_Out : OUT Ar_MPIPort_out(1 to NPROC) |
|---|
| 49 | ); |
|---|
| 50 | END COMPONENT; |
|---|
| 51 | Component PE |
|---|
| 52 | generic(destid : natural); |
|---|
| 53 | Port ( Instruction : out STD_LOGIC_VECTOR (Word-1 downto 0); |
|---|
| 54 | Instruction_en : out STD_LOGIC; |
|---|
| 55 | Core_PushOut : in STD_LOGIC_VECTOR (Word-1 downto 0); |
|---|
| 56 | clk : in STD_LOGIC; |
|---|
| 57 | reset : in STD_LOGIC; |
|---|
| 58 | Core_RAM_Data_Out : out STD_LOGIC_VECTOR (Word-1 downto 0); |
|---|
| 59 | Core_RAM_Data_In : in STD_LOGIC_VECTOR (Word-1 downto 0); |
|---|
| 60 | Core_RAM_WE : in STD_LOGIC; |
|---|
| 61 | Core_RAM_EN : in STD_LOGIC; |
|---|
| 62 | --Core_RAM_ENB : in STD_LOGIC; |
|---|
| 63 | Core_RAM_ADDRESS_WR : in STD_LOGIC_VECTOR (ADRLEN-1 downto 0); |
|---|
| 64 | Core_RAM_ADDRESS_RD : in STD_LOGIC_VECTOR (ADRLEN-1 downto 0); |
|---|
| 65 | Core_Hold_req : in STD_LOGIC; |
|---|
| 66 | Core_Hold_Ack : out STD_LOGIC); |
|---|
| 67 | end Component; |
|---|
| 68 | |
|---|
| 69 | constant clk_period : time := 10 ns; |
|---|
| 70 | constant PROC : positive :=4; |
|---|
| 71 | --===================signaux pour l'horloge ============================== |
|---|
| 72 | signal reset,clkm : std_logic := '0'; |
|---|
| 73 | --======================================================================== |
|---|
| 74 | --signaux pour la gestion de la MAE |
|---|
| 75 | type typ_mae is (start,Fillmem,NextFill,InitApp,InitCompleted,writeptr,InstrCopy, |
|---|
| 76 | putdata,putdata2,putcompleted,getdata,getdata2,getcompleted,terminate,st_timeout); |
|---|
| 77 | signal dcount : natural range 0 to 255:=0; --permet de compter le packet de données envoyées |
|---|
| 78 | signal count,count_i : natural range 0 to 15:=0; |
|---|
| 79 | |
|---|
| 80 | signal MPI_Node_in : Ar_MPIPort_in(1 to PROC) ; |
|---|
| 81 | signal MPI_Node_Out : Ar_MPIPort_out(1 to PROC); |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | BEGIN |
|---|
| 87 | uut: MPI_NOC GENERIC MAP (NPROC=>PROC) |
|---|
| 88 | PORT MAP ( |
|---|
| 89 | MPI_Node_in => MPI_Node_in, |
|---|
| 90 | MPI_Node_Out => MPI_Node_Out |
|---|
| 91 | ); |
|---|
| 92 | |
|---|
| 93 | PE1: PE generic map (DestId=>1) |
|---|
| 94 | Port Map ( |
|---|
| 95 | Instruction => MPi_Node_in(1).Instruction, |
|---|
| 96 | Instruction_en => MPi_Node_in(1).Instruction_en, |
|---|
| 97 | Core_PushOut => MPi_Node_out(1).PushOut, |
|---|
| 98 | clk =>clkm, |
|---|
| 99 | reset =>reset, |
|---|
| 100 | Core_RAM_Data_Out =>MPi_Node_in(1).Ram_Data_out, |
|---|
| 101 | Core_RAM_Data_IN => MPI_Node_out(1).ram_data_in, |
|---|
| 102 | Core_RAM_WE => MPI_Node_out(1).ram_we, |
|---|
| 103 | Core_RAM_EN => MPI_Node_out(1).ram_en, |
|---|
| 104 | -- Core_RAM_ENB => MPI_Node_out(1).ram_en, |
|---|
| 105 | Core_RAM_Address_Wr => MPI_Node_out(1).ram_address_wr, |
|---|
| 106 | Core_RAM_Address_Rd => MPI_Node_out(1).ram_address_rd, |
|---|
| 107 | Core_Hold_req => MPI_Node_out(1).hold_req, |
|---|
| 108 | Core_Hold_Ack => MPI_Node_in(1).hold_ack |
|---|
| 109 | ); |
|---|
| 110 | |
|---|
| 111 | PE2: PE Generic map (DestId=>0) |
|---|
| 112 | Port Map ( |
|---|
| 113 | Instruction => MPi_Node_in(2).Instruction, |
|---|
| 114 | Instruction_en => MPi_Node_in(2).Instruction_en, |
|---|
| 115 | Core_PushOut => MPi_Node_out(2).PushOut, |
|---|
| 116 | clk =>clkm, |
|---|
| 117 | reset =>reset, |
|---|
| 118 | Core_RAM_Data_Out =>MPi_Node_in(2).Ram_Data_out, |
|---|
| 119 | Core_RAM_Data_IN => MPI_Node_out(2).ram_data_in, |
|---|
| 120 | Core_RAM_WE => MPI_Node_out(2).ram_we, |
|---|
| 121 | Core_RAM_EN => MPI_Node_out(2).ram_en, |
|---|
| 122 | --Core_RAM_ENB => MPI_Node_out(2).ram_en, |
|---|
| 123 | Core_RAM_Address_Wr => MPI_Node_out(2).ram_address_wr, |
|---|
| 124 | Core_RAM_Address_Rd => MPI_Node_out(2).ram_address_rd, |
|---|
| 125 | Core_Hold_req => MPI_Node_out(2).hold_req, |
|---|
| 126 | Core_Hold_Ack => MPI_Node_in(2).hold_ack |
|---|
| 127 | ); |
|---|
| 128 | MPI_Node_in(1).reset<=reset; |
|---|
| 129 | MPI_Node_in(1).clk<=clkm; |
|---|
| 130 | MPI_Node_in(2).reset<=reset; |
|---|
| 131 | MPI_Node_in(2).clk<=clkm; |
|---|
| 132 | --Result<=MPi_Node_out(1).PushOut; |
|---|
| 133 | --============================================================= |
|---|
| 134 | -- Clock process definitions |
|---|
| 135 | --============================================================= |
|---|
| 136 | clk_process :process |
|---|
| 137 | begin |
|---|
| 138 | clkm <= '0' ; |
|---|
| 139 | wait for clk_period/2; |
|---|
| 140 | clkm <= '1' ; |
|---|
| 141 | wait for clk_period/2; |
|---|
| 142 | end process; |
|---|
| 143 | stim_proc: process |
|---|
| 144 | begin |
|---|
| 145 | -- hold reset state for 100 ns. |
|---|
| 146 | reset<='0'; |
|---|
| 147 | wait for 1 ns; |
|---|
| 148 | reset<='1'; |
|---|
| 149 | wait for clk_period*10; |
|---|
| 150 | reset<='0'; |
|---|
| 151 | wait; |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | end process; |
|---|
| 155 | --================================================================ |
|---|
| 156 | END; |
|---|