OpenCores
URL https://opencores.org/ocsvn/canny_edge_detector/canny_edge_detector/trunk

Subversion Repositories canny_edge_detector

[/] [canny_edge_detector/] [trunk/] [vhdl_testbench/] [testbench1.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 angelobacc
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   19:16:58 10/08/2013
6
-- Design Name:   
7
-- Module Name:   C:/ISE_PROJECTS/sobel_EDA/src/testbench1.vhd
8
-- Project Name:  sobel_EDA
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: topVGA
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
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
 
31
-- Uncomment the following library declaration if using
32
-- arithmetic functions with Signed or Unsigned values
33
USE ieee.numeric_std.ALL;
34
 
35
ENTITY testbench1 IS
36
END testbench1;
37
 
38
ARCHITECTURE behavior OF testbench1 IS
39
 
40
 
41
 
42
   type FileType is file of integer;
43
 
44
 
45
   COMPONENT top
46
   PORT(
47
        clk : IN  std_logic;
48
                rstn : IN std_logic;
49
        data_in : IN  std_logic_vector(7 downto 0);
50
        fsync_in : IN  std_logic;
51
        fsync_out : OUT  std_logic;
52
        data_out : OUT  std_logic_vector(7 downto 0)
53
       );
54
   END COMPONENT;
55
 
56
 
57
 
58
   --Inputs
59
   signal clk : std_logic := '0';
60
   signal rstn : std_logic := '0';
61
   signal data_in : std_logic_vector(7 downto 0) := (others => '0');
62
   signal fsync_in : std_logic := '0';
63
 
64
        --Outputs
65
   signal fsync_out : std_logic;
66
   signal data_out : std_logic_vector(7 downto 0);
67
 
68
   -- Clock period definitions
69
   constant clk_period : time := 10 ns;
70
 
71
BEGIN
72
 
73
   --variable i : integer := 1;
74
 
75
        -- Instantiate the Unit Under Test (UUT)
76
   uut: top PORT MAP (
77
          clk => clk,
78
                  rstn => rstn,
79
          data_in => data_in,
80
          fsync_in => fsync_in,
81
          fsync_out => fsync_out,
82
          data_out => data_out
83
        );
84
 
85
   -- Clock process definitions
86
   clk_process :process
87
   begin
88
                clk <= '1';
89
                wait for clk_period/2;
90
                clk <= '0';
91
                wait for clk_period/2;
92
   end process;
93
 
94
 
95
   -- Stimulus process
96
   stim_proc: process
97
   file text_in: FileType open read_mode is "inputdata";
98
   file text_out: FileType open write_mode is "outputdata";
99
 
100
   variable chr: integer := 0;
101
 
102
   begin
103
     wait for clk_period*1;
104
          rstn <= '1';
105
     -- hold reset state for 100 ns.
106
     --wait for 100 ns; 
107
 
108
     wait for clk_period*18;
109
 
110
          wait for 7 ns;
111
 
112
--        fsync_in <= '1';
113
--        for i in 0 to 400000 loop
114
--        if i < 307200 then
115
--          fsync_in <= '1';
116
--      read(text_in,chr);
117
--              data_in  <= std_logic_vector(to_unsigned(chr, 8));
118
--              --data_in  <= '0' & std_logic_vector(to_unsigned(i, 7));
119
--        else
120
--              fsync_in <= '0';
121
--        end if;
122
--        if fsync_out = '1' then 
123
--            write(text_out, to_integer(unsigned(data_out)));
124
--        end if;
125
--        wait for clk_period;
126
--        end loop;
127
 
128
     fsync_in <= '1';
129
          for i in 0 to 99 loop
130
            fsync_in <= '1';
131
         read(text_in,chr);
132
                 data_in  <= std_logic_vector(to_unsigned(chr, 8));
133
                 --data_in  <= '0' & std_logic_vector(to_unsigned(i, 7));
134
            if fsync_out = '1' then
135
              write(text_out, to_integer(unsigned(data_out)));
136
            end if;
137
            wait for clk_period;
138
     end loop;
139
 
140
          fsync_in <= '0';
141
          for i in 0 to 99999 loop
142
            fsync_in <= '0';
143
            if fsync_out = '1' then
144
              write(text_out, to_integer(unsigned(data_out)));
145
            end if;
146
            wait for clk_period;
147
      end loop;
148
 
149
          fsync_in <= '1';
150
          for i in 100 to 307199 loop
151
            fsync_in <= '1';
152
            read(text_in,chr);
153
                 data_in  <= std_logic_vector(to_unsigned(chr, 8));
154
                 --data_in  <= '0' & std_logic_vector(to_unsigned(i, 7));
155
            if fsync_out = '1' then
156
              write(text_out, to_integer(unsigned(data_out)));
157
            end if;
158
            wait for clk_period;
159
      end loop;
160
 
161
          fsync_in <= '0';
162
          for i in 0 to 199999 loop
163
            fsync_in <= '0';
164
            if fsync_out = '1' then
165
              write(text_out, to_integer(unsigned(data_out)));
166
            end if;
167
            wait for clk_period;
168
      end loop;
169
 
170
      -- insert stimulus here 
171
 
172
      wait;
173
   end process;
174
 
175
END;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.