-- system
signal sys_clk, sys_res_n : std_logic;
-- history
- signal p_rw, p_rget, p_rdone, p_wtake, p_wdone, p_finished : std_logic;
+ signal p_rget, p_rdone, p_wtake, p_wdone, p_finished : std_logic;
signal p_read, p_write : hbyte;
- signal p_spalte : hspalte;
-
- -- alu
- signal opcode : alu_ops;
- signal op1, op2, op3 : csigned;
- signal do_calc, calc_done : std_logic;
-
--scanner
signal do_it : std_logic;
signal finished : std_logic;
(
sys_clk => sys_clk,
sys_res_n => sys_res_n,
- p_rw => p_rw,
- p_spalte => p_spalte,
+ -- history
p_rget => p_rget,
p_rdone => p_rdone,
p_read => p_read,
p_wdone => p_wdone,
p_write => p_write,
p_finished => p_finished,
- -- ALU
- opcode => opcode,
- op1 => op1,
- op2 => op2,
- op3 => op3,
- do_calc => do_calc,
- calc_done => calc_done,
- -- TODO: calc_error : in std_logic;
-- Scanner
do_it => do_it,
finished => finished
);
- instalu : entity work.alu(beh)
- port map
- (
- sys_clk => sys_clk,
- sys_res_n => sys_res_n,
- do_calc => do_calc,
- calc_done => calc_done,
- op1 => op1,
- op2 => op2,
- op3 => op3,
- opcode => opcode
- );
-
process
begin
sys_clk <= '0';
variable input : hstring;
variable expectedresult : hstring;
variable realresult : hstring;
+ variable hstrtmp : hstring;
variable checkall : boolean := true;
variable run_tc : boolean := true;
- variable i, j, k : natural;
+ variable i, j, k, y : natural;
begin
-- init & reset
sys_res_n <= '0';
i := 1;
f_loop : while not endfile(f) loop
- realresult := (others => character'val(0));
+ realresult := (HSPALTE_MAX+1 => nul, others => ' ');
f1_loop : while not endfile(f) loop
readline (f, l);
- input := (others => character'val(0));
- if (l'length <= 72) then
+ input := (others => nul);
+ if (l'length <= HSPALTE_MAX+1) then
input(1 to l'length) := l.all;
if (input(1) = '#') then
next f1_loop;
f2_loop : while not endfile(f) loop
readline (f, l);
- expectedresult := (others => character'val(0));
- if (l'length <= 72) then
+ expectedresult := (others => nul);
+ if (l'length <= HSPALTE_MAX+1) then
expectedresult(1 to l'length) := l.all;
if (expectedresult(1) = '#') then
next f2_loop;
else
+ y := l'length;
exit f2_loop;
end if;
else
end if;
end loop f2_loop;
+ -- ergebnis string richtig formatieren
+ hstrtmp := expectedresult;
+ expectedresult := (HSPALTE_MAX+1 => nul, others => ' ');
+ for x in 1 to HSPALTE_MAX loop
+ if hstrtmp(x) /= nul then
+ expectedresult((HSPALTE_MAX-y) + x) := hstrtmp(x);
+ end if;
+ end loop;
+
+
report "testcase(" & natural'image(i) & ").input: " & input;
report "testcase(" & natural'image(i) & ").expectedresult: " & expectedresult;
i := i + 1;
icwait(sys_clk, 5);
do_it <= '1';
run_tc := true;
- j := 1; k := 1;
+ j := 1; k := HSPALTE_MAX;
while run_tc loop
wait on p_rget, p_wtake, p_finished, finished;
if p_wtake = '1' then
realresult(k) := character'val(to_integer(unsigned(p_write)));
p_wdone <= '1';
- k := k + 1;
+ k := k - 1;
end if;
if p_wtake = '0' then
p_wdone <= '0';
end loop;
do_it <= '0';
- report "realresult: " & realresult;
+ report "realresult : " & realresult;
if realresult /= expectedresult then
checkall := false;
end if;