Skip to content

Commit

Permalink
push desesc to c++20
Browse files Browse the repository at this point in the history
  • Loading branch information
renau committed May 29, 2023
1 parent 1ca11b5 commit d686eb7
Show file tree
Hide file tree
Showing 33 changed files with 720 additions and 1,467 deletions.
6 changes: 3 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
build --output_filter='^//(core|pass|inou)'
#build --output_filter="^//"
#build --cxxopt="-std=c++17" --cxxopt="-fexceptions" --force_pic --build_tag_filters="-fixme"
build --cxxopt="-std=c++17" --force_pic --build_tag_filters="-fixme"
build --cxxopt="-std=c++20" --force_pic --build_tag_filters="-fixme"
# test --cache_test_results=no

# Use Clang
Expand Down Expand Up @@ -51,7 +51,7 @@ build:asan --copt -fno-omit-frame-pointer
build:asan --cxxopt -fsanitize=address
build:asan --cxxopt -DADDRESS_SANITIZER
#build:asan --cxxopt -O1
build:asan --cxxopt -std=c++17
build:asan --cxxopt -std=c++20
build:asan --cxxopt -g
build:asan --cxxopt -fno-omit-frame-pointer
build:asan --linkopt -fsanitize=address
Expand Down Expand Up @@ -91,7 +91,7 @@ build:tsan --cxxopt -DTHREAD_SANITIZER
build:tsan --cxxopt -DDYNAMIC_ANNOTATIONS_ENABLED=1
build:tsan --cxxopt -DDYNAMIC_ANNOTATIONS_EXTERNAL_IMPL=1
build:tsan --cxxopt -g
build:tsan --cxxopt -std=c++17
build:tsan --cxxopt -std=c++20
# build:tsan --copt -O1
build:tsan --cxxopt -fno-omit-frame-pointer
build:tsan --linkopt -fsanitize=thread
Expand Down
72 changes: 34 additions & 38 deletions emul/dinst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,95 +11,91 @@

pool<Dinst> Dinst::dInstPool(32768, "Dinst"); // 4 * tsfifo size

Time_t Dinst::currentID = 0;

Dinst::Dinst()
: inst(Instruction(iOpInvalid, LREG_R0, LREG_R0, LREG_InvalidOutput, LREG_InvalidOutput)){

: inst(Instruction(Opcode::iOpInvalid, RegType::LREG_R0, RegType::LREG_R0, RegType::LREG_InvalidOutput,
RegType::LREG_InvalidOutput)) {
pend[0].init(this);
pend[1].init(this);
pend[2].init(this);
I(MAX_PENDING_SOURCES == 3);
nDeps = 0;
}

void Dinst::dump(const char *str) {
fprintf(stderr,
"%s:%p (%d) %lld %c Dinst: pc=0x%llx, addr=0x%llx src1=%d (%s) src2 = %d dest1 =%d dest2 = %d",
str,
this,
fid,
(long long)ID,
keep_stats ? 't' : 'd',
(long long)pc,
(long long)addr,
(int)(inst.getSrc1()),
inst.getOpcodeName(),
inst.getSrc2(),
inst.getDst1(),
inst.getDst2());
void Dinst::dump(std::string_view str) {
fmt::print("{} ({}) {} {} Dinst: pc=0x{:x}, addr=0x{:x} src1={} ({}) src2={} dest1={} dest2={}",
str,
fid,
(long long)ID,
keep_stats ? 't' : 'd',
(long long)pc,
(long long)addr,
(int)(inst.getSrc1()),
inst.getOpcodeName(),
inst.getSrc2(),
inst.getDst1(),
inst.getDst2());

Time_t t;

t = getRenamedTime() - getFetchTime();
if (getRenamedTime()) {
fprintf(stderr, " %5d", (int)t);
fmt::print(" %5d", (int)t);
} else {
fprintf(stderr, " na");
fmt::print(" na");
}

t = getIssuedTime() - getRenamedTime();
if (getIssuedTime()) {
fprintf(stderr, " %5d", (int)t);
fmt::print(" %5d", (int)t);
} else {
fprintf(stderr, " na");
fmt::print(" na");
}

t = getExecutedTime() - getIssuedTime();
if (getExecutedTime()) {
fprintf(stderr, " %5d", (int)t);
fmt::print(" %5d", (int)t);
} else {
fprintf(stderr, " na");
fmt::print(" na");
}

t = globalClock - getExecutedTime();
if (getExecutedTime()) {
fprintf(stderr, " %5d", (int)t);
fmt::print(" %5d", (int)t);
} else {
fprintf(stderr, " na");
fmt::print(" na");
}

if (performed) {
fprintf(stderr, " performed");
fmt::print(" performed");
} else if (executing) {
fprintf(stderr, " executing");
fmt::print(" executing");
} else if (executed) {
fprintf(stderr, " executed");
fmt::print(" executed");
} else if (issued) {
fprintf(stderr, " issued");
fmt::print(" issued");
} else {
fprintf(stderr, " non-issued");
fmt::print(" non-issued");
}
if (replay) {
fprintf(stderr, " REPLAY ");
fmt::print(" REPLAY ");
}

if (hasPending()) {
fprintf(stderr, " has pending");
fmt::print(" has pending");
}
if (!isSrc1Ready()) {
fprintf(stderr, " has src1 deps");
fmt::print(" has src1 deps");
}
if (!isSrc2Ready()) {
fprintf(stderr, " has src2 deps");
fmt::print(" has src2 deps");
}
if (!isSrc3Ready()) {
fprintf(stderr, " has src3 deps");
fmt::print(" has src3 deps");
}

// inst.dump("Inst->");

fprintf(stderr, "\n");
fmt::print("\n");
}

void Dinst::clearRATEntry() {
Expand Down
10 changes: 5 additions & 5 deletions emul/dinst.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ class Dinst {

char nDeps; // 0, 1 or 2 for RISC processors

static Time_t currentID;
Time_t ID; // static ID, increased every create (currentID). pointer to the
static inline Time_t currentID = 0;
Time_t ID; // static ID, increased every create (currentID). pointer to the
#ifndef NDEBUG
uint64_t mreq_id;
#endif
Expand Down Expand Up @@ -298,7 +298,7 @@ class Dinst {

static Dinst *create(Instruction &&inst, Addr_t pc, Addr_t address, Hartid_t fid, bool keep_stats) {
Dinst *i = dInstPool.out();
I(inst.getOpcode()!=iOpInvalid);
I(inst.getOpcode() != Opcode::iOpInvalid);

i->fid = fid;
i->inst = std::move(inst);
Expand Down Expand Up @@ -327,7 +327,7 @@ class Dinst {
i->keep_stats = keep_stats;

i->setup();
I(i->getInst()->getOpcode());
I(i->getInst()->getOpcode() != Opcode::iOpInvalid);

return i;
}
Expand Down Expand Up @@ -704,7 +704,7 @@ class Dinst {

const Instruction *getInst() const { return &inst; }

void dump(const char *id);
void dump(std::string_view txt);

// methods required for LDSTBuffer
bool isLoadForwarded() const { return loadForwarded; }
Expand Down
2 changes: 1 addition & 1 deletion emul/dromajo_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ int iterate_core(RISCVMachine *m, int hartid) {
}
#endif // BRANCHPROF

int keep_going = virt_machine_run(m, hartid);
int keep_going = virt_machine_run(m, hartid, 1);
if (last_pc == virt_machine_get_pc(m, hartid)) {
return 0;
}
Expand Down
Loading

0 comments on commit d686eb7

Please sign in to comment.