Skip to content

Commit

Permalink
Fix for missing cpureg default values
Browse files Browse the repository at this point in the history
  • Loading branch information
janweinstock committed Jun 25, 2023
1 parent ca36246 commit 8eb9142
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/vcml/core/processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,16 @@ void processor::flush_cpuregs() {
void processor::define_cpureg(id_t regno, const string& name, size_t size,
size_t n, int prot) {
target::define_cpureg(regno, name, size, n, prot);

u64 defval = 0;
if (is_read_allowed(prot)) {
if (!read_reg_dbg(regno, &defval, sizeof(defval)))
VCML_ERROR("failed to initialize cpureg %s", name.c_str());
}

auto*& prop = m_regprops[regno];
VCML_ERROR_ON(prop, "property %s already exists", name.c_str());
prop = new property<void>(name.c_str(), size, n);
prop = new property<void>(name.c_str(), size, n, defval);
}

void processor::define_cpureg_r(id_t regno, const string& name, size_t size,
Expand Down

0 comments on commit 8eb9142

Please sign in to comment.