From d6ef1dbf0d1647cf9139b1f9b9580eba6a730d51 Mon Sep 17 00:00:00 2001 From: Fabian Posch Date: Thu, 11 Jan 2024 17:32:09 -0500 Subject: [PATCH] add sim output artifact and move some of the data into publicly readable variables --- include/artifact.hpp | 116 +++++++++++++++++++++++++++++++++++++++++++ src/artifact.cpp | 16 ++++++ 2 files changed, 132 insertions(+) diff --git a/include/artifact.hpp b/include/artifact.hpp index 9e7fe80..b09662a 100644 --- a/include/artifact.hpp +++ b/include/artifact.hpp @@ -29,6 +29,7 @@ #include #include #include +#include "db_types.hpp" #include "util.h" namespace pl { @@ -74,6 +75,31 @@ class Artifact { public: + /** + * @brief Construct a new blank Artifact + * + */ + Artifact(); + + /** + * @brief Construct a new Artifact with a database UUID attached to it. + * + * This should be used when downloading the artifact from the database. + * This ID is actually required when an update in the database is required. + * + * @param id + */ + Artifact(db::uuid_t& id); + + /** + * @brief The ID of this object in the database + * + * This ID will be 0 if this artifact is not tied to anything in the + * database yet, as IDs are assigned on first upload. + * + */ + const db::uuid_t& id = id_; + /** * @brief Get the type of the artifact the object is holding. * @@ -102,6 +128,26 @@ class Artifact { * @return long The number of elements in this artifact */ virtual long get_size() = 0; + + + /** + * @brief Inform a tool whether this artifact can be handled by multiple nodes + * + * By default, one artifact should only be handled once. However, there might be + * situations where multiple nodes can handle a single artifact. This could for example + * be a situation where a simulation for a design has a coverage model for constrained + * random testing. In this case we want to cover everything as fast as possible and + * simulation can be distributed. + * + * @return true The artifact can be handled by multiple nodes + * @return false The artifact cannot be handled by multiple nodes + */ + bool parallelizable() { return false; }; + + protected: + + db::uuid_t id_; + }; @@ -154,6 +200,8 @@ class ActArtifact: public Artifact { struct testcase_t { /** Commands to be executed for this testcase */ std::vector commands; + /** This simulation should be run by multiple noes */ + bool parallelizable; /** Maximum pipeline load factor that should be allowed */ float max_plf; }; @@ -164,6 +212,14 @@ struct testcase_t { class SimConfigArtifact: public Artifact { public: + SimConfigArtifact(); + SimConfigArtifact(db::uuid_t& id, db::uuid_t& design); + + /** + * @brief The UUID of the design this simulation uses + */ + const db::uuid_t& design = design_; + /** * @brief Get the content of the artifact * @@ -195,9 +251,27 @@ class SimConfigArtifact: public Artifact { */ long get_size() { return testcases.size(); }; + /** + * @brief Can this simulation be handled by multiple nodes + * + * By default, one artifact should only be handled once. However, there might be + * situations where multiple nodes can handle a single artifact. This could for example + * be a situation where a simulation for a design has a coverage model for constrained + * random testing. In this case we want to cover everything as fast as possible and + * simulation can be distributed. + * + * @return true The simulation can be handled by multiple nodes + * @return false The simulation cannot be handled by multiple nodes + */ + bool parallelizable() { + if (this->testcases.size() != 1) return false; + return this->testcases.front().parallelizable; + }; + private: std::vector testcases; + db::uuid_t design_; }; /** Reference to a signal in an ACT design */ @@ -245,6 +319,48 @@ class SignalListArtifact: public Artifact { std::vector signals; }; +/** + * @brief Artifact containing simulator output from actsim + */ +class SimOutputArtifact: public Artifact { + public: + + /** + * @brief Get the content of the artifact + * + * @return std::vector Vector of all generated simulator output lines + */ + std::vector& get_content() { return sim_log; }; + + + /** + * @brief Add a log line to the artifact + * + * @param log_line + */ + void add_log_output(std::string log_line); + + + /** + * @brief Returns the type of this artifact, which is SIM_OUTPUT. + * + * @return ArtifactType Will return the SIM_OUTPUT artifact type. + */ + constexpr ArtifactType get_type() override { return ArtifactType::SIM_OUTPUT; }; + + + /** + * @brief Get the number of log lines stored in this artifact + * + * @return long The size of the log lines vector + */ + long get_size() { return sim_log.size(); }; + + private: + + std::vector sim_log; +}; + }; #endif diff --git a/src/artifact.cpp b/src/artifact.cpp index 06e2826..9a741dd 100644 --- a/src/artifact.cpp +++ b/src/artifact.cpp @@ -26,12 +26,28 @@ namespace pl { +Artifact::Artifact() {} + +Artifact::Artifact(db::uuid_t& id) { + this->id_ = id; +} + void SimConfigArtifact::add_testcase(testcase_t testcase) { this->testcases.emplace_back(testcase); } +SimConfigArtifact::SimConfigArtifact() {} + +SimConfigArtifact::SimConfigArtifact(db::uuid_t& id, db::uuid_t& design) : Artifact(id) { + this->design_ = design; +} + void SignalListArtifact::add_signal(signal_t signal) { this->signals.emplace_back(signal); } +void SimOutputArtifact::add_log_output(std::string log_line) { + this->sim_log.emplace_back(log_line); +} + }