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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [gui_plugin/] [CpuWidgets/] [RegWidget.cpp] - Diff between revs 3 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 1... Line 1...
/**
/*
 * @file
 *  Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
 * @copyright  Copyright 2016 GNSS Sensor Ltd. All right reserved.
 *
 * @author     Sergey Khabarov - sergeykhbr@gmail.com
 *  Licensed under the Apache License, Version 2.0 (the "License");
 * @brief      CPU' register editor.
 *  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 "RegWidget.h"
#include "RegWidget.h"
#include "moc_RegWidget.h"
#include "moc_RegWidget.h"
 
 
Line 13... Line 22...
#include <QtWidgets/QBoxLayout>
#include <QtWidgets/QBoxLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLabel>
 
 
namespace debugger {
namespace debugger {
 
 
RegWidget::RegWidget(const char *name, QWidget *parent)
RegWidget::RegWidget(const char *name, int bytes, QWidget *parent)
    : QWidget(parent) {
    : QWidget(parent) {
    value_ = 0;
    value_ = 0;
 
 
    regName_.make_string(name);
    regName_.make_string(name);
    name_ = QString(name);
    name_ = QString(name);
Line 50... Line 59...
    label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
    pLayout->addWidget(label);
    pLayout->addWidget(label);
 
 
    edit_ = new QLineEdit(this);
    edit_ = new QLineEdit(this);
    pLayout->addWidget(edit_);
    pLayout->addWidget(edit_);
 
    RISCV_sprintf(fmtValue_, sizeof(fmtValue_), "%%0%d" RV_PRI64 "x", 2*bytes);
    respValue_ = value_ = 0xfeedfaceull;
    respValue_ = value_ = 0xfeedfaceull;
 
 
    char tstr[64];
    char tstr[64];
    RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_);
    RISCV_sprintf(tstr, sizeof(tstr), fmtValue_, value_);
 
 
    QString text(tstr);
    QString text(tstr);
    edit_->setText(text);
    edit_->setText(text);
    edit_->setMaxLength(19);
    edit_->setMaxLength(19);
    edit_->setFixedWidth(fm.width(text) + 8);
    edit_->setFixedWidth(fm.width(text) + 8);
    edit_->setFixedHeight(fm.height() + 2);
    edit_->setFixedHeight(fm.height() + 2);
Line 78... Line 89...
    }
    }
    respValue_ = (*resp)[regName_.to_string()].to_uint64();
    respValue_ = (*resp)[regName_.to_string()].to_uint64();
    if (value_ != respValue_) {
    if (value_ != respValue_) {
        char tstr[64];
        char tstr[64];
        value_ = respValue_;
        value_ = respValue_;
        RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_);
        RISCV_sprintf(tstr, sizeof(tstr), fmtValue_, value_);
        QString text(tr(tstr));
        QString text(tr(tstr));
        edit_->setText(text);
        edit_->setText(text);
    }
    }
}
}
 
 

powered by: WebSVN 2.1.0

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