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_run.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      Run simulation.
6
 */
7
 
8
#include "cmd_run.h"
9
 
10
namespace debugger {
11
 
12
CmdRun::CmdRun(ITap *tap, ISocInfo *info)
13
    : ICommand ("run", tap, info) {
14
 
15
    briefDescr_.make_string("Run simulation for a specify number of steps\"");
16
    detailedDescr_.make_string(
17
        "Description:\n"
18
        "    Run simulation for a specified number of steps.\n"
19
        "Usage:\n"
20
        "    run <N steps>\n"
21
        "Example:\n"
22
        "    run\n"
23
        "    go 1000\n"
24
        "    c 1\n");
25
}
26
 
27
 
28
bool CmdRun::isValid(AttributeType *args) {
29
    AttributeType &name = (*args)[0u];
30
    if ((name.is_equal("run") || name.is_equal("c") || name.is_equal("go"))
31
     && (args->size() == 1 || args->size() == 2)) {
32
        return CMD_VALID;
33
    }
34
    return CMD_INVALID;
35
}
36
 
37
void CmdRun::exec(AttributeType *args, AttributeType *res) {
38
    res->make_nil();
39
    if (!isValid(args)) {
40
        generateError(res, "Wrong argument list");
41
        return;
42
    }
43
    DsuMapType *dsu = info_->getpDsu();
44
    Reg64Type runctrl;
45
    uint64_t addr_run_ctrl = reinterpret_cast<uint64_t>(&dsu->udbg.v.control);
46
    uint64_t addr_step_cnt =
47
        reinterpret_cast<uint64_t>(&dsu->udbg.v.stepping_mode_steps);
48
 
49
    if (args->size() == 1) {
50
        runctrl.val = 0;
51
        tap_->write(addr_run_ctrl, 8, runctrl.buf);
52
    } else if (args->size() == 2) {
53
        runctrl.val = (*args)[1].to_uint64();
54
        tap_->write(addr_step_cnt, 8, runctrl.buf);
55
 
56
        DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
57
        ctrl.val = 0;
58
        ctrl.bits.stepping = 1;
59
        runctrl.val = ctrl.val;
60
        tap_->write(addr_run_ctrl, 8, runctrl.buf);
61
    }
62
}
63
 
64
}  // namespace debugger

powered by: WebSVN 2.1.0

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