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

Subversion Repositories riscv_vhdl

[/] [riscv_vhdl/] [trunk/] [debugger/] [src/] [socsim_plugin/] [pnp.cpp] - Diff between revs 2 and 4

Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 11... Line 11...
 
 
namespace debugger {
namespace debugger {
 
 
PNP::PNP(const char *name)  : IService(name) {
PNP::PNP(const char *name)  : IService(name) {
    registerInterface(static_cast<IMemoryOperation *>(this));
    registerInterface(static_cast<IMemoryOperation *>(this));
    registerAttribute("BaseAddress", &baseAddress_);
 
    registerAttribute("Length", &length_);
 
    registerAttribute("Tech", &tech_);
    registerAttribute("Tech", &tech_);
    registerAttribute("AdcDetector", &adc_detector_);
    registerAttribute("AdcDetector", &adc_detector_);
 
 
    baseAddress_.make_uint64(0);
 
    length_.make_uint64(0);
 
    tech_.make_uint64(0);
    tech_.make_uint64(0);
    adc_detector_.make_uint64(0);
    adc_detector_.make_uint64(0);
 
 
    memset(&regs_, 0, sizeof(regs_));
    memset(&regs_, 0, sizeof(regs_));
    iter_.buf = regs_.cfg_table;
    iter_.buf = regs_.cfg_table;
Line 80... Line 76...
    regs_.tech.bits.tech = static_cast<uint8_t>(tech_.to_uint64());
    regs_.tech.bits.tech = static_cast<uint8_t>(tech_.to_uint64());
    regs_.tech.bits.adc_detect =
    regs_.tech.bits.adc_detect =
        static_cast<uint8_t>(adc_detector_.to_uint64());
        static_cast<uint8_t>(adc_detector_.to_uint64());
}
}
 
 
void PNP::b_transport(Axi4TransactionType *trans) {
ETransStatus PNP::b_transport(Axi4TransactionType *trans) {
    uint64_t mask = (length_.to_uint64() - 1);
    uint64_t mask = (length_.to_uint64() - 1);
    uint64_t off = ((trans->addr - getBaseAddress()) & mask);
    uint64_t off = ((trans->addr - getBaseAddress()) & mask);
    uint8_t *mem_ = reinterpret_cast<uint8_t *>(&regs_);
    uint8_t *mem_ = reinterpret_cast<uint8_t *>(&regs_);
    if (trans->action == MemAction_Write) {
    if (trans->action == MemAction_Write) {
        for (uint64_t i = 0; i < trans->xsize; i++) {
        for (uint64_t i = 0; i < trans->xsize; i++) {
Line 96... Line 92...
    } else {
    } else {
        for (uint64_t i = 0; i < trans->xsize; i++) {
        for (uint64_t i = 0; i < trans->xsize; i++) {
            trans->rpayload.b8[i] = mem_[off + i];
            trans->rpayload.b8[i] = mem_[off + i];
        }
        }
    }
    }
 
    return TRANS_OK;
}
}
 
 
}  // namespace debugger
}  // namespace debugger
 
 
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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