Commit 8301a504 authored by Evangelia Gousiou's avatar Evangelia Gousiou

added glitch filter test

parent 1351d6b2
This diff is collapsed.
......@@ -276,17 +276,18 @@ end component conv_ttl_rs485;
constant send_val : in std_logic_vector(31 downto 0);
err : out natural);
procedure read_i2c (signal i2c_m_in : out t_i2c_master_in;
signal i2c_m_out: in t_i2c_master_out;
constant slv_addr : in std_logic_vector(6 downto 0);
constant reg_addr : in std_logic_vector(31 downto 0);
constant reg_name : string(1 to 8);
signal rcvd_val : out std_logic_vector(31 downto 0);
constant exp_val : in std_logic_vector(31 downto 0);
err : out natural);
procedure read_i2c_err (signal i2c_m_in : out t_i2c_master_in;
signal i2c_m_out : in t_i2c_master_out);
procedure read_i2c (signal i2c_m_in : out t_i2c_master_in;
signal i2c_m_out : in t_i2c_master_out;
constant slv_addr : in std_logic_vector(6 downto 0);
constant reg_addr : in std_logic_vector(31 downto 0);
constant reg_name : string(1 to 8);
signal rcvd_val : out std_logic_vector(31 downto 0);
constant exp_val : in std_logic_vector(31 downto 0);
constant eval_result : in boolean;
err : out natural);
-- procedure read_i2c_err (signal i2c_m_in : out t_i2c_master_in;
-- signal i2c_m_out : in t_i2c_master_out);
end testbench_pkg;
package body testbench_pkg is
......@@ -355,7 +356,7 @@ package body testbench_pkg is
end if;
numb_cnt:= numb_cnt + 1;
end loop;
wait for ns_off;
wait for 500ns; -- wait for all pulses to propagate to the output
end procedure generate_pulse;
......@@ -390,6 +391,7 @@ package body testbench_pkg is
constant reg_name : string(1 to 8);
signal rcvd_val : out std_logic_vector(31 downto 0);
constant exp_val : in std_logic_vector(31 downto 0);
constant eval_result : in boolean;
err : out natural) is
variable err_cnt : natural := 0;
begin
......@@ -413,13 +415,16 @@ package body testbench_pkg is
" is 0x",i2c_m_out.i2c_master_rcvd_val);
wait until i2c_m_out.i2c_master_finish = '0';
print_now("read_i2c: completed");
if i2c_m_out.i2c_master_rcvd_val = exp_val then
print_now_s_s("[OK] Correct reading from reg ", reg_name, "; expected value matches read value");
else
print_now_s_std_s_std("[ERR]: Read value from " & reg_name & ": ", i2c_m_out.i2c_master_rcvd_val,
"; expected value: ",exp_val);
err_cnt := err_cnt +1;
end if;
if eval_result = TRUE then
if i2c_m_out.i2c_master_rcvd_val = exp_val then
print_now_s_s("[OK] Correct reading from reg ", reg_name, "; expected value matches read value");
else
print_now_s_std_s_std("[ERR]: Read value from " & reg_name & ": ", i2c_m_out.i2c_master_rcvd_val,
"; expected value: ",exp_val);
err_cnt := err_cnt +1;
end if;
end if;
err := err_cnt;
print_now("---------------");
end procedure read_i2c;
......@@ -459,27 +464,6 @@ package body testbench_pkg is
----------------------------------------------------------------------------------------------------
procedure read_i2c_err (signal i2c_m_in : out t_i2c_master_in;
signal i2c_m_out : in t_i2c_master_out) is
variable err_cnt : natural := 0;
begin
print_now("---------------");
print_now("read_i2c_err: start");
i2c_m_in.i2c_master_start <= '0';
i2c_m_in.i2c_master_rdwr <= '0'; --mst_fsm_op
i2c_m_in.i2c_master_slv_addr <= "1011111";
i2c_m_in.i2c_master_reg_addr <= (others => '0');
i2c_m_in.i2c_master_send_val <= (others => '1');
wait for 1us;
i2c_m_in.i2c_master_slv_addr <= "1011111";
i2c_m_in.i2c_master_reg_addr <= x"F1F1F1F1";
i2c_m_in.i2c_master_start <= '1';
i2c_m_in.i2c_master_rdwr <= '1'; --read
wait for C_CLK_20_PER;
i2c_m_in.i2c_master_start <= '0';
wait until i2c_m_out.i2c_master_ready = '1';
print_now("---------------");
end procedure read_i2c_err;
end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment