diff options
author | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-20 19:51:41 +0000 |
---|---|---|
committer | Kevin Cheng <kevin.cheng@arm.com> | 2021-10-26 19:09:45 +0000 |
commit | 1009674513d09af1a699a8bf0f646c7130d7a0ac (patch) | |
tree | 87d5aa66371d6608be2021826611ad4c0dd85523 /reference_model/src/main.cpp | |
parent | 8c06a6547a132f0a22fa34d467026f12fabb4e1f (diff) | |
download | reference_model-1009674513d09af1a699a8bf0f646c7130d7a0ac.tar.gz |
Add version to reference model
- update serialization_lib hash
- check model version against serializer version
- add "-v" to command line option to print out model version
Signed-off-by: Kevin Cheng <kevin.cheng@arm.com>
Change-Id: I554cf0fdead22e7e5f91d2e98831459286c40a2d
Diffstat (limited to 'reference_model/src/main.cpp')
-rw-r--r-- | reference_model/src/main.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/reference_model/src/main.cpp b/reference_model/src/main.cpp index 0bf0697..71d8885 100644 --- a/reference_model/src/main.cpp +++ b/reference_model/src/main.cpp @@ -25,6 +25,11 @@ #include <fstream> #include <nlohmann/json.hpp> +#define MODEL_VERSION_MAJOR 0 +#define MODEL_VERSION_MINOR 23 +#define MODEL_VERSION_PATCH 0 +#define MODEL_VERSION_DRAFT true + using namespace TosaReference; using namespace tosa; using json = nlohmann::json; @@ -40,17 +45,34 @@ int loadGraph(TosaSerializationHandler& tsh, json test_desc); int main(int argc, const char** argv) { + TosaVersion model_version(MODEL_VERSION_MAJOR, MODEL_VERSION_MINOR, MODEL_VERSION_PATCH, MODEL_VERSION_DRAFT); + // Initialize configuration and debug subsystems func_model_init_config(); func_model_set_default_config(&g_func_config); func_init_debug(&g_func_debug, 0); - TosaSerializationHandler tsh; - if (func_model_parse_cmd_line(&g_func_config, &g_func_debug, argc, argv)) + if (func_model_parse_cmd_line(&g_func_config, &g_func_debug, argc, argv, model_version.to_string().c_str())) { return 1; } + TosaSerializationHandler tsh; + TosaVersion::compat_t is_compat = model_version.is_compatible(tsh.GetVersion()); + switch (is_compat) + { + case TosaVersion::compat_t::COMPLETELY_COMPATIBLE: + break; + case TosaVersion::compat_t::PARTIALLY_COMPATIBLE: + printf("WARNING: Reference model version %s is partially compatible with serializer version %s\n", + model_version.to_string().c_str(), tsh.GetVersion().to_string().c_str()); + break; + case TosaVersion::compat_t::NOT_COMPATIBLE: + printf("ERROR: Reference model version %s is not compatible with serializer version %s\n", + model_version.to_string().c_str(), tsh.GetVersion().to_string().c_str()); + return TOSA_VERSION_MISMATCH; + } + json test_desc; // Initialize test descriptor |