source: PROJECT_CORE_MPI/MPI_HCL/BRANCHES/v2.1/Timer_Par/test_ld_instr.vhd @ 160

Last change on this file since 160 was 160, checked in by rolagamo, 10 years ago
File size: 4.3 KB
Line 
1--------------------------------------------------------------------------------
2-- Company:
3-- Engineer:
4--
5-- Create Date:   09:22:05 09/16/2014
6-- Design Name:   
7-- Module Name:   D:/Synthesis/Static/Timer_Par/test_ld_instr.vhd
8-- Project Name:  Timer_Par
9-- Target Device: 
10-- Tool versions: 
11-- Description:   
12--
13-- VHDL Test Bench Created by ISE for module: load_instr
14--
15-- Dependencies:
16--
17-- Revision:
18-- Revision 0.01 - File Created
19-- Additional Comments:
20--
21-- Notes:
22-- This testbench has been automatically generated using types std_logic and
23-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24-- that these types always be used for the top-level I/O of a design in order
25-- to guarantee that the testbench will bind correctly to the post-implementation
26-- simulation model.
27--------------------------------------------------------------------------------
28LIBRARY ieee;
29USE ieee.std_logic_1164.ALL;
30Library MPI_HCL;
31use MPI_HCL.Packet_type.all; 
32-- Uncomment the following library declaration if using
33-- arithmetic functions with Signed or Unsigned values
34USE ieee.numeric_std.ALL;
35 
36ENTITY test_ld_instr IS
37END test_ld_instr;
38 
39ARCHITECTURE behavior OF test_ld_instr IS 
40 
41    -- Component Declaration for the Unit Under Test (UUT)
42 
43    COMPONENT load_instr
44    PORT(
45         Instruction : IN  std_logic_vector(7 downto 0);
46         Instruction_en : IN  std_logic;
47         clk : IN  std_logic;
48         reset : IN  std_logic;
49         dma_rd_grant : IN  std_logic;
50         dma_rd_request : OUT  std_logic;
51         instruction_ack : OUT  std_logic;
52         fifo_din : OUT  std_logic_vector(7 downto 0);
53         fifo_wr : OUT  std_logic;
54         copying : OUT  std_logic;
55         fifo_full : IN  std_logic;
56         ram_address_rd : OUT  std_logic_vector(15 downto 0);
57         ram_data : IN  std_logic_vector(7 downto 0);
58         Ram_rd_en : OUT  std_logic
59        );
60    END COMPONENT;
61type memory is array(natural range <>) of std_logic_vector(7 downto 0);   
62function init_mem(size : natural) return memory is
63variable dt: memory(0 to size-1);
64 begin
65 for i in 0 to size-1 loop
66 if i<3200 then
67 dt(i):=std_logic_vector(to_unsigned(i+32,8));
68 else
69 dt(i):=std_logic_vector(to_unsigned(0,8));
70 end if;
71 end loop;
72 dt(4098):=x"04";
73 dt(4099):=x"12";
74 dt(4612):=x"50";
75 dt(4613):=x"32";
76 dt(4614):=x"01";
77 dt(4615):=x"05";
78 dt(4616):=x"20";
79 dt(4617):=x"00";
80 return dt;
81 end function;
82   --Inputs
83   signal Instruction : std_logic_vector(7 downto 0) := (others => '0');
84   signal Instruction_en : std_logic := '0';
85   signal clk : std_logic := '0';
86   signal reset : std_logic := '0';
87   signal dma_rd_grant : std_logic := '0';
88   signal fifo_full : std_logic := '0';
89   signal ram_data : std_logic_vector(7 downto 0) := (others => '0');
90
91        --Outputs
92   signal dma_rd_request : std_logic;
93   signal instruction_ack : std_logic;
94   signal fifo_din : std_logic_vector(7 downto 0);
95   signal fifo_wr : std_logic;
96   signal copying : std_logic;
97   signal ram_address_rd : std_logic_vector(15 downto 0);
98   signal Ram_rd_en : std_logic;
99       
100        signal mem:memory(0 to 16535):=init_mem(16536);
101   -- Clock period definitions
102   constant clk_period : time := 10 ns;
103
104BEGIN
105 
106        -- Instantiate the Unit Under Test (UUT)
107   uut: load_instr PORT MAP (
108          Instruction => Instruction,
109          Instruction_en => Instruction_en,
110          clk => clk,
111          reset => reset,
112          dma_rd_grant => dma_rd_grant,
113          dma_rd_request => dma_rd_request,
114          instruction_ack => instruction_ack,
115          fifo_din => fifo_din,
116          fifo_wr => fifo_wr,
117          copying => copying,
118          fifo_full => fifo_full,
119          ram_address_rd => ram_address_rd,
120          ram_data => ram_data,
121          Ram_rd_en => Ram_rd_en
122        );
123
124   -- Clock process definitions
125   clk_process :process
126   begin
127                clk <= '0';
128                wait for clk_period/2;
129                clk <= '1';
130                wait for clk_period/2;
131   end process;
132 mem_proc:process(clk)
133 begin
134 if rising_edge(clk) then
135 if ram_rd_en='1' then
136 ram_data<=mem(to_integer(unsigned(ram_address_rd)));
137 end if;
138 dma_rd_grant<=dma_rd_request;
139
140 
141 
142 end if;
143 
144 end process;
145 
146 fifo_full<='0';
147 instruction<=x"06";
148 instruction_en<='0','1' after 200 ns,'0' after 1000 ns;
149 
150 
151res_proc:process
152begin
153reset<='0';
154wait for 30 ns;
155reset<='1','0' after 100 ns;
156end process;
157 
158
159END;
Note: See TracBrowser for help on using the repository browser.