aboutsummaryrefslogtreecommitdiffhomepage
path: root/externals/biscuit/examples/cpuinfo/cpuinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/biscuit/examples/cpuinfo/cpuinfo.cpp')
-rw-r--r--externals/biscuit/examples/cpuinfo/cpuinfo.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/externals/biscuit/examples/cpuinfo/cpuinfo.cpp b/externals/biscuit/examples/cpuinfo/cpuinfo.cpp
new file mode 100644
index 00000000..450dfbdb
--- /dev/null
+++ b/externals/biscuit/examples/cpuinfo/cpuinfo.cpp
@@ -0,0 +1,31 @@
+// Copyright (c), 2022, KNS Group LLC (YADRO)
+//
+// Use of this source code is governed by an MIT-style
+// license that can be found in the LICENSE file or at
+// https://opensource.org/licenses/MIT.
+
+#include <biscuit/assembler.hpp>
+#include <biscuit/cpuinfo.hpp>
+
+#include <iostream>
+
+using namespace biscuit;
+
+int main()
+{
+ CPUInfo cpu;
+
+ std::cout << "Has I:" << cpu.Has(RISCVExtension::I) << std::endl;
+ std::cout << "Has M:" << cpu.Has(RISCVExtension::M) << std::endl;
+ std::cout << "Has A:" << cpu.Has(RISCVExtension::A) << std::endl;
+ std::cout << "Has F:" << cpu.Has(RISCVExtension::F) << std::endl;
+ std::cout << "Has D:" << cpu.Has(RISCVExtension::D) << std::endl;
+ std::cout << "Has C:" << cpu.Has(RISCVExtension::C) << std::endl;
+ std::cout << "Has V:" << cpu.Has(RISCVExtension::V) << std::endl;
+
+ if (cpu.Has(RISCVExtension::V)) {
+ std::cout << "VLENB:" << cpu.GetVlenb() << std::endl;
+ }
+
+ return 0;
+}