1 // -*- mode: C++; c-file-style: "cc-mode" -*-
2 //*************************************************************************
3 // DESCRIPTION: verilator_coverage: Top global container
4 //
5 // Code available from: https://verilator.org
6 //
7 //*************************************************************************
8 //
9 // Copyright 2003-2021 by Wilson Snyder. This program is free software; you
10 // can redistribute it and/or modify it under the terms of either the GNU
11 // Lesser General Public License Version 3 or the Perl Artistic License
12 // Version 2.0.
13 // SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
14 //
15 //*************************************************************************
16 
17 #ifndef VERILATOR_VLCTOP_H_
18 #define VERILATOR_VLCTOP_H_
19 
20 #include "config_build.h"
21 #include "verilatedos.h"
22 
23 #include "VlcOptions.h"
24 #include "VlcTest.h"
25 #include "VlcPoint.h"
26 #include "VlcSource.h"
27 
28 //######################################################################
29 // VlcTop - Top level options container
30 
31 class VlcTop final {
32 public:
33     // PUBLIC MEMBERS
34     VlcOptions opt;  //< Runtime options
35 private:
36     // MEMBERS
37     VlcTests m_tests;  //< List of all tests (all coverage files)
38     VlcPoints m_points;  //< List of all points
39     VlcSources m_sources;  //< List of all source files to annotate
40 
41     // METHODS
42     void annotateCalc();
43     void annotateCalcNeeded();
44     void annotateOutputFiles(const string& dirname);
45 
46 public:
47     // CONSTRUCTORS
48     VlcTop() = default;
49     ~VlcTop() = default;
50 
51     // ACCESSORS
tests()52     VlcTests& tests() { return m_tests; }
points()53     VlcPoints& points() { return m_points; }
sources()54     VlcSources& sources() { return m_sources; }
55 
56     // METHODS
57     void annotate(const string& dirname);
58     void readCoverage(const string& filename, bool nonfatal = false);
59     void writeCoverage(const string& filename);
60     void writeInfo(const string& filename);
61 
62     void rank();
63 };
64 
65 //######################################################################
66 
67 #endif  // guard
68