Skip to content

Commit 9bb97ff

Browse files
committed
dft: adding validation logic to the dft config
Signed-off-by: Felipe Garay <[email protected]>
1 parent c0c5ba7 commit 9bb97ff

File tree

9 files changed

+51
-1
lines changed

9 files changed

+51
-1
lines changed

src/dft/src/Dft.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ void Dft::pre_dft()
8484

8585
void Dft::previewDft(bool verbose)
8686
{
87+
dft_config_->validate(logger_);
88+
8789
for (const auto& [test_mode, test_mode_config] :
8890
dft_config_->getTestModesConfig()) {
8991
previewDft(test_mode_config, verbose);
@@ -124,6 +126,8 @@ void Dft::scanReplace()
124126

125127
void Dft::insertDft()
126128
{
129+
dft_config_->validate(logger_);
130+
127131
// iterate and call per test mode
128132
for (const auto& [_, test_mode_config] : dft_config_->getTestModesConfig()) {
129133
insertDft(test_mode_config);

src/dft/src/config/DftConfig.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
#include "DftConfig.hh"
3434

35+
#include <iostream>
36+
3537
namespace dft {
3638

3739
namespace {
@@ -85,4 +87,11 @@ DftConfig::getTestModesConfig() const
8587
return test_modes_config_;
8688
}
8789

90+
void DftConfig::validate(utl::Logger* logger) const
91+
{
92+
for (const auto& [test_mode_name, test_mode_config] : test_modes_config_) {
93+
test_mode_config.validate(logger);
94+
}
95+
}
96+
8897
} // namespace dft

src/dft/src/config/DftConfig.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ class DftConfig
5656
// Prints the information currently being used by DFT for config
5757
void report(utl::Logger* logger) const;
5858

59+
// Checks that the config is in a valid state. Reports issues in the logger
60+
void validate(utl::Logger* logger) const;
61+
5962
private:
6063
// A DFT config can have multiple test modes. If no test mode was defined by
6164
// the user, then we use the "default" test mode.

src/dft/src/config/ScanArchitectConfig.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3030
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3131
// POSSIBILITY OF SUCH DAMAGE.
32-
3332
#include "ScanArchitectConfig.hh"
3433

34+
#include <iostream>
35+
3536
#include "Formatting.hh"
3637

3738
namespace dft {
@@ -87,4 +88,13 @@ std::string ScanArchitectConfig::ClockMixingName(
8788
}
8889
}
8990

91+
void ScanArchitectConfig::validate(utl::Logger* logger) const
92+
{
93+
if (!max_chains_.has_value() && !max_length_.has_value()) {
94+
logger->warn(
95+
utl::DFT, 45, "Either max_chains or max_length should be specified");
96+
return;
97+
}
98+
}
99+
90100
} // namespace dft

src/dft/src/config/ScanArchitectConfig.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ class ScanArchitectConfig
6767
// Prints using logger->report the config used by Scan Architect
6868
void report(utl::Logger* logger) const;
6969

70+
// Checks that the config is in a valid state. Reports issues in the logger
71+
void validate(utl::Logger* logger) const;
72+
7073
static std::string ClockMixingName(ClockMixing clock_mixing);
7174

7275
private:

src/dft/src/config/ScanStitchConfig.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,9 @@ void ScanStitchConfig::report(utl::Logger* logger) const
7272
logger->report("- Scan Out Name Pattern: '{}'", out_name_pattern_);
7373
}
7474

75+
void ScanStitchConfig::validate(utl::Logger* logger) const
76+
{
77+
// TODO: For ScanStitchConfig we don't have anything to validate now
78+
}
79+
7580
} // namespace dft

src/dft/src/config/ScanStitchConfig.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
// POSSIBILITY OF SUCH DAMAGE.
3232
#pragma once
3333

34+
#include <optional>
35+
3436
#include "utl/Logger.h"
3537
#include "Macros.hh"
3638

@@ -54,6 +56,11 @@ class ScanStitchConfig
5456
// Prints using logger->report the config used by Scan Stitch
5557
void report(utl::Logger* logger) const;
5658

59+
// Checks that the config is in a valid state. Reports issues in the logger
60+
// TODO: For ScanStitchConfig we don't have anything to validate now, it
61+
// always returns std::nullopt
62+
void validate(utl::Logger* logger) const;
63+
5764
private:
5865
std::string enable_name_pattern_ = "scan_enable_{}";
5966
std::string in_name_pattern_ = "scan_in_{}";

src/dft/src/config/TestModeConfig.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,10 @@ const std::string& TestModeConfig::getName() const
6565
return name_;
6666
}
6767

68+
void TestModeConfig::validate(utl::Logger* logger) const
69+
{
70+
scan_architect_config_.validate(logger);
71+
scan_stitch_config_.validate(logger);
72+
}
73+
6874
} // namespace dft

src/dft/src/config/TestModeConfig.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class TestModeConfig
5454

5555
const std::string& getName() const;
5656

57+
// Checks that the config is in a valid state. Reports issues in the logger
58+
void validate(utl::Logger* logger) const;
59+
5760
private:
5861
std::string name_;
5962
ScanArchitectConfig scan_architect_config_;

0 commit comments

Comments
 (0)