OpenCores
URL https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [libdbg64g/] [services/] [exec/] [cmd/] [cmd_halt.cpp] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 sergeykhbr
/**
2
 * @file
3
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
4
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
5
 * @brief      Halt simulation.
6
 */
7
 
8
#include "cmd_halt.h"
9
 
10
namespace debugger {
11
 
12
CmdHalt::CmdHalt(ITap *tap, ISocInfo *info)
13
    : ICommand ("halt", tap, info) {
14
 
15
    briefDescr_.make_string("Stop simulation");
16
    detailedDescr_.make_string(
17
        "Description:\n"
18
        "    Stop simulation.\n"
19
        "Example:\n"
20
        "    halt\n"
21
        "    stop\n"
22
        "    s\n");
23
}
24
 
25
 
26
bool CmdHalt::isValid(AttributeType *args) {
27
    AttributeType &name = (*args)[0u];
28
    if (name.is_equal("halt") || name.is_equal("break")
29
        || name.is_equal("stop") || name.is_equal("s")) {
30
        return CMD_VALID;
31
    }
32
    return CMD_INVALID;
33
}
34
 
35
void CmdHalt::exec(AttributeType *args, AttributeType *res) {
36
    res->make_nil();
37
    if (!isValid(args)) {
38
        generateError(res, "Wrong argument list");
39
        return;
40
    }
41
 
42
    Reg64Type t1;
43
    DsuMapType *dsu = info_->getpDsu();
44
    DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
45
    uint64_t addr_run_ctrl = reinterpret_cast<uint64_t>(&dsu->udbg.v.control);
46
    ctrl.val = 0;
47
    ctrl.bits.halt = 1;
48
    t1.val = ctrl.val;
49
    tap_->write(addr_run_ctrl, 8, t1.buf);
50
}
51
 
52
}  // namespace debugger

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.