aboutsummaryrefslogtreecommitdiff
path: root/riscv/processor.cc
diff options
context:
space:
mode:
authorWeiwei Li <liweiwei@iscas.ac.cn>2022-02-26 13:18:39 +0800
committerWeiwei Li <liweiwei@iscas.ac.cn>2022-02-26 13:18:39 +0800
commit38f085d2fc96fb7fb4c4a60834617446e424f23d (patch)
treecb8cb5c6c0dfe086e3ae5b9f94aa698155de17f2 /riscv/processor.cc
parent8ca012a6cc7e5b9edfaacca2d04b5a0f267377cf (diff)
downloadspike-38f085d2fc96fb7fb4c4a60834617446e424f23d.zip
spike-38f085d2fc96fb7fb4c4a60834617446e424f23d.tar.gz
spike-38f085d2fc96fb7fb4c4a60834617446e424f23d.tar.bz2
add missed extensions specified by '--extension' to custom_extensions
Diffstat (limited to 'riscv/processor.cc')
-rw-r--r--riscv/processor.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/riscv/processor.cc b/riscv/processor.cc
index 947eab5..f20ac6a 100644
--- a/riscv/processor.cc
+++ b/riscv/processor.cc
@@ -47,7 +47,7 @@ processor_t::processor_t(const char* isa, const char* priv, const char* varch,
mmu = new mmu_t(sim, this);
disassembler = new disassembler_t(this);
- for (auto e : custom_extensions)
+ for (auto e : isa_extensions)
register_extension(e.second);
set_pmp_granularity(1 << PMP_SHIFT);
@@ -380,12 +380,11 @@ isa_parser_t::isa_parser_t(const char* str)
} else if (ext_str.size() == 1) {
bad_isa_string(str, "single 'X' is not a proper name");
} else if (ext_str != "xdummy") {
- extension_t* x = find_extension(ext_str.substr(1).c_str())();
- if (!custom_extensions.insert(std::make_pair(x->name(), x)).second) {
- fprintf(stderr, "extensions must have unique names (got two named \"%s\"!)\n", x->name());
- abort();
- }
-
+ extension_t* x = find_extension(ext_str.substr(1).c_str())();
+ if (!isa_extensions.insert(std::make_pair(x->name(), x)).second) {
+ fprintf(stderr, "extensions must have unique names (got two named \"%s\"!)\n", x->name());
+ abort();
+ }
}
} else {
bad_isa_string(str, ("unsupported extension: " + ext_str).c_str());
@@ -1157,6 +1156,10 @@ void processor_t::register_extension(extension_t* x)
for (auto disasm_insn : x->get_disasms())
disassembler->add_insn(disasm_insn);
+ if (!custom_extensions.insert(std::make_pair(x->name(), x)).second) {
+ fprintf(stderr, "extensions must have unique names (got two named \"%s\"!)\n", x->name());
+ abort();
+ }
x->set_processor(this);
}