|
Message
From: =?unknown-8bit?Q?Gy=F6rgy?= 'nog' Jeney<nog@s...>
Date: Sun Jan 30 16:07:35 CET 2005
Subject: [openrisc] [or1ksim #10] Don't call pic_clock when not needed
Hi,Now, that except_handler_backend has been removed, we don't need to call pic_clock on *every* simulated clock cycle.
ChangeLog: * Don't call pic_clock on *each* simulated clock cycle.
nog. -------------- next part -------------- --- pic/pic.h 2004-07-20 01:01:18.000000000 +0200 +++ ../or1ksim-ac/pic/pic.h 2005-01-30 14:53:53.000000000 +0100 @@ -19,5 +19,4 @@ /* Prototypes */ void pic_reset(); -inline void pic_clock(); void report_interrupt(int line); --- toplevel.c 2005-01-29 09:44:21.000000000 +0100 +++ ../or1ksim-ac/toplevel.c 2005-01-30 14:52:50.000000000 +0100 @@ -794,7 +801,6 @@ runtime.sim.mem_cycles = 0; if (!config.pm.enabled || !testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) { if (runtime.sim.cont_run > 0) runtime.sim.cont_run--; - pic_clock (); if (cpu_clock ()) break; if (config.dc.enabled) dc_clock(); if (config.ic.enabled) ic_clock(); --- pic/pic.c 2005-01-30 15:53:26.000000000 +0100 +++ ../or1ksim-ac/pic/pic.c 2005-01-30 15:16:58.000000000 +0100 @@ -39,6 +39,7 @@ #include "except.h" #include "sprs.h" #include "debug.h" +#include "sched.h" /* Reset. It initializes PIC registers. */ void pic_reset() @@ -49,16 +50,19 @@ mtspr(SPR_PICSR, 0); } -/* Simulation hook. Must be called every clock cycle to simulate PIC - It does internal functional PIC simulation. */ -inline void pic_clock() +/* Simulation hook. Called when interrupts are masked. */ +void pic_clock(int i) { - /* Don't do anything if interrupts not currently enabled or - higher priority exception was allready reported */ - if(mfspr(SPR_PICSR) && testsprbits (SPR_SR, SPR_SR_IEE)) + /* Don't do anything if interrupts not currently enabled */ + if(testsprbits (SPR_SR, SPR_SR_IEE)) except_handle(EXCEPT_INT, mfspr(SPR_EEAR_BASE)); + else + SCHED_ADD(pic_clock, 0, runtime.sim.cycles + 1); } +/* WARNING: Don't eaven try and call this function *during* a simulated + * instruction!! (as in during a read_mem or write_mem callback). except_handle + * assumes that this is the case, it breaks otherwise. */ /* Asserts interrupt to the PIC. */ void report_interrupt(int line) {
|
 |