Skip to content

Commit ab5581b

Browse files
committed
extends sc2core_if to allow accessing of arch_if
1 parent f1b4b9d commit ab5581b

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/sysc/core2sc_adapter.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#ifndef _SYSC_CORE2SC_ADAPTER_H_
3636
#define _SYSC_CORE2SC_ADAPTER_H_
3737

38+
#include "iss/arch_if.h"
3839
#include "sc2core_if.h"
3940
#include "util/delegate.h"
4041
#include "util/logging.h"
@@ -65,7 +66,7 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
6566
this->csr_rd_cb[iss::arch::timeh] = MK_CSR_RD_CB(read_time);
6667
this->memories.replace_last(*this);
6768
this->set_hartid = util::delegate<void(unsigned)>::from<this_class, &this_class::_set_mhartid>(this);
68-
this->set_irq_count = util::delegate<void(unsigned)>::from<this_class, &this_class::_set_irq_num>(this);
69+
this->get_arch_if = util::delegate<iss::arch_if*()>::from<this_class, &this_class::_get_arch_if>(this);
6970
this->get_mode = util::delegate<uint32_t()>::from<this_class, &this_class::_get_mode>(this);
7071
this->get_state = util::delegate<uint64_t()>::from<this_class, &this_class::_get_state>(this);
7172
this->get_interrupt_execution = util::delegate<bool()>::from<this_class, &this_class::_get_interrupt_execution>(this);
@@ -84,7 +85,7 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
8485

8586
void setup_mt() override {
8687
this->set_hartid = util::delegate<void(unsigned)>::from<this_class, &this_class::_set_mhartid_mt>(this);
87-
this->set_irq_count = util::delegate<void(unsigned)>::from<this_class, &this_class::_set_irq_num_mt>(this);
88+
this->get_arch_if = util::delegate<iss::arch_if*(void)>::from<this_class, &this_class::_get_arch_if>(this);
8889
this->get_mode = util::delegate<uint32_t()>::from<this_class, &this_class::_get_mode_mt>(this);
8990
this->get_state = util::delegate<uint64_t()>::from<this_class, &this_class::_get_state_mt>(this);
9091
this->get_interrupt_execution = util::delegate<bool()>::from<this_class, &this_class::_get_interrupt_execution_mt>(this);
@@ -260,11 +261,7 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
260261
PLAT::set_mhartid(id);
261262
}
262263

263-
void _set_irq_num(unsigned num) { PLAT::set_irq_num(num); }
264-
void _set_irq_num_mt(unsigned num) {
265-
std::unique_lock<mutex_t> lock(sync_mtx);
266-
PLAT::set_irq_num(num);
267-
}
264+
iss::arch_if* _get_arch_if() { return this; }
268265

269266
uint32_t _get_mode() { return this->reg.PRIV; }
270267
uint32_t _get_mode_mt() {

src/sysc/sc2core_if.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct sc2core_if {
5252

5353
virtual void enable_disass(bool enable) = 0;
5454
util::delegate<void(unsigned)> set_hartid;
55-
util::delegate<void(unsigned)> set_irq_count;
55+
util::delegate<iss::arch_if*()> get_arch_if;
5656
util::delegate<uint32_t()> get_mode;
5757
util::delegate<uint64_t()> get_state;
5858
util::delegate<bool()> get_interrupt_execution;

0 commit comments

Comments
 (0)