GCC Code Coverage Report
Directory: generated/vunit_out/preprocessed/ Exec Total Coverage
File: generated/vunit_out/preprocessed/reg_file/tb_reg_file_pkg.vhd Lines: 16 16 100.0 %
Date: 2021-06-12 04:12:08 Branches: 29 58 50.0 %

Line Branch Exec Source
1
6
-- -------------------------------------------------------------------------------------------------
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
library common;
17
use common.addr_pkg.all;
18
19
use work.reg_file_pkg.all;
20
21
22














21
entity tb_reg_file_pkg is
23
  generic (
24
    runner_cfg : string
25
  );
26
end entity;
27
28
2
architecture tb of tb_reg_file_pkg is
29
begin
30
31
1
  main : process
32
1
    constant regs_3 : reg_definition_vec_t(0 to 3 - 1) := (
33
      (idx => 0, reg_type => r_w),
34
      (idx => 1, reg_type => r_w),
35
      (idx => 2, reg_type => r_w)
36
    );
37
1
    constant regs_4 : reg_definition_vec_t(0 to 4 - 1) := (
38
      (idx => 0, reg_type => r_w),
39
      (idx => 1, reg_type => r_w),
40
      (idx => 2, reg_type => r_w),
41
      (idx => 3, reg_type => r_w)
42
    );
43
1
    constant regs_5 : reg_definition_vec_t(0 to 5 - 1) := (
44
      (idx => 0, reg_type => r_w),
45
      (idx => 1, reg_type => r_w),
46
      (idx => 2, reg_type => r_w),
47
      (idx => 3, reg_type => r_w),
48
      (idx => 4, reg_type => r_w)
49
    );
50
37
    variable expected : addr_t;
51
  begin
52
3
    test_runner_setup(runner, runner_cfg);
53
54
1
    if run("get_addr_mask") then
55
1
      expected := b"0000_0000_0000_0000_0000_0000_0000_1100";
56
2
      check_equal(get_addr_mask(regs_3), expected, line_num => 56, file_name => "tb_reg_file_pkg.vhd");
57
2
      check_equal(get_addr_mask(regs_4), expected, line_num => 57, file_name => "tb_reg_file_pkg.vhd");
58
59
1
      expected := b"0000_0000_0000_0000_0000_0000_0001_1100";
60
3
      check_equal(get_addr_mask(regs_5), expected, line_num => 60, file_name => "tb_reg_file_pkg.vhd");
61
    end if;
62
63
13
    test_runner_cleanup(runner);
64
  end process;
65
66
end architecture;