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;
49 signal pc_busy : std_logic;
51 signal btn_a_int : std_logic;
54 signal stop : boolean := false;
57 inst : entity work.history(beh)
60 sys_res_n => sys_res_n,
65 s_backspace => s_backspace,
67 d_new_eingabe => d_new_eingabe,
68 d_new_result => d_new_result,
82 p_finished => p_finished,
85 pc_spalte => pc_spalte,
93 inst_disp : entity work.display(beh)
96 sys_res_n => sys_res_n,
98 d_new_eingabe => d_new_eingabe,
99 d_new_result => d_new_result,
100 d_new_bs => d_new_bs,
102 d_spalte => d_spalte,
108 command_data => command_data,
113 inst_parser : entity work.parser(beh)
116 sys_res_n => sys_res_n,
124 p_finished => p_finished,
131 inst_scan : entity work.scanner(beh)
134 sys_res_n => sys_res_n,
136 new_data => new_data,
142 s_backspace => s_backspace,
148 inst_uart : entity work.uart_tx(beh)
151 sys_res_n => sys_res_n,
159 inst_pc_com : entity work.pc_communication(beh)
162 sys_res_n => sys_res_n,
170 rx_data => (others => '0'),
173 pc_zeile => pc_zeile,
174 pc_spalte => pc_spalte,
206 file f : text open read_mode is "../../src/history.test";
209 variable input : string(1 to 100);
211 variable run_tc, run_inner : boolean := true;
212 variable i, j, y : natural;
217 data <= (others => '0');
223 f_loop : while not endfile(f) loop
224 data <= (others => '0');
226 f1_loop : while not endfile(f) loop
228 input := (others => nul);
229 if (l'length <= 100) then
230 input(1 to l'length) := l.all;
231 if (input(1) = '#') then
237 report "fehler in history.test: eingabe zu lange in testfall " & natural'image(i);
242 report "testcase(" & natural'image(i) & ").input: " & input;
249 mainl : while run_tc loop
255 assert(false) report "wtf @ schleife";
262 when nul => data <= ascii2sc(x"1c"); -- $ (enter)
263 when '!' => data <= ascii2sc(x"0e"); -- ! (backspace)
271 when others => data <= ascii2sc(std_logic_vector(to_unsigned(character'pos(input(j)),8)));
274 -- ack'en skippen, falls es ein "spezielles" zeichen ist (steht
275 -- in abhaengigkeit zum vorherigen zeichen)
276 if(not valid_char(data)) then
280 -- wuenschswert waere das hier:
281 -- > wait on s_backspace, s_take, do_it;
282 -- geht aber leider nicht, weil sich die signale vllt schon
285 main_inner : while run_inner loop
289 if s_backspace = '1' or s_take = '1' then
291 wait on s_take; -- = '0'
293 elsif do_it = '1' then
294 -- dauert normalweiser noch laenger (parser braucht
297 wait on do_it; -- = '0'
298 icwait(sys_clk, 850);
302 -- assert(false) report "history_tb: kann passieren. wenn tb haengt, dann hier auskommentieren";
307 report "==================";
310 icwait(sys_clk, 850);
315 btn_pressed : process is
318 wait until sys_res_n = '1';
319 wait for 50000 * 15 ns;
320 wait until rising_edge(sys_clk);
325 end process btn_pressed;
326 end architecture sim;