PlTbUtils  1.3
PlTbUtils is a collection of functions, procedures and components for easily creating stimuli and checking response in automatic self-checking testbenches.
tc1.vhd
Go to the documentation of this file.
1 
37 
38 library ieee;
39 use ieee.std_logic_1164.all;
40 use ieee.numeric_std.all;
41 use work.txt_util.all;
42 use work.pltbutils_func_pkg.all;
43 
46 architecture tc1 of tc_example2 is
47 begin
48  p_tc1 : process
49  variable pltbv : pltbv_t := C_PLTBV_INIT;
50  begin
51  startsim("tc1", "", pltbv, pltbs);
52  rst <= '1';
53  carry_in <= '0';
54  x <= (others => '0');
55  y <= (others => '0');
56 
57  starttest(1, "Reset test", pltbv, pltbs);
58  waitclks(2, clk, pltbv, pltbs);
59  check("Sum during reset", sum, 0, pltbv, pltbs);
60  check("Carry out during reset", carry_out, '0', pltbv, pltbs);
61  rst <= '0';
62  endtest(pltbv, pltbs);
63 
64  starttest(2, "Simple sum test", pltbv, pltbs);
65  carry_in <= '0';
66  x <= std_logic_vector(to_unsigned(1, x'length));
67  y <= std_logic_vector(to_unsigned(2, x'length));
68  waitclks(2, clk, pltbv, pltbs);
69  check("Sum", sum, 3, pltbv, pltbs);
70  check("Carry out", carry_out, '0', pltbv, pltbs);
71  endtest(pltbv, pltbs);
72 
73  starttest(3, "Simple carry in test", pltbv, pltbs);
74  print(G_DISABLE_BUGS=0, pltbv, pltbs, "Bug here somewhere");
75  carry_in <= '1';
76  x <= std_logic_vector(to_unsigned(1, x'length));
77  y <= std_logic_vector(to_unsigned(2, x'length));
78  waitclks(2, clk, pltbv, pltbs);
79  check("Sum", sum, 4, pltbv, pltbs);
80  check("Carry out", carry_out, '0', pltbv, pltbs);
81  print(G_DISABLE_BUGS=0, pltbv, pltbs, "");
82  endtest(pltbv, pltbs);
83 
84  starttest(4, "Simple carry out test", pltbv, pltbs);
85  carry_in <= '0';
86  x <= std_logic_vector(to_unsigned(2**G_WIDTH-1, x'length));
87  y <= std_logic_vector(to_unsigned(1, x'length));
88  waitclks(2, clk, pltbv, pltbs);
89  check("Sum", sum, 0, pltbv, pltbs);
90  check("Carry out", carry_out, '1', pltbv, pltbs);
91  endtest(pltbv, pltbs);
92 
93  endsim(pltbv, pltbs, true);
94  wait;
95  end process p_tc1;
96 end architecture tc1;
This package defines fuctions and procedures for controlling stimuli to a DUT and checking response.
out rst std_logic
Definition: tc_example2.vhd:49
out carry_in std_logic
Definition: tc_example2.vhd:50
G_WIDTH integer := 8
Definition: tc_example2.vhd:43
in carry_out std_logic
Definition: tc_example2.vhd:55
in clk std_logic
Definition: tc_example2.vhd:48
out pltbs pltbs_t
Definition: tc_example2.vhd:47
in sum std_logic_vector( G_WIDTH- 1 downto 0)
Definition: tc_example2.vhd:53
out y std_logic_vector( G_WIDTH- 1 downto 0)
Definition: tc_example2.vhd:52
G_DISABLE_BUGS integer range 0 to 1:= 0
Definition: tc_example2.vhd:45
out x std_logic_vector( G_WIDTH- 1 downto 0)
Definition: tc_example2.vhd:51
Defines useful functions an procedures for text handling text in VHDL.
Definition: txt_util.vhd:31