fixes pin naming

This commit is contained in:
Eyck Jentzsch 2022-10-26 17:21:44 +02:00
parent 7113683ee0
commit f585489ff5
2 changed files with 23 additions and 11 deletions

View File

@ -186,17 +186,17 @@ public:
void local_irq(short id, bool value) { void local_irq(short id, bool value) {
reg_t mask = 0; reg_t mask = 0;
switch (id) { switch (id) {
case 16: // SW case 3: // SW
mask = 1 << 3; mask = 1 << 3;
break; break;
case 17: // timer case 7: // timer
mask = 1 << 7; mask = 1 << 7;
break; break;
case 18: // external case 11: // external
mask = 1 << 11; mask = 1 << 11;
break; break;
default: default:
/* do nothing*/ if(id>15) mask = 1 << id;
break; break;
} }
if (value) { if (value) {
@ -357,8 +357,11 @@ void core_complex::init(){
sensitive << sw_irq_i; sensitive << sw_irq_i;
SC_METHOD(timer_irq_cb); SC_METHOD(timer_irq_cb);
sensitive << timer_irq_i; sensitive << timer_irq_i;
SC_METHOD(global_irq_cb); SC_METHOD(ext_irq_cb);
sensitive << global_irq_i; sensitive << ext_irq_i;
SC_METHOD(local_irq_cb);
for(auto pin:local_irq_i)
sensitive << pin;
trc->m_db=scv_tr_db::get_default_db(); trc->m_db=scv_tr_db::get_default_db();
SC_METHOD(forward); SC_METHOD(forward);
@ -480,11 +483,19 @@ void core_complex::rst_cb() {
if (rst_i.read()) cpu->set_interrupt_execution(true); if (rst_i.read()) cpu->set_interrupt_execution(true);
} }
void core_complex::sw_irq_cb() { cpu->local_irq(16, sw_irq_i.read()); } void core_complex::sw_irq_cb() { cpu->local_irq(3, sw_irq_i.read()); }
void core_complex::timer_irq_cb() { cpu->local_irq(17, timer_irq_i.read()); } void core_complex::timer_irq_cb() { cpu->local_irq(7, timer_irq_i.read()); }
void core_complex::global_irq_cb() { cpu->local_irq(18, global_irq_i.read()); } void core_complex::ext_irq_cb() { cpu->local_irq(11, ext_irq_i.read()); }
void core_complex::local_irq_cb() {
for(auto i=0U; i<local_irq_i.size(); ++i) {
if(local_irq_i[i].event()) {
cpu->local_irq(16+i, local_irq_i[i].read());
}
}
}
void core_complex::run() { void core_complex::run() {
wait(SC_ZERO_TIME); // separate from elaboration phase wait(SC_ZERO_TIME); // separate from elaboration phase

View File

@ -73,7 +73,7 @@ public:
sc_core::sc_in<bool> rst_i{"rst_i"}; sc_core::sc_in<bool> rst_i{"rst_i"};
sc_core::sc_in<bool> global_irq_i{"global_irq_i"}; sc_core::sc_in<bool> ext_irq_i{"ext_irq_i"};
sc_core::sc_in<bool> timer_irq_i{"timer_irq_i"}; sc_core::sc_in<bool> timer_irq_i{"timer_irq_i"};
@ -181,7 +181,8 @@ protected:
void rst_cb(); void rst_cb();
void sw_irq_cb(); void sw_irq_cb();
void timer_irq_cb(); void timer_irq_cb();
void global_irq_cb(); void ext_irq_cb();
void local_irq_cb();
uint64_t last_sync_cycle = 0; uint64_t last_sync_cycle = 0;
util::range_lut<tlm_dmi_ext> read_lut, write_lut; util::range_lut<tlm_dmi_ext> read_lut, write_lut;
tlm_utils::tlm_quantumkeeper quantum_keeper; tlm_utils::tlm_quantumkeeper quantum_keeper;