aboutsummaryrefslogtreecommitdiffhomepage
path: root/externals/biscuit/examples/cpuinfo/cpuinfo.cpp
blob: 450dfbdb16e53433ee691cc9469804541fd5f21c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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;
}