2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
5 use work.textmode_vga_component_pkg.all;
6 use work.textmode_vga_pkg.all;
7 use work.textmode_vga_platform_dependent_pkg.all;
9 entity beh_history_tb is
10 end entity beh_history_tb;
12 architecture sim of beh_history_tb is
14 signal sys_clk, sys_res_n : std_logic;
16 signal d_new_eingabe, d_new_result, d_new_bs : std_logic;
17 signal d_zeile : hzeile;
18 signal d_spalte : hspalte;
19 signal d_get, d_done : std_logic;
20 signal d_char : hbyte;
22 signal s_char : hbyte;
23 signal s_take, s_done, s_backspace : std_logic;
25 signal new_data : std_logic;
26 signal data : std_logic_vector(7 downto 0);
28 signal free : std_logic;
29 signal command : std_logic_vector(COMMAND_SIZE - 1 downto 0);
30 signal command_data : std_logic_vector(3 * COLOR_SIZE + CHAR_SIZE -1 downto 0);
32 signal p_rget : std_logic;
33 signal p_rdone : std_logic;
34 signal p_read : hbyte;
35 signal p_wtake : std_logic;
36 signal p_wdone : std_logic;
37 signal p_write : hbyte;
38 signal p_finished : std_logic;
40 signal do_it, finished : std_logic;
42 signal stop : boolean := false;
45 inst : entity work.history(beh)
48 sys_res_n => sys_res_n,
53 s_backspace => s_backspace,
55 d_new_eingabe => d_new_eingabe,
56 d_new_result => d_new_result,
70 p_finished => p_finished
74 inst_disp : entity work.display(beh)
77 sys_res_n => sys_res_n,
79 d_new_eingabe => d_new_eingabe,
80 d_new_result => d_new_result,
89 command_data => command_data,
94 inst_parser : entity work.parser(beh)
97 sys_res_n => sys_res_n,
105 p_finished => p_finished,
112 inst_scan : entity work.scanner(beh)
115 sys_res_n => sys_res_n,
117 new_data => new_data,
123 s_backspace => s_backspace,
155 file f : text open read_mode is "../../src/history.test";
158 variable input : string(1 to 100);
160 variable run_tc, run_inner : boolean := true;
161 variable i, j, y : natural;
166 data <= (others => '0');
172 f_loop : while not endfile(f) loop
173 data <= (others => '0');
175 f1_loop : while not endfile(f) loop
177 input := (others => nul);
178 if (l'length <= 100) then
179 input(1 to l'length) := l.all;
180 if (input(1) = '#') then
186 report "fehler in history.test: eingabe zu lange in testfall " & natural'image(i);
191 report "testcase(" & natural'image(i) & ").input: " & input;
198 mainl : while run_tc loop
204 assert(false) report "wtf @ schleife";
211 when nul => data <= ascii2sc(x"1c"); -- $ (enter)
212 when '!' => data <= ascii2sc(x"0e"); -- ! (backspace)
220 when others => data <= ascii2sc(std_logic_vector(to_unsigned(character'pos(input(j)),8)));
223 -- ack'en skippen, falls es ein "spezielles" zeichen ist (steht
224 -- in abhaengigkeit zum vorherigen zeichen)
225 if(not valid_char(data)) then
229 -- wuenschswert waere das hier:
230 -- > wait on s_backspace, s_take, do_it;
231 -- geht aber leider nicht, weil sich die signale vllt schon
234 main_inner : while run_inner loop
238 if s_backspace = '1' or s_take = '1' then
240 wait on s_take; -- = '0'
242 elsif do_it = '1' then
243 -- dauert normalweiser noch laenger (parser braucht
246 wait on do_it; -- = '0'
247 icwait(sys_clk, 850);
251 -- assert(false) report "history_tb: kann passieren. wenn tb haengt, dann hier auskommentieren";
256 report "==================";
259 icwait(sys_clk, 850);
263 end architecture sim;