3535#ifndef _SYSC_CORE2SC_ADAPTER_H_
3636#define _SYSC_CORE2SC_ADAPTER_H_
3737
38- #include " core_complex.h"
39- #include " iss/log_categories.h"
4038#include " sc2core_if.h"
4139#include " util/delegate.h"
4240#include " util/logging.h"
4846#include < scc/async_event.h>
4947#include < scc/report.h>
5048#include < shared_mutex>
49+ #include < sysc/kernel/sc_time.h>
5150#include < util/instance_logger.h>
5251#include < util/ities.h>
5352
@@ -245,7 +244,7 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
245244 void wait_until (uint64_t flags) {
246245 SCCDEBUG (owner->hier_name ()) << " Sleeping until interrupt" ;
247246 PLAT::wait_until (flags);
248- while (this -> reg . pending_trap == 0 && (this ->csr [iss::arch::mip] & this ->csr [iss::arch::mie]) == 0 ) {
247+ while ((this ->csr [iss::arch::mip] & this ->csr [iss::arch::mie]) == 0 ) {
249248 sc_core::wait (wfi_evt);
250249 }
251250 }
@@ -289,21 +288,8 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
289288
290289 void _local_irq (short id, bool value) {
291290 reg_t mask = 0 ;
292- switch (id) {
293- case 3 : // SW
294- mask = 1 << 3 ;
295- break ;
296- case 7 : // timer
297- mask = 1 << 7 ;
298- break ;
299- case 11 : // external
300- mask = 1 << 11 ;
301- break ;
302- default :
303- if (id > 15 )
304- mask = 1 << id;
305- break ;
306- }
291+ assert (id < 32 && " CLINT cannot handle more tahn 32 irq" );
292+ mask = 1 << id;
307293 if (value) {
308294 this ->csr [iss::arch::mip] |= mask;
309295 wfi_evt.notify ();
@@ -313,6 +299,7 @@ template <typename PLAT> class core2sc_adapter : public PLAT, public sc2core_if
313299 if (value)
314300 SCCTRACE (owner->hier_name ()) << " Triggering interrupt " << id << " Pending trap: " << this ->reg .pending_trap ;
315301 }
302+
316303 void _local_irq_mt (short id, bool value) {
317304 std::unique_lock<mutex_t > lock (sync_mtx);
318305 _local_irq (id, value);
0 commit comments