1 // -*- mode: C++; c-file-style: "cc-mode" -*-
2 //*************************************************************************
3 // DESCRIPTION: verilator_coverage: Command line options
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_VLCOPTIONS_H_
18 #define VERILATOR_VLCOPTIONS_H_
19 
20 #include "config_build.h"
21 #include "verilatedos.h"
22 
23 #include "config_rev.h"
24 
25 #include <map>
26 #include <set>
27 #include <vector>
28 
29 //######################################################################
30 // V3Options - Command line options
31 
32 using VlStringSet = std::set<std::string>;
33 
34 class VlcOptions final {
35     // MEMBERS (general options)
36     // clang-format off
37     string m_annotateOut;       // main switch: --annotate I<output_directory>
38     bool m_annotateAll = false;  // main switch: --annotate-all
39     int m_annotateMin = 10;     // main switch: --annotate-min I<count>
40     VlStringSet m_readFiles;    // main switch: --read
41     bool m_rank = false;        // main switch: --rank
42     bool m_unlink = false;      // main switch: --unlink
43     string m_writeFile;         // main switch: --write
44     string m_writeInfoFile;     // main switch: --write-info
45     // clang-format on
46 
47 private:
48     // METHODS
49     static void showVersion(bool verbose);
50 
51 public:
52     // CONSTRUCTORS
53     VlcOptions() = default;
54     ~VlcOptions() = default;
55 
56     // METHODS
57     void parseOptsList(int argc, char** argv);
58     void addReadFile(const string& filename);
59 
60     // ACCESSORS (options)
readFiles()61     const VlStringSet& readFiles() const { return m_readFiles; }
annotateOut()62     string annotateOut() const { return m_annotateOut; }
annotateAll()63     bool annotateAll() const { return m_annotateAll; }
annotateMin()64     int annotateMin() const { return m_annotateMin; }
rank()65     bool rank() const { return m_rank; }
unlink()66     bool unlink() const { return m_unlink; }
writeFile()67     string writeFile() const { return m_writeFile; }
writeInfoFile()68     string writeInfoFile() const { return m_writeInfoFile; }
69 
70     // METHODS (from main)
71     static string version();
72 };
73 
74 //######################################################################
75 
76 #endif  // guard
77