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 tx_data : std_logic_vector(7 downto 0);
43 signal tx_new, tx_done, txd : std_logic;
45 signal pc_zeile : hzeile;
46 signal pc_spalte : hspalte;
47 signal pc_get, pc_done : std_logic;
48 signal pc_char : hbyte;
50 signal btn_a_int : std_logic;
53 signal stop : boolean := false;
56 inst : entity work.history(beh)
59 sys_res_n => sys_res_n,
64 s_backspace => s_backspace,
66 d_new_eingabe => d_new_eingabe,
67 d_new_result => d_new_result,
81 p_finished => p_finished,
84 pc_spalte => pc_spalte,
91 inst_disp : entity work.display(beh)
94 sys_res_n => sys_res_n,
96 d_new_eingabe => d_new_eingabe,
97 d_new_result => d_new_result,
100 d_spalte => d_spalte,
106 command_data => command_data,
111 inst_parser : entity work.parser(beh)
114 sys_res_n => sys_res_n,
122 p_finished => p_finished,
129 inst_scan : entity work.scanner(beh)
132 sys_res_n => sys_res_n,
134 new_data => new_data,
140 s_backspace => s_backspace,
146 inst_uart : entity work.uart_tx(beh)
149 sys_res_n => sys_res_n,
157 inst_pc_com : entity work.pc_communication(beh)
160 sys_res_n => sys_res_n,
168 rx_data => (others => '0'),
172 d_spalte => pc_spalte,
203 file f : text open read_mode is "../../src/history.test";
206 variable input : string(1 to 100);
208 variable run_tc, run_inner : boolean := true;
209 variable i, j, y : natural;
214 data <= (others => '0');
220 f_loop : while not endfile(f) loop
221 data <= (others => '0');
223 f1_loop : while not endfile(f) loop
225 input := (others => nul);
226 if (l'length <= 100) then
227 input(1 to l'length) := l.all;
228 if (input(1) = '#') then
234 report "fehler in history.test: eingabe zu lange in testfall " & natural'image(i);
239 report "testcase(" & natural'image(i) & ").input: " & input;
246 mainl : while run_tc loop
252 assert(false) report "wtf @ schleife";
259 when nul => data <= ascii2sc(x"1c"); -- $ (enter)
260 when '!' => data <= ascii2sc(x"0e"); -- ! (backspace)
268 when others => data <= ascii2sc(std_logic_vector(to_unsigned(character'pos(input(j)),8)));
271 -- ack'en skippen, falls es ein "spezielles" zeichen ist (steht
272 -- in abhaengigkeit zum vorherigen zeichen)
273 if(not valid_char(data)) then
277 -- wuenschswert waere das hier:
278 -- > wait on s_backspace, s_take, do_it;
279 -- geht aber leider nicht, weil sich die signale vllt schon
282 main_inner : while run_inner loop
286 if s_backspace = '1' or s_take = '1' then
288 wait on s_take; -- = '0'
290 elsif do_it = '1' then
291 -- dauert normalweiser noch laenger (parser braucht
294 wait on do_it; -- = '0'
295 icwait(sys_clk, 850);
299 -- assert(false) report "history_tb: kann passieren. wenn tb haengt, dann hier auskommentieren";
304 report "==================";
307 icwait(sys_clk, 850);
312 btn_pressed : process is
315 wait until sys_res_n = '1';
316 wait for 50000 * 15 ns;
317 wait until rising_edge(sys_clk);
322 end process btn_pressed;
323 end architecture sim;