tsfpga VHDL coverage


Directory: generated/vunit_out/preprocessed/
File: generated/vunit_out/preprocessed/common/tb_addr_pkg.vhd
Date: 2021-07-25 04:08:32
Exec Total Coverage
Lines: 23 23 100.0%
Branches: 76 120 63.3%

Line Branch Exec Source
1 18 -- -------------------------------------------------------------------------------------------------
2 -- Copyright (c) Lukas Vik. All rights reserved.
3 --
4 -- This file is part of the tsfpga project.
5 -- https://tsfpga.com
6 -- https://gitlab.com/tsfpga/tsfpga
7 -- -------------------------------------------------------------------------------------------------
8
9 library ieee;
10 use ieee.std_logic_1164.all;
11 use ieee.numeric_std.all;
12
13 library vunit_lib;
14 context vunit_lib.vunit_context;
15
16 use work.addr_pkg.all;
17
18
19
28/56
✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 3 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 12 taken 3 times.
✗ Branch 13 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 3 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 3 times.
✓ Branch 21 taken 3 times.
✗ Branch 22 not taken.
✗ Branch 24 not taken.
✓ Branch 25 taken 3 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 3 times.
✓ Branch 30 taken 3 times.
✗ Branch 31 not taken.
✓ Branch 33 taken 3 times.
✗ Branch 34 not taken.
✓ Branch 36 taken 3 times.
✗ Branch 37 not taken.
✓ Branch 39 taken 3 times.
✗ Branch 40 not taken.
✓ Branch 42 taken 3 times.
✗ Branch 43 not taken.
✗ Branch 45 not taken.
✓ Branch 46 taken 3 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 3 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 3 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 3 times.
✓ Branch 57 taken 3 times.
✗ Branch 58 not taken.
✗ Branch 60 not taken.
✓ Branch 61 taken 3 times.
✓ Branch 63 taken 3 times.
✗ Branch 64 not taken.
✓ Branch 66 taken 3 times.
✗ Branch 67 not taken.
✓ Branch 69 taken 3 times.
✗ Branch 70 not taken.
✓ Branch 72 taken 3 times.
✗ Branch 73 not taken.
✓ Branch 75 taken 3 times.
✗ Branch 76 not taken.
✓ Branch 78 taken 3 times.
✗ Branch 79 not taken.
✓ Branch 81 taken 3 times.
✗ Branch 82 not taken.
33 entity tb_addr_pkg is
20 generic (
21 runner_cfg : string
22 );
23 end entity;
24
25 architecture tb of tb_addr_pkg is
26
27 21 constant addrs : addr_and_mask_vec_t(0 to 6 - 1) := (
28 0 => (addr => x"0000_0000", mask => x"0000_f000"),
29 1 => (addr => x"0000_1000", mask => x"0000_f000"),
30 2 => (addr => x"0000_2000", mask => x"0000_ff00"),
31 3 => (addr => x"0000_2100", mask => x"0000_ff00"),
32 4 => (addr => x"0000_3000", mask => x"0000_f000"),
33 5 => (addr => x"0000_4000", mask => x"0000_f000")
34 );
35
36 12 constant addrs2 : addr_and_mask_vec_t(0 to 2 - 1) := (
37 0 => (addr => x"0120_0000", mask => x"01f0_0000"),
38 1 => (addr => x"0130_0000", mask => x"01f0_0000")
39 );
40
41 begin
42
43 3 main : process
44 30 variable value : signed(5 - 1 downto 0);
45
46 -- Use this function to get addr vector constrained
47 function decode(addr : unsigned(32 - 1 downto 0)) return integer is
48 begin
49
30/32
✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1 times.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 1 times.
✓ Branch 14 taken 1 times.
✓ Branch 15 taken 1 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 1 times.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 1 times.
✓ Branch 20 taken 1 times.
✓ Branch 21 taken 1 times.
✓ Branch 22 taken 1 times.
✓ Branch 23 taken 1 times.
✓ Branch 24 taken 1 times.
✓ Branch 25 taken 1 times.
✓ Branch 26 taken 1 times.
✓ Branch 27 taken 1 times.
✓ Branch 28 taken 3 times.
✓ Branch 29 taken 3 times.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
52 return decode(addr, addrs);
50 end function;
51
52 begin
53
2/2
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 3 times.
9 test_runner_setup(runner, runner_cfg);
54
55
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 2 times.
3 if run("test_addr_bits_needed") then
56
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
2 check_equal(addr_bits_needed(addrs), 16, line_num => 56, file_name => "tb_addr_pkg.vhd");
57
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
3 check_equal(addr_bits_needed(addrs2), 25, line_num => 57, file_name => "tb_addr_pkg.vhd");
58
59
2/2
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
2 elsif run("test_decode_happy_path") then
60
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_0000"), 0, line_num => 60, file_name => "tb_addr_pkg.vhd");
61
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_1000"), 1, line_num => 61, file_name => "tb_addr_pkg.vhd");
62
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_2000"), 2, line_num => 62, file_name => "tb_addr_pkg.vhd");
63
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_2100"), 3, line_num => 63, file_name => "tb_addr_pkg.vhd");
64
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_3000"), 4, line_num => 64, file_name => "tb_addr_pkg.vhd");
65
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
3 check_equal(decode(x"43C0_4000"), 5, line_num => 65, file_name => "tb_addr_pkg.vhd");
66
67
1/2
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
4 elsif run("test_decode_fail") then
68
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_2200"), addrs'length, line_num => 68, file_name => "tb_addr_pkg.vhd");
69
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
2 check_equal(decode(x"43C0_2300"), addrs'length, line_num => 69, file_name => "tb_addr_pkg.vhd");
70
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
3 check_equal(decode(x"43C0_5000"), addrs'length, line_num => 70, file_name => "tb_addr_pkg.vhd");
71 end if;
72
73
0/2
✗ Branch 3 not taken.
✗ Branch 4 not taken.
43 test_runner_cleanup(runner);
74 end process;
75
76 end architecture;
77