Line 1... |
Line 1... |
|
/*
|
|
* Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
#include "soc_info.h"
|
#include "soc_info.h"
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
/** Class registration in the Core */
|
/** Class registration in the Core */
|
Line 37... |
Line 53... |
}
|
}
|
|
|
void SocInfo::getRegsList(AttributeType *lst) {
|
void SocInfo::getRegsList(AttributeType *lst) {
|
lst->make_list(listRegs_.size());
|
lst->make_list(listRegs_.size());
|
for (unsigned i = 0; i < listRegs_.size(); i++) {
|
for (unsigned i = 0; i < listRegs_.size(); i++) {
|
(*lst)[i] = listRegs_[i][0u];
|
const AttributeType &name = listRegs_[i][0u];
|
|
if (name.size() == 0) {
|
|
continue;
|
|
}
|
|
(*lst)[i] = name;
|
}
|
}
|
}
|
}
|
|
|
unsigned SocInfo::getCsrTotal() {
|
unsigned SocInfo::getCsrTotal() {
|
return listCSR_.size();
|
return listCSR_.size();
|
Line 65... |
Line 85... |
}
|
}
|
return REG_ADDR_ERROR;
|
return REG_ADDR_ERROR;
|
}
|
}
|
|
|
uint64_t SocInfo::reg2addr(const char *name) {
|
uint64_t SocInfo::reg2addr(const char *name) {
|
DsuMapType *dsu = reinterpret_cast<DsuMapType *>(dsuBase_.to_uint64());
|
|
for (unsigned i = 0; i < listRegs_.size(); i++) {
|
for (unsigned i = 0; i < listRegs_.size(); i++) {
|
if (strcmp(name, listRegs_[i][0u].to_string()) == 0) {
|
if (strcmp(name, listRegs_[i][0u].to_string()) == 0) {
|
return reinterpret_cast<uint64_t>(
|
return dsuBase_.to_uint64() + listRegs_[i][2].to_uint64();
|
&dsu->ureg.v.iregs[listRegs_[i][2].to_uint64()]);
|
|
}
|
}
|
}
|
}
|
return REG_ADDR_ERROR;
|
return REG_ADDR_ERROR;
|
}
|
}
|
|
|