diff options
author | Chih-Min Chao <chihmin.chao@sifive.com> | 2019-06-09 20:46:51 -0700 |
---|---|---|
committer | Chih-Min Chao <chihmin.chao@sifive.com> | 2019-06-09 20:46:51 -0700 |
commit | 0ac0cb701dbf47090005c1a3cdc19d5cc695fbc7 (patch) | |
tree | 9fb9beafe2445c7bc49dc8d8a5f81126f550ec37 /spike_main/spike-log-parser.cc | |
parent | 52e2094dc69820081b626476b089795084bc9db9 (diff) | |
download | spike-0ac0cb701dbf47090005c1a3cdc19d5cc695fbc7.zip spike-0ac0cb701dbf47090005c1a3cdc19d5cc695fbc7.tar.gz spike-0ac0cb701dbf47090005c1a3cdc19d5cc695fbc7.tar.bz2 |
rvv: fix indent
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
Diffstat (limited to 'spike_main/spike-log-parser.cc')
-rw-r--r-- | spike_main/spike-log-parser.cc | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/spike_main/spike-log-parser.cc b/spike_main/spike-log-parser.cc index 9a08670..fd07f53 100644 --- a/spike_main/spike-log-parser.cc +++ b/spike_main/spike-log-parser.cc @@ -18,43 +18,43 @@ using namespace std; int main(int argc, char** argv) { - string s; - const char* isa = DEFAULT_ISA; - - std::function<extension_t*()> extension; - option_parser_t parser; - parser.option(0, "extension", 1, [&](const char* s){extension = find_extension(s);}); - parser.option(0, "isa", 1, [&](const char* s){isa = s;}); - parser.parse(argv); - - processor_t p(isa, DEFAULT_VARCH, 0, 0); - if (extension) { - p.register_extension(extension()); + string s; + const char* isa = DEFAULT_ISA; + + std::function<extension_t*()> extension; + option_parser_t parser; + parser.option(0, "extension", 1, [&](const char* s){extension = find_extension(s);}); + parser.option(0, "isa", 1, [&](const char* s){isa = s;}); + parser.parse(argv); + + processor_t p(isa, DEFAULT_VARCH, 0, 0); + if (extension) { + p.register_extension(extension()); + } + + std::regex reg("^core\\s+\\d+:\\s+0x[0-9a-f]+\\s+\\(0x([0-9a-f]+)\\)", std::regex_constants::icase); + std::smatch m; + std::ssub_match sm ; + + while (getline(cin,s)){ + if (regex_search(s, m, reg)){ + // the opcode string + string op = m[1].str(); + uint32_t bit_num = op.size() * 4; + uint64_t opcode = strtoull(op.c_str(), nullptr, 16); + + if (bit_num<64){ + opcode = opcode << (64-bit_num) >> (64-bit_num); + } + + const disasm_insn_t* disasm = p.get_disassembler()->lookup(opcode); + if (disasm) { + cout << disasm->get_name() << '\n'; + } else { + cout << "unknown_op\n"; + } } + } - std::regex reg("^core\\s+\\d+:\\s+0x[0-9a-f]+\\s+\\(0x([0-9a-f]+)\\)", std::regex_constants::icase); - std::smatch m; - std::ssub_match sm ; - - while (getline(cin,s)){ - if(regex_search(s, m, reg)){ - // the opcode string - string op = m[1].str(); - uint32_t bit_num = op.size() * 4; - uint64_t opcode = strtoull(op.c_str(), nullptr, 16); - - if (bit_num<64){ - opcode = opcode << (64-bit_num) >> (64-bit_num); - } - - const disasm_insn_t* disasm = p.get_disassembler()->lookup(opcode); - if (disasm) { - cout << disasm->get_name() << '\n'; - } else { - cout << "unknown_op\n"; - } - } - } - - return 0; + return 0; } |