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;
52 signal stop : boolean := false;
58 sys_res_n => sys_res_n,
63 s_backspace => s_backspace,
65 d_new_eingabe => d_new_eingabe,
66 d_new_result => d_new_result,
80 p_finished => p_finished,
83 pc_spalte => pc_spalte,
93 sys_res_n => sys_res_n,
95 d_new_eingabe => d_new_eingabe,
96 d_new_result => d_new_result,
105 command_data => command_data,
113 sys_res_n => sys_res_n,
121 p_finished => p_finished,
131 sys_res_n => sys_res_n,
133 new_data => new_data,
139 s_backspace => s_backspace,
148 sys_res_n => sys_res_n,
156 inst_pc_com : pc_communication
159 sys_res_n => sys_res_n,
167 rx_data => (others => '0'),
170 pc_zeile => pc_zeile,
171 pc_spalte => pc_spalte,
202 file f : text open read_mode is "../../src/history.test";
205 variable input : string(1 to 100);
207 variable run_tc, run_inner : boolean := true;
208 variable i, j, y : natural;
213 data <= (others => '0');
219 f_loop : while not endfile(f) loop
220 data <= (others => '0');
222 f1_loop : while not endfile(f) loop
224 input := (others => nul);
225 if (l'length <= 100) then
226 input(1 to l'length) := l.all;
227 if (input(1) = '#') then
233 report "fehler in history.test: eingabe zu lange in testfall " & natural'image(i);
238 report "testcase(" & natural'image(i) & ").input: " & input;
245 mainl : while run_tc loop
251 assert(false) report "wtf @ schleife";
258 when nul => data <= ascii2sc(x"1c"); -- $ (enter)
259 when '!' => data <= ascii2sc(x"0e"); -- ! (backspace)
267 when others => data <= ascii2sc(std_logic_vector(to_unsigned(character'pos(input(j)),8)));
270 -- ack'en skippen, falls es ein "spezielles" zeichen ist (steht
271 -- in abhaengigkeit zum vorherigen zeichen)
272 if(not valid_char(data)) then
276 -- wuenschswert waere das hier:
277 -- > wait on s_backspace, s_take, do_it;
278 -- geht aber leider nicht, weil sich die signale vllt schon
281 main_inner : while run_inner loop
285 if s_backspace = '1' or s_take = '1' then
287 wait on s_take; -- = '0'
289 elsif do_it = '1' then
290 -- dauert normalweiser noch laenger (parser braucht
293 wait on do_it; -- = '0'
294 icwait(sys_clk, 850);
298 -- assert(false) report "history_tb: kann passieren. wenn tb haengt, dann hier auskommentieren";
303 report "==================";
306 -- uart ist ziemlich langsam...
307 icwait(sys_clk, 1000000000);
312 btn_pressed : process is
315 wait until sys_res_n = '1';
316 icwait(sys_clk, 50000);
317 wait until rising_edge(sys_clk);
322 end process btn_pressed;
323 end architecture sim;