summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-02-13 12:14:31 -0600
committerAlejandro Soto <alejandro@34project.org>2024-02-20 11:11:18 -0600
commit827c40829903d5b870f47ab2f389792ed10211bd (patch)
tree2a696fcb41118e8115585a9e2d79ec60294a6584
parent9bf55b70a85e5c12e9cfd0b8c7e1eaf1c05a6c1c (diff)
rtl/core/control: don't shift branch history registers inside loops
-rw-r--r--rtl/core/core_control_issue.sv2
-rwxr-xr-xsim/sim.py4
-rw-r--r--tb/top/conspiracion/conspiracion.cpp9
3 files changed, 10 insertions, 5 deletions
diff --git a/rtl/core/core_control_issue.sv b/rtl/core/core_control_issue.sv
index 5bd03e1..606d0b8 100644
--- a/rtl/core/core_control_issue.sv
+++ b/rtl/core/core_control_issue.sv
@@ -68,7 +68,7 @@ module core_control_issue
pc_visible <= next_pc_visible;
`ifdef VERILATOR
- if(insn_pc != pc && insn_pc != pc + 1) begin
+ if(insn_pc != pc && insn_pc != pc + 1 && bh0 != {pc, 2'b00}) begin
bh0 <= {pc, 2'b00};
bh1 <= bh0;
bh2 <= bh1;
diff --git a/sim/sim.py b/sim/sim.py
index 6ad3d23..494d5c3 100755
--- a/sim/sim.py
+++ b/sim/sim.py
@@ -152,12 +152,12 @@ def recv_mem_dump():
while_running()
out(f'{COLOR_BLUE}{line}{COLOR_RESET}')
-def read_mem(base, length, *, may_fail = False):
+def read_mem(base, length, *, may_fail=False, phys=False):
fragments = []
i = 0
if halted and length > 0:
- print('dump-mem', base >> 2, (length + base - (base & ~0b11) + 0b11) >> 2, file=sim_end, flush=True)
+ print('dump-phys' if phys else 'dump-mem', base >> 2, (length + base - (base & ~0b11) + 0b11) >> 2, file=sim_end, flush=True)
recv_mem_dump()
while length > 0:
diff --git a/tb/top/conspiracion/conspiracion.cpp b/tb/top/conspiracion/conspiracion.cpp
index e1f5f78..1db2213 100644
--- a/tb/top/conspiracion/conspiracion.cpp
+++ b/tb/top/conspiracion/conspiracion.cpp
@@ -559,7 +559,7 @@ int main(int argc, char **argv)
}
};
- auto do_mem_dump = [&](const mem_region *dumps, std::size_t count)
+ auto do_mem_dump = [&](const mem_region *dumps, std::size_t count, bool map_virtual = true)
{
std::fputs("=== dump-mem ===\n", ctrl);
for(std::size_t i = 0; i < count; ++i)
@@ -570,7 +570,7 @@ int main(int argc, char **argv)
for(std::size_t i = 0; i < dump.length; ++i)
{
std::uint32_t at = dump.start + i;
- if(!pagewalk(at))
+ if(map_virtual && !pagewalk(at))
{
break;
}
@@ -695,6 +695,11 @@ int main(int argc, char **argv)
else if(!std::strcmp(cmd, "step")) {
current_core->step__VforceEn = 1;
break;
+ } else if (!std::strcmp(cmd, "dump-phys")) {
+ mem_region dump = {};
+ std::sscanf(std::strtok(nullptr, " "), "%zu", &dump.start);
+ std::sscanf(std::strtok(nullptr, " "), "%zu", &dump.length);
+ do_mem_dump(&dump, 1, false);
} else if (!std::strcmp(cmd, "dump-mem")) {
mem_region dump = {};
std::sscanf(std::strtok(nullptr, " "), "%zu", &dump.start);