mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
Compare commits
4 Commits
printer-bu
...
8ce24150e7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ce24150e7 | ||
|
|
a0cb54dc8b | ||
|
|
8e6b0b1a2b | ||
|
|
5bddbc6b06 |
@@ -45,9 +45,17 @@
|
||||
#define MAX_ATTRIBUTES 100
|
||||
#define MAX_TERM_SIZE 1024
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
const char *name;
|
||||
const char *shortname;
|
||||
} AttributeField;
|
||||
|
||||
enum {
|
||||
#if defined(ARCH_X86) || defined(ARCH_PPC)
|
||||
#if defined(ARCH_X86)
|
||||
ATTRIBUTE_NAME,
|
||||
#elif defined(ARCH_PPC)
|
||||
ATTRIBUTE_PART_NUMBER,
|
||||
#elif defined(ARCH_ARM) || defined(ARCH_RISCV)
|
||||
ATTRIBUTE_SOC,
|
||||
#endif
|
||||
@@ -79,76 +87,40 @@ enum {
|
||||
ATTRIBUTE_PEAK
|
||||
};
|
||||
|
||||
static const char* ATTRIBUTE_FIELDS [] = {
|
||||
#ifdef ARCH_X86
|
||||
"Name:",
|
||||
#elif ARCH_PPC
|
||||
"Part Number:",
|
||||
#elif defined(ARCH_ARM) || defined(ARCH_RISCV)
|
||||
"SoC:",
|
||||
#endif
|
||||
#if defined(ARCH_X86) || defined(ARCH_ARM)
|
||||
"",
|
||||
#endif
|
||||
"Hypervisor:",
|
||||
"Microarchitecture:",
|
||||
"Technology:",
|
||||
"Max Frequency:",
|
||||
"Sockets:",
|
||||
"Cores:",
|
||||
"Cores (Total):",
|
||||
#ifdef ARCH_X86
|
||||
"SSE:",
|
||||
"AVX:",
|
||||
"FMA:",
|
||||
#elif ARCH_PPC
|
||||
"Altivec: ",
|
||||
#elif defined(ARCH_ARM)
|
||||
"Features: ",
|
||||
#elif defined(ARCH_RISCV)
|
||||
"Extensions: ",
|
||||
#endif
|
||||
"L1i Size:",
|
||||
"L1d Size:",
|
||||
"L2 Size:",
|
||||
"L3 Size:",
|
||||
"Peak Performance:",
|
||||
};
|
||||
|
||||
static const char* ATTRIBUTE_FIELDS_SHORT [] = {
|
||||
static const AttributeField ATTRIBUTE_INFO[] = {
|
||||
#if defined(ARCH_X86)
|
||||
"Name:",
|
||||
#elif ARCH_PPC
|
||||
"P/N:",
|
||||
#elif ARCH_ARM
|
||||
"SoC:",
|
||||
{ ATTRIBUTE_NAME, "Name:", "Name:" },
|
||||
#elif defined(ARCH_PPC)
|
||||
{ ATTRIBUTE_PART_NUMBER, "Part Number:", "P/N:" },
|
||||
#elif defined(ARCH_ARM) || defined(ARCH_RISCV)
|
||||
{ ATTRIBUTE_SOC, "SoC:", "SoC:" },
|
||||
#endif
|
||||
#if defined(ARCH_X86) || defined(ARCH_ARM)
|
||||
"",
|
||||
{ ATTRIBUTE_CPU_NUM, "", "" },
|
||||
#endif
|
||||
"Hypervisor:",
|
||||
"uArch:",
|
||||
"Technology:",
|
||||
"Max Freq:",
|
||||
"Sockets:",
|
||||
"Cores:",
|
||||
"Cores (Total):",
|
||||
{ ATTRIBUTE_HYPERVISOR, "Hypervisor:", "Hypervisor:" },
|
||||
{ ATTRIBUTE_UARCH, "Microarchitecture:", "uArch:" },
|
||||
{ ATTRIBUTE_TECHNOLOGY, "Technology:", "Technology:" },
|
||||
{ ATTRIBUTE_FREQUENCY, "Max Frequency:", "Max Freq:" },
|
||||
{ ATTRIBUTE_SOCKETS, "Sockets:", "Sockets:" },
|
||||
{ ATTRIBUTE_NCORES, "Cores:", "Cores:" },
|
||||
{ ATTRIBUTE_NCORES_DUAL, "Cores (Total):", "Cores (Total):" },
|
||||
#ifdef ARCH_X86
|
||||
"SSE:",
|
||||
"AVX:",
|
||||
"FMA:",
|
||||
{ ATTRIBUTE_SSE, "SSE:", "SSE:" },
|
||||
{ ATTRIBUTE_AVX, "AVX:", "AVX:" },
|
||||
{ ATTRIBUTE_FMA, "FMA:", "FMA:" },
|
||||
#elif ARCH_PPC
|
||||
"Altivec: ",
|
||||
#elif defined(ARCH_ARM)
|
||||
"Features: ",
|
||||
#elif defined(ARCH_RISCV)
|
||||
"Extensions: ",
|
||||
{ ATTRIBUTE_ALTIVEC, "Altivec: ", "Altivec: " },
|
||||
#elif ARCH_ARM
|
||||
{ ATTRIBUTE_FEATURES, "Features: ", "Features: " },
|
||||
#elif ARCH_RISCV
|
||||
{ ATTRIBUTE_EXTENSIONS, "Extensions: ", "Extensions: " },
|
||||
#endif
|
||||
"L1i Size:",
|
||||
"L1d Size:",
|
||||
"L2 Size:",
|
||||
"L3 Size:",
|
||||
"Peak Perf.:",
|
||||
{ ATTRIBUTE_L1i, "L1i Size:", "L1i Size:" },
|
||||
{ ATTRIBUTE_L1d, "L1d Size:", "L1d Size:" },
|
||||
{ ATTRIBUTE_L2, "L2 Size:", "L2 Size:" },
|
||||
{ ATTRIBUTE_L3, "L3 Size:", "L3 Size:" },
|
||||
{ ATTRIBUTE_PEAK, "Peak Performance:", "Peak Perf.:" },
|
||||
};
|
||||
|
||||
struct terminal {
|
||||
@@ -454,13 +426,14 @@ void choose_ascii_art(struct ascii* art, struct color** cs, struct terminal* ter
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t longest_attribute_length(struct ascii* art, const char** attribute_fields) {
|
||||
uint32_t longest_attribute_length(struct ascii* art, bool use_short) {
|
||||
uint32_t max = 0;
|
||||
uint64_t len = 0;
|
||||
|
||||
for(uint32_t i=0; i < art->n_attributes_set; i++) {
|
||||
if(art->attributes[i]->value != NULL) {
|
||||
len = strlen(attribute_fields[art->attributes[i]->type]);
|
||||
const char* str = use_short ? ATTRIBUTE_INFO[art->attributes[i]->type].shortname : ATTRIBUTE_INFO[art->attributes[i]->type].name;
|
||||
len = strlen(str);
|
||||
if(len > max) max = len;
|
||||
}
|
||||
}
|
||||
@@ -485,7 +458,7 @@ uint32_t longest_field_length(struct ascii* art, int la) {
|
||||
}
|
||||
|
||||
#if defined(ARCH_X86) || defined(ARCH_PPC)
|
||||
void print_ascii_generic(struct ascii* art, uint32_t la, int32_t termw, const char** attribute_fields, bool hybrid_architecture) {
|
||||
void print_ascii_generic(struct ascii* art, uint32_t la, int32_t termw, bool use_short, bool hybrid_architecture) {
|
||||
struct ascii_logo* logo = art->art;
|
||||
int attr_to_print = 0;
|
||||
int attr_type;
|
||||
@@ -547,14 +520,15 @@ void print_ascii_generic(struct ascii* art, uint32_t la, int32_t termw, const ch
|
||||
else {
|
||||
#endif
|
||||
beg_space = 0;
|
||||
space_right = 2 + 1 + (la - strlen(attribute_fields[attr_type]));
|
||||
const char* attr_str = use_short ? ATTRIBUTE_INFO[attr_type].shortname : ATTRIBUTE_INFO[attr_type].name;
|
||||
space_right = 2 + 1 + (la - strlen(attr_str));
|
||||
if(hybrid_architecture && add_space) {
|
||||
beg_space = 2;
|
||||
space_right -= 2;
|
||||
}
|
||||
|
||||
printOut(lbuf, beg_space + strlen(attribute_fields[attr_type]) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attribute_fields[attr_type], art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
printOut(lbuf, beg_space + strlen(attr_str) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attr_str, art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
#ifdef ARCH_X86
|
||||
}
|
||||
#endif
|
||||
@@ -663,19 +637,19 @@ bool print_cpufetch_x86(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
setAttribute(art, ATTRIBUTE_PEAK, pp);
|
||||
|
||||
// Step 3. Print output
|
||||
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
bool use_short = false;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, use_short);
|
||||
uint32_t longest_field = longest_field_length(art, longest_attribute);
|
||||
choose_ascii_art(art, cs, term, longest_field);
|
||||
|
||||
if(!ascii_fits_screen(term->w, *art->art, longest_field)) {
|
||||
// Despite of choosing the smallest logo, the output does not fit
|
||||
// Choose the shorter field names and recalculate the longest attr
|
||||
attribute_fields = ATTRIBUTE_FIELDS_SHORT;
|
||||
longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
use_short = true;
|
||||
longest_attribute = longest_attribute_length(art, use_short);
|
||||
}
|
||||
|
||||
print_ascii_generic(art, longest_attribute, term->w, attribute_fields, hybrid_architecture);
|
||||
print_ascii_generic(art, longest_attribute, term->w, use_short, hybrid_architecture);
|
||||
|
||||
free(manufacturing_process);
|
||||
free(sockets);
|
||||
@@ -724,7 +698,7 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
|
||||
// Step 2. Set attributes
|
||||
if(cpu_name != NULL) {
|
||||
setAttribute(art, ATTRIBUTE_NAME, cpu_name);
|
||||
setAttribute(art, ATTRIBUTE_PART_NUMBER, cpu_name);
|
||||
}
|
||||
setAttribute(art, ATTRIBUTE_UARCH, uarch);
|
||||
if(cpu->hv->present) {
|
||||
@@ -751,19 +725,19 @@ bool print_cpufetch_ppc(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
setAttribute(art, ATTRIBUTE_PEAK, pp);
|
||||
|
||||
// Step 3. Print output
|
||||
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
bool use_short = false;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, use_short);
|
||||
uint32_t longest_field = longest_field_length(art, longest_attribute);
|
||||
choose_ascii_art(art, cs, term, longest_field);
|
||||
|
||||
if(!ascii_fits_screen(term->w, *art->art, longest_field)) {
|
||||
// Despite of choosing the smallest logo, the output does not fit
|
||||
// Choose the shorter field names and recalculate the longest attr
|
||||
attribute_fields = ATTRIBUTE_FIELDS_SHORT;
|
||||
longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
use_short = true;
|
||||
longest_attribute = longest_attribute_length(art, use_short);
|
||||
}
|
||||
|
||||
print_ascii_generic(art, longest_attribute, term->w, attribute_fields, false);
|
||||
print_ascii_generic(art, longest_attribute, term->w, use_short, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -791,7 +765,7 @@ uint32_t longest_field_length_arm(struct ascii* art, int la) {
|
||||
return max;
|
||||
}
|
||||
|
||||
void print_ascii_arm(struct ascii* art, uint32_t la, int32_t termw, const char** attribute_fields) {
|
||||
void print_ascii_arm(struct ascii* art, uint32_t la, int32_t termw, bool use_short) {
|
||||
struct ascii_logo* logo = art->art;
|
||||
int attr_to_print = 0;
|
||||
int attr_type;
|
||||
@@ -862,14 +836,15 @@ void print_ascii_arm(struct ascii* art, uint32_t la, int32_t termw, const char**
|
||||
}
|
||||
else {
|
||||
beg_space = 0;
|
||||
space_right = 2 + 1 + (la - strlen(attribute_fields[attr_type]));
|
||||
const char* attr_str = use_short ? ATTRIBUTE_INFO[attr_type].shortname : ATTRIBUTE_INFO[attr_type].name;
|
||||
space_right = 2 + 1 + (la - strlen(attr_str));
|
||||
if(add_space) {
|
||||
beg_space = 2;
|
||||
space_right -= 2;
|
||||
}
|
||||
|
||||
printOut(lbuf, beg_space + strlen(attribute_fields[attr_type]) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attribute_fields[attr_type], art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
printOut(lbuf, beg_space + strlen(attr_str) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attr_str, art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
}
|
||||
}
|
||||
printOutLine(lbuf, art, termw);
|
||||
@@ -939,8 +914,8 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
setAttribute(art, ATTRIBUTE_HYPERVISOR, cpu->hv->hv_name);
|
||||
}
|
||||
|
||||
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
bool use_short = false;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, use_short);
|
||||
uint32_t longest_field = longest_field_length_arm(art, longest_attribute);
|
||||
choose_ascii_art(art, cs, term, longest_field);
|
||||
|
||||
@@ -952,11 +927,11 @@ bool print_cpufetch_arm(struct cpuInfo* cpu, STYLE s, struct color** cs, struct
|
||||
if(!ascii_fits_screen(term->w, *art->art, longest_field)) {
|
||||
// Despite of choosing the smallest logo, the output does not fit
|
||||
// Choose the shorter field names and recalculate the longest attr
|
||||
attribute_fields = ATTRIBUTE_FIELDS_SHORT;
|
||||
longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
use_short = true;
|
||||
longest_attribute = longest_attribute_length(art, use_short);
|
||||
}
|
||||
|
||||
print_ascii_arm(art, longest_attribute, term->w, attribute_fields);
|
||||
print_ascii_arm(art, longest_attribute, term->w, use_short);
|
||||
|
||||
free(manufacturing_process);
|
||||
free(pp);
|
||||
@@ -981,7 +956,7 @@ uint64_t number_of_bits(uint64_t i) {
|
||||
return (((i + (i >> 4)) & 0xF0F0F0F0F0F0F0F) * 0x101010101010101) >> 56;
|
||||
}
|
||||
|
||||
void print_ascii_riscv(struct ascii* art, uint32_t la, int32_t termw, const char** attribute_fields, uint64_t extensions_mask) {
|
||||
void print_ascii_riscv(struct ascii* art, uint32_t la, int32_t termw, bool use_short, uint64_t extensions_mask) {
|
||||
struct ascii_logo* logo = art->art;
|
||||
int attr_to_print = 0;
|
||||
int attr_type;
|
||||
@@ -1049,10 +1024,11 @@ void print_ascii_riscv(struct ascii* art, uint32_t la, int32_t termw, const char
|
||||
else {
|
||||
attr_to_print++;
|
||||
beg_space = 0;
|
||||
space_right = 2 + 1 + (la - strlen(attribute_fields[attr_type]));
|
||||
const char* attr_str = use_short ? ATTRIBUTE_INFO[attr_type].shortname : ATTRIBUTE_INFO[attr_type].name;
|
||||
space_right = 2 + 1 + (la - strlen(attr_str));
|
||||
|
||||
printOut(lbuf, beg_space + strlen(attribute_fields[attr_type]) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attribute_fields[attr_type], art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
printOut(lbuf, beg_space + strlen(attr_str) + space_right + strlen(attr_value),
|
||||
"%*s%s%s%s%*s%s%s%s", beg_space, "", logo->color_text[0], attr_str, art->reset, space_right, "", logo->color_text[1], attr_value, art->reset);
|
||||
}
|
||||
}
|
||||
printOutLine(lbuf, art, termw);
|
||||
@@ -1090,19 +1066,19 @@ bool print_cpufetch_riscv(struct cpuInfo* cpu, STYLE s, struct color** cs, struc
|
||||
setAttribute(art, ATTRIBUTE_PEAK, pp);
|
||||
|
||||
// Step 3. Print output
|
||||
const char** attribute_fields = ATTRIBUTE_FIELDS;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
bool use_short = false;
|
||||
uint32_t longest_attribute = longest_attribute_length(art, use_short);
|
||||
uint32_t longest_field = longest_field_length(art, longest_attribute);
|
||||
choose_ascii_art(art, cs, term, longest_field);
|
||||
|
||||
if(!ascii_fits_screen(term->w, *art->art, longest_field)) {
|
||||
// Despite of choosing the smallest logo, the output does not fit
|
||||
// Choose the shorter field names and recalculate the longest attr
|
||||
attribute_fields = ATTRIBUTE_FIELDS_SHORT;
|
||||
longest_attribute = longest_attribute_length(art, attribute_fields);
|
||||
use_short = true;
|
||||
longest_attribute = longest_attribute_length(art, use_short);
|
||||
}
|
||||
|
||||
print_ascii_riscv(art, longest_attribute, term->w, attribute_fields, cpu->ext->mask);
|
||||
print_ascii_riscv(art, longest_attribute, term->w, use_short, cpu->ext->mask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,65 @@ int parse_multi_letter_extension(struct extensions* ext, char* e) {
|
||||
SET_ISA_EXT_MAP("zicsr", RISCV_ISA_EXT_ZICSR)
|
||||
SET_ISA_EXT_MAP("zifencei", RISCV_ISA_EXT_ZIFENCEI)
|
||||
SET_ISA_EXT_MAP("zihpm", RISCV_ISA_EXT_ZIHPM)
|
||||
SET_ISA_EXT_MAP("smstateen", RISCV_ISA_EXT_SMSTATEEN)
|
||||
SET_ISA_EXT_MAP("zicond", RISCV_ISA_EXT_ZICOND)
|
||||
SET_ISA_EXT_MAP("zbc", RISCV_ISA_EXT_ZBC)
|
||||
SET_ISA_EXT_MAP("zbkb", RISCV_ISA_EXT_ZBKB)
|
||||
SET_ISA_EXT_MAP("zbkc", RISCV_ISA_EXT_ZBKC)
|
||||
SET_ISA_EXT_MAP("zbkx", RISCV_ISA_EXT_ZBKX)
|
||||
SET_ISA_EXT_MAP("zknd", RISCV_ISA_EXT_ZKND)
|
||||
SET_ISA_EXT_MAP("zkne", RISCV_ISA_EXT_ZKNE)
|
||||
SET_ISA_EXT_MAP("zknh", RISCV_ISA_EXT_ZKNH)
|
||||
SET_ISA_EXT_MAP("zkr", RISCV_ISA_EXT_ZKR)
|
||||
SET_ISA_EXT_MAP("zksed", RISCV_ISA_EXT_ZKSED)
|
||||
SET_ISA_EXT_MAP("zksh", RISCV_ISA_EXT_ZKSH)
|
||||
SET_ISA_EXT_MAP("zkt", RISCV_ISA_EXT_ZKT)
|
||||
SET_ISA_EXT_MAP("zvbb", RISCV_ISA_EXT_ZVBB)
|
||||
SET_ISA_EXT_MAP("zvbc", RISCV_ISA_EXT_ZVBC)
|
||||
SET_ISA_EXT_MAP("zvkb", RISCV_ISA_EXT_ZVKB)
|
||||
SET_ISA_EXT_MAP("zvkg", RISCV_ISA_EXT_ZVKG)
|
||||
SET_ISA_EXT_MAP("zvkned", RISCV_ISA_EXT_ZVKNED)
|
||||
SET_ISA_EXT_MAP("zvknha", RISCV_ISA_EXT_ZVKNHA)
|
||||
SET_ISA_EXT_MAP("zvknhb", RISCV_ISA_EXT_ZVKNHB)
|
||||
SET_ISA_EXT_MAP("zvksed", RISCV_ISA_EXT_ZVKSED)
|
||||
SET_ISA_EXT_MAP("zvksh", RISCV_ISA_EXT_ZVKSH)
|
||||
SET_ISA_EXT_MAP("zvkt", RISCV_ISA_EXT_ZVKT)
|
||||
SET_ISA_EXT_MAP("zfh", RISCV_ISA_EXT_ZFH)
|
||||
SET_ISA_EXT_MAP("zfhmin", RISCV_ISA_EXT_ZFHMIN)
|
||||
SET_ISA_EXT_MAP("zihintntl", RISCV_ISA_EXT_ZIHINTNTL)
|
||||
SET_ISA_EXT_MAP("zvfh", RISCV_ISA_EXT_ZVFH)
|
||||
SET_ISA_EXT_MAP("zvfhmin", RISCV_ISA_EXT_ZVFHMIN)
|
||||
SET_ISA_EXT_MAP("zfa", RISCV_ISA_EXT_ZFA)
|
||||
SET_ISA_EXT_MAP("ztso", RISCV_ISA_EXT_ZTSO)
|
||||
SET_ISA_EXT_MAP("zacas", RISCV_ISA_EXT_ZACAS)
|
||||
SET_ISA_EXT_MAP("zve32x", RISCV_ISA_EXT_ZVE32X)
|
||||
SET_ISA_EXT_MAP("zve32f", RISCV_ISA_EXT_ZVE32F)
|
||||
SET_ISA_EXT_MAP("zve64x", RISCV_ISA_EXT_ZVE64X)
|
||||
SET_ISA_EXT_MAP("zve64f", RISCV_ISA_EXT_ZVE64F)
|
||||
SET_ISA_EXT_MAP("zve64d", RISCV_ISA_EXT_ZVE64D)
|
||||
SET_ISA_EXT_MAP("zimop", RISCV_ISA_EXT_ZIMOP)
|
||||
SET_ISA_EXT_MAP("zca", RISCV_ISA_EXT_ZCA)
|
||||
SET_ISA_EXT_MAP("zcb", RISCV_ISA_EXT_ZCB)
|
||||
SET_ISA_EXT_MAP("zcd", RISCV_ISA_EXT_ZCD)
|
||||
SET_ISA_EXT_MAP("zcf", RISCV_ISA_EXT_ZCF)
|
||||
SET_ISA_EXT_MAP("zcmop", RISCV_ISA_EXT_ZCMOP)
|
||||
SET_ISA_EXT_MAP("zawrs", RISCV_ISA_EXT_ZAWRS)
|
||||
SET_ISA_EXT_MAP("svvptc", RISCV_ISA_EXT_SVVPTC)
|
||||
SET_ISA_EXT_MAP("smmpm", RISCV_ISA_EXT_SMMPM)
|
||||
SET_ISA_EXT_MAP("smnpm", RISCV_ISA_EXT_SMNPM)
|
||||
SET_ISA_EXT_MAP("ssnpm", RISCV_ISA_EXT_SSNPM)
|
||||
SET_ISA_EXT_MAP("zabha", RISCV_ISA_EXT_ZABHA)
|
||||
SET_ISA_EXT_MAP("ziccrse", RISCV_ISA_EXT_ZICCRSE)
|
||||
SET_ISA_EXT_MAP("svade", RISCV_ISA_EXT_SVADE)
|
||||
SET_ISA_EXT_MAP("svadu", RISCV_ISA_EXT_SVADU)
|
||||
SET_ISA_EXT_MAP("zfbfmin", RISCV_ISA_EXT_ZFBFMIN)
|
||||
SET_ISA_EXT_MAP("zvfbfmin", RISCV_ISA_EXT_ZVFBFMIN)
|
||||
SET_ISA_EXT_MAP("zvfbfwma", RISCV_ISA_EXT_ZVFBFWMA)
|
||||
SET_ISA_EXT_MAP("zaamo", RISCV_ISA_EXT_ZAAMO)
|
||||
SET_ISA_EXT_MAP("zalrsc", RISCV_ISA_EXT_ZALRSC)
|
||||
SET_ISA_EXT_MAP("zicbop", RISCV_ISA_EXT_ZICBOP)
|
||||
SET_ISA_EXT_MAP("ime", RISCV_ISA_EXT_IME)
|
||||
|
||||
if(!maskset) {
|
||||
printBug("parse_multi_letter_extension: Unknown multi-letter extension: %s", multi_letter_extension);
|
||||
return -1;
|
||||
|
||||
@@ -23,7 +23,6 @@ enum riscv_isa_ext_id {
|
||||
RISCV_ISA_EXT_ZICBOM,
|
||||
RISCV_ISA_EXT_ZIHINTPAUSE,
|
||||
RISCV_ISA_EXT_SVNAPOT,
|
||||
RISCV_ISA_EXT_ZICBOP,
|
||||
RISCV_ISA_EXT_ZICBOZ,
|
||||
RISCV_ISA_EXT_SMAIA,
|
||||
RISCV_ISA_EXT_SSAIA,
|
||||
@@ -33,12 +32,71 @@ enum riscv_isa_ext_id {
|
||||
RISCV_ISA_EXT_ZICSR,
|
||||
RISCV_ISA_EXT_ZIFENCEI,
|
||||
RISCV_ISA_EXT_ZIHPM,
|
||||
RISCV_ISA_EXT_SMSTATEEN,
|
||||
RISCV_ISA_EXT_ZICOND,
|
||||
RISCV_ISA_EXT_ZBC,
|
||||
RISCV_ISA_EXT_ZBKB,
|
||||
RISCV_ISA_EXT_ZBKC,
|
||||
RISCV_ISA_EXT_ZBKX,
|
||||
RISCV_ISA_EXT_ZKND,
|
||||
RISCV_ISA_EXT_ZKNE,
|
||||
RISCV_ISA_EXT_ZKNH,
|
||||
RISCV_ISA_EXT_ZKR,
|
||||
RISCV_ISA_EXT_ZKSED,
|
||||
RISCV_ISA_EXT_ZKSH,
|
||||
RISCV_ISA_EXT_ZKT,
|
||||
RISCV_ISA_EXT_ZVBB,
|
||||
RISCV_ISA_EXT_ZVBC,
|
||||
RISCV_ISA_EXT_ZVKB,
|
||||
RISCV_ISA_EXT_ZVKG,
|
||||
RISCV_ISA_EXT_ZVKNED,
|
||||
RISCV_ISA_EXT_ZVKNHA,
|
||||
RISCV_ISA_EXT_ZVKNHB,
|
||||
RISCV_ISA_EXT_ZVKSED,
|
||||
RISCV_ISA_EXT_ZVKSH,
|
||||
RISCV_ISA_EXT_ZVKT,
|
||||
RISCV_ISA_EXT_ZFH,
|
||||
RISCV_ISA_EXT_ZFHMIN,
|
||||
RISCV_ISA_EXT_ZIHINTNTL,
|
||||
RISCV_ISA_EXT_ZVFH,
|
||||
RISCV_ISA_EXT_ZVFHMIN,
|
||||
RISCV_ISA_EXT_ZFA,
|
||||
RISCV_ISA_EXT_ZTSO,
|
||||
RISCV_ISA_EXT_ZACAS,
|
||||
RISCV_ISA_EXT_ZVE32X,
|
||||
RISCV_ISA_EXT_ZVE32F,
|
||||
RISCV_ISA_EXT_ZVE64X,
|
||||
RISCV_ISA_EXT_ZVE64F,
|
||||
RISCV_ISA_EXT_ZVE64D,
|
||||
RISCV_ISA_EXT_ZIMOP,
|
||||
RISCV_ISA_EXT_ZCA,
|
||||
RISCV_ISA_EXT_ZCB,
|
||||
RISCV_ISA_EXT_ZCD,
|
||||
RISCV_ISA_EXT_ZCF,
|
||||
RISCV_ISA_EXT_ZCMOP,
|
||||
RISCV_ISA_EXT_ZAWRS,
|
||||
RISCV_ISA_EXT_SVVPTC,
|
||||
RISCV_ISA_EXT_SMMPM,
|
||||
RISCV_ISA_EXT_SMNPM,
|
||||
RISCV_ISA_EXT_SSNPM,
|
||||
RISCV_ISA_EXT_ZABHA,
|
||||
RISCV_ISA_EXT_ZICCRSE,
|
||||
RISCV_ISA_EXT_SVADE,
|
||||
RISCV_ISA_EXT_SVADU,
|
||||
RISCV_ISA_EXT_ZFBFMIN,
|
||||
RISCV_ISA_EXT_ZVFBFMIN,
|
||||
RISCV_ISA_EXT_ZVFBFWMA,
|
||||
RISCV_ISA_EXT_ZAAMO,
|
||||
RISCV_ISA_EXT_ZALRSC,
|
||||
RISCV_ISA_EXT_ZICBOP,
|
||||
RISCV_ISA_EXT_IME,
|
||||
RISCV_ISA_EXT_ID_MAX
|
||||
};
|
||||
|
||||
// https://five-embeddev.com/riscv-isa-manual/latest/preface.html#preface
|
||||
// https://en.wikichip.org/wiki/risc-v/standard_extensions
|
||||
// (Zicbop) https://github.com/riscv/riscv-CMOs/blob/master/cmobase/Zicbop.adoc
|
||||
// https://raw.githubusercontent.com/riscv/riscv-CMOs/master/specifications/cmobase-v1.0.1.pdf
|
||||
// Included all except for G
|
||||
static const struct extension extension_list[] = {
|
||||
{ 'i' - 'a', "(I) Integer Instruction Set" },
|
||||
@@ -74,7 +132,65 @@ static const struct extension extension_list[] = {
|
||||
{ RISCV_ISA_EXT_ZICNTR, "(Zicntr) Base Counters and Timers" },
|
||||
{ RISCV_ISA_EXT_ZICSR, "(Zicsr) Control and Status Register" },
|
||||
{ RISCV_ISA_EXT_ZIFENCEI, "(Zifencei) Instruction-Fetch Fence" },
|
||||
{ RISCV_ISA_EXT_ZIHPM, "(Zihpm) Hardware Performance Counters" }
|
||||
{ RISCV_ISA_EXT_ZIHPM, "(Zihpm) Hardware Performance Counters" },
|
||||
{ RISCV_ISA_EXT_SMSTATEEN, "(smstateen) " },
|
||||
{ RISCV_ISA_EXT_ZICOND, "(zicond) " },
|
||||
{ RISCV_ISA_EXT_ZBC, "(zbc) " },
|
||||
{ RISCV_ISA_EXT_ZBKB, "(zbkb) " },
|
||||
{ RISCV_ISA_EXT_ZBKC, "(zbkc) " },
|
||||
{ RISCV_ISA_EXT_ZBKX, "(zbkx) " },
|
||||
{ RISCV_ISA_EXT_ZKND, "(zknd) " },
|
||||
{ RISCV_ISA_EXT_ZKNE, "(zkne) " },
|
||||
{ RISCV_ISA_EXT_ZKNH, "(zknh) " },
|
||||
{ RISCV_ISA_EXT_ZKR, "(zkr) " },
|
||||
{ RISCV_ISA_EXT_ZKSED, "(zksed) " },
|
||||
{ RISCV_ISA_EXT_ZKSH, "(zksh) " },
|
||||
{ RISCV_ISA_EXT_ZKT, "(zkt) " },
|
||||
{ RISCV_ISA_EXT_ZVBB, "(zvbb) " },
|
||||
{ RISCV_ISA_EXT_ZVBC, "(zvbc) " },
|
||||
{ RISCV_ISA_EXT_ZVKB, "(zvkb) " },
|
||||
{ RISCV_ISA_EXT_ZVKG, "(zvkg) " },
|
||||
{ RISCV_ISA_EXT_ZVKNED, "(zvkned) " },
|
||||
{ RISCV_ISA_EXT_ZVKNHA, "(zvknha) " },
|
||||
{ RISCV_ISA_EXT_ZVKNHB, "(zvknhb) " },
|
||||
{ RISCV_ISA_EXT_ZVKSED, "(zvksed) " },
|
||||
{ RISCV_ISA_EXT_ZVKSH, "(zvksh) " },
|
||||
{ RISCV_ISA_EXT_ZVKT, "(zvkt) " },
|
||||
{ RISCV_ISA_EXT_ZFH, "(zfh) " },
|
||||
{ RISCV_ISA_EXT_ZFHMIN, "(zfhmin) " },
|
||||
{ RISCV_ISA_EXT_ZIHINTNTL, "(zihintntl) " },
|
||||
{ RISCV_ISA_EXT_ZVFH, "(zvfh) " },
|
||||
{ RISCV_ISA_EXT_ZVFHMIN, "(zvfhmin) " },
|
||||
{ RISCV_ISA_EXT_ZFA, "(zfa) " },
|
||||
{ RISCV_ISA_EXT_ZTSO, "(ztso) " },
|
||||
{ RISCV_ISA_EXT_ZACAS, "(zacas) " },
|
||||
{ RISCV_ISA_EXT_ZVE32X, "(zve32x) " },
|
||||
{ RISCV_ISA_EXT_ZVE32F, "(zve32f) " },
|
||||
{ RISCV_ISA_EXT_ZVE64X, "(zve64x) " },
|
||||
{ RISCV_ISA_EXT_ZVE64F, "(zve64f) " },
|
||||
{ RISCV_ISA_EXT_ZVE64D, "(zve64d) " },
|
||||
{ RISCV_ISA_EXT_ZIMOP, "(zimop) " },
|
||||
{ RISCV_ISA_EXT_ZCA, "(zca) " },
|
||||
{ RISCV_ISA_EXT_ZCB, "(zcb) " },
|
||||
{ RISCV_ISA_EXT_ZCD, "(zcd) " },
|
||||
{ RISCV_ISA_EXT_ZCF, "(zcf) " },
|
||||
{ RISCV_ISA_EXT_ZCMOP, "(zcmop) " },
|
||||
{ RISCV_ISA_EXT_ZAWRS, "(zawrs) " },
|
||||
{ RISCV_ISA_EXT_SVVPTC, "(svvptc) " },
|
||||
{ RISCV_ISA_EXT_SMMPM, "(smmpm) " },
|
||||
{ RISCV_ISA_EXT_SMNPM, "(smnpm) " },
|
||||
{ RISCV_ISA_EXT_SSNPM, "(ssnpm) " },
|
||||
{ RISCV_ISA_EXT_ZABHA, "(zabha) " },
|
||||
{ RISCV_ISA_EXT_ZICCRSE, "(ziccrse) " },
|
||||
{ RISCV_ISA_EXT_SVADE, "(svade) " },
|
||||
{ RISCV_ISA_EXT_SVADU, "(svadu) " },
|
||||
{ RISCV_ISA_EXT_ZFBFMIN, "(zfbfmin) " },
|
||||
{ RISCV_ISA_EXT_ZVFBFMIN, "(zvfbfmin) " },
|
||||
{ RISCV_ISA_EXT_ZVFBFWMA, "(zvfbfwma) " },
|
||||
{ RISCV_ISA_EXT_ZAAMO, "(zaamo) " },
|
||||
{ RISCV_ISA_EXT_ZALRSC, "(zalrsc) " },
|
||||
{ RISCV_ISA_EXT_ZICBOP, "(zicbop) " },
|
||||
{ RISCV_ISA_EXT_IME, "(ime) Integrated Matrix Extension" },
|
||||
};
|
||||
|
||||
struct cpuInfo* get_cpu_info(void);
|
||||
|
||||
Reference in New Issue
Block a user