Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
saursin committed Nov 13, 2023
1 parent 9bfea08 commit 134b5f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion sim/atomsim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Atomsim::Atomsim(Atomsim_config sim_config, Backend_config bk_config):
backend_(this, bk_config) // create backend
{
// get input file disassembly
disassembly_ = getDisassembly(sim_config_.ifile);
getDisassembly(&disassembly_, sim_config_.ifile);

// clear breakpoints
for(int i=0; i<NUM_MAX_BREAKPOINTS; i++) {
Expand Down
12 changes: 6 additions & 6 deletions sim/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ std::string GetStdoutFromCommand(std::string cmd, bool get_output = true) {
}


std::map<uint32_t, DisassembledLine> getDisassembly(std::string filename)
void getDisassembly(std::map<uint32_t, DisassembledLine> *dis, std::string filename)
{
std::string command = "";
#ifdef RV32_COMPILER
Expand All @@ -223,9 +223,6 @@ std::map<uint32_t, DisassembledLine> getDisassembly(std::string filename)
std::string output = GetStdoutFromCommand(command);

std::stringstream s(output);

// Parse command output
std::map<uint32_t, DisassembledLine> dis;

std::string line;
bool in_disassembly = false;
Expand Down Expand Up @@ -274,12 +271,15 @@ std::map<uint32_t, DisassembledLine> getDisassembly(std::string filename)
.instr = instrn,
.disassembly = dism
};
dis.insert({addr, dl});

// insert if not already present
if(dis->count(addr) == 0) {
dis->insert({addr, dl});
}
}
else {
// Parse the rest
// printf("Unk[%s]\n", line.c_str());
}
}
return dis;
}
4 changes: 2 additions & 2 deletions sim/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ struct DisassembledLine
/**
* @brief Get the Disassembly of input file using riscv objdump
*
* @param dis std::map<uint32_t, std::string> map of disassembly
* @param filename input filename
* @return std::map<uint32_t, std::string> map of disassembly
*/
std::map<uint32_t, DisassembledLine> getDisassembly(std::string filename);
void getDisassembly(std::map<uint32_t, DisassembledLine> *dis, std::string filename);

0 comments on commit 134b5f0

Please sign in to comment.