npc,fix: bugs of new arch in cpu-tests
All checks were successful
Build npc tests / npc-build (flow-simlib) (push) Successful in 2m17s
Build abstract machine with nix / build-packages (abstract-machine) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (nemu) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (nemu-lib) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (rv32Cross.abstract-machine) (pull_request) Successful in 8s
Build npc tests / npc-build (flow) (push) Successful in 3m2s
All checks were successful
Build npc tests / npc-build (flow-simlib) (push) Successful in 2m17s
Build abstract machine with nix / build-packages (abstract-machine) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (nemu) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (nemu-lib) (pull_request) Successful in 9s
Build abstract machine with nix / build-packages (rv32Cross.abstract-machine) (pull_request) Successful in 8s
Build npc tests / npc-build (flow) (push) Successful in 3m2s
This commit is contained in:
parent
fd1aae7c33
commit
f5335c21f1
29 changed files with 1315 additions and 544 deletions
|
@ -19,4 +19,4 @@ void Config::cli_parse(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
Config config;
|
||||
Config config{.wavefile = "flowwave.vcd"};
|
||||
|
|
|
@ -7,6 +7,7 @@ extern "C" {
|
|||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <devices.hpp>
|
||||
#include <string>
|
||||
#include <types.h>
|
||||
#include <vl_wrapper.hpp>
|
||||
#include <vpi_user.h>
|
||||
|
@ -39,21 +40,19 @@ void *pmem_get() {
|
|||
return pmem;
|
||||
}
|
||||
|
||||
int pmem_read(int raddr) {
|
||||
int pmem_read(int raddr, int rmask) {
|
||||
void *pmem = pmem_get();
|
||||
auto mem = static_cast<MMap *>(pmem);
|
||||
// TODO: Do memory difftest at memory read and write to diagnose at a finer
|
||||
// granularity
|
||||
mem->trace(raddr, true, regs->get_pc());
|
||||
if (g_skip_memcheck)
|
||||
return mem->read(PMEM_START);
|
||||
return mem->read(raddr);
|
||||
return mem->read(PMEM_START, rmask);
|
||||
return mem->read(raddr, rmask);
|
||||
}
|
||||
|
||||
void pmem_write(int waddr, int wdata, char wmask) {
|
||||
void *pmem = pmem_get();
|
||||
auto mem = static_cast<MMap *>(pmem);
|
||||
mem->trace((std::size_t)waddr, false, regs->get_pc(), wdata);
|
||||
return mem->write((std::size_t)waddr, wdata, wmask);
|
||||
}
|
||||
|
||||
|
@ -146,13 +145,37 @@ void npc_init(void *args) {
|
|||
DbgState *dbg = (DbgState *)args;
|
||||
void *mem = pmem_get();
|
||||
dbg->bp = new std::vector<Breakpoint>;
|
||||
dbg->cmd_return_buf = new std::string;
|
||||
|
||||
top = new VlModule;
|
||||
regs = new Registers("TOP.Flow.reg_0.regFile_", "TOP.Flow.pc.out");
|
||||
regs = new Registers("TOP.Flow.ID.regs_regFile_",
|
||||
"TOP.Flow.WB.msgio_in_bits_pc");
|
||||
top->setup(config.wavefile, regs);
|
||||
top->reset_eval(10);
|
||||
}
|
||||
|
||||
char *npc_monitor(void *args, char **argv, int argc) {
|
||||
DbgState *dbg = (DbgState *)args;
|
||||
std::string *cmd_return_buf = dbg->cmd_return_buf;
|
||||
|
||||
if (strncmp(argv[0], "trace", 5) == 0) {
|
||||
if (strncmp(argv[1], "on", 2) == 0) {
|
||||
*cmd_return_buf = "Tracing turned on\n";
|
||||
if (!top->start_trace())
|
||||
*cmd_return_buf = "Failed to turn on tracing\n";
|
||||
return cmd_return_buf->data();
|
||||
} else if (strncmp(argv[1], "off", 3) == 0) {
|
||||
*cmd_return_buf = "Tracing turned off\n";
|
||||
if (!top->end_trace())
|
||||
*cmd_return_buf = "Failed to turn on tracing\n";
|
||||
return cmd_return_buf->data();
|
||||
}
|
||||
}
|
||||
|
||||
*cmd_return_buf = "Command not found\n";
|
||||
return cmd_return_buf->data();
|
||||
}
|
||||
|
||||
bool npc_do_difftest = true;
|
||||
|
||||
static gdbstub_t gdbstub_priv;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue