1 ------------------------------------------------------------------------------
2 -- Copyright (C) 2010, Kenichi Kurimoto
4 -- This program is free software; you can redistribute it and/or modify
5 -- it under the terms of the GNU General Public License as published by
6 -- the Free Software Foundation; either version 2 of the License, or
7 -- (at your option) any later version.
9 -- This program is distributed in the hope that it will be useful,
10 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- GNU General Public License for more details.
14 -- You should have received a copy of the GNU General Public License
15 -- along with this program; if not, write to the Free Software
16 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -----------------------------------------------------------------------------
22 use ieee.std_logic_1164.all;
24 use ieee.std_logic_textio.all;
25 --use ieee.numeric_std.all;
30 use gaisler.ambatest.all;
31 use gaisler.ahbtbp.all;
33 use techmap.gencomp.all;
47 clkperiod : integer := 20);
51 architecture behav of sim_upycc is
59 ctrl_in1 : in ahbtbm_ctrl_in_type;
60 ctrl_out1 : out ahbtbm_ctrl_out_type
65 signal clk : std_ulogic := '0';
66 signal rst : std_ulogic := '0';
67 signal ctrl1 : ahbtb_ctrl_type;
68 -- signal data_in : std_logic_vector(31 downto 0);
70 file in_file : text open read_mode is "in_upycc.txt";
71 file compare_file : text open read_mode is "out_upycc.txt";
76 port map (rst,clk,ctrl1.i,ctrl1.o);
89 variable i,j : integer;
90 -- variable ycc : std_logic_vector(23 downto 0);
91 variable eightbdata : std_logic_vector(7 downto 0);
92 variable indata : std_logic_vector(31 downto 0);
93 variable radd : std_logic_vector(31 downto 0);
94 -- variable cdata1, cdata2 : std_logic_vector(15 downto 0);
95 variable cdata32 : std_logic_vector(31 downto 0);
99 report " stimulus process start ";
108 -- Write Control registers through APB bus
110 ahbwrite(x"80000200", x"a0000000", "10", "10", '1', 2, false , ctrl1);
111 ahbwrite(x"80000204", x"00082464", "10", "10", '1', 2, false , ctrl1);
112 ahbwrite(x"80000208", x"04E4B504", "10", "10", '1', 2, false , ctrl1);
113 ahbwrite(x"8000020C", x"00000000", "10", "10", '1', 2, false , ctrl1);
114 ahbwrite(x"8000020C", x"ffffffff", "10", "10", '1', 2, false , ctrl1);
116 -- Write YCC data for IP core
117 -- for i in 0 to 33821 loop
118 for i in 0 to 3999 loop
119 readline(in_file,li);
120 hread(li, eightbdata);
121 indata := x"000000" & eightbdata;
122 ahbwrite(x"90000000", indata, "10", "10", '1', 2, false , ctrl1);
123 ahbtbmidle(true, ctrl1);
128 -- for i in 0 to 79 loop
129 for i in 0 to 17 loop
130 for j in 0 to 39 loop
131 readline(compare_file, lc);
133 ahbread(radd, cdata32, "10", 2, false, ctrl1);
134 radd := radd + x"004";
136 radd := radd + x"460";
139 ahbtbmidle(true,ctrl1);
143 ahbtbmdone(0, ctrl1);
146 report "stimulus process end" severity failure;