1/1

|
[or1ksim #10] Don't call pic_clock when not needed
by Unknown on Jan 30, 2005 |
Not available! | ||
|
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) { |
|||
|
[or1ksim #10] Don't call pic_clock when not needed
by Unknown on Feb 1, 2005 |
Not available! | ||
|
* György 'nog' Jeney (nog@sdf.lonestar.org) wrote:
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. I think that idea was to try and implement peripherals in a kind-of modular way. As far as i see original intent was to handle all the peripherals in similar way, and *_clock() function would be one of the hooks. I can see this is not needed with patch #9, but i'm not really convinced about that one... ;) best regards, p. |
|||
|
[or1ksim #10] Don't call pic_clock when not needed
by Unknown on Feb 1, 2005 |
Not available! | ||
|
I think that idea was to try and implement peripherals
in a kind-of modular way. As far as i see original intent was to handle all the peripherals in similar way, and *_clock() function would be one of the hooks. I can see this is not needed with patch #9, but i'm not really convinced about that one... ;) I was actually going the remove all the *_clock calls from the main loop and use the scheduler for it. Can't we make the scheduler the standard simulator hook? After all that's what it was designed for, no? I was also thinking about making each peripheral a seporate dynamically linked library, which would allow us to clean up alot of the includes and peripheral specific hacks. This will require a nearly total rewrite of sim-config.c (I think). Also the main simulator binary wouldn't be bloated with code that was never used. nog. |
|||
1/1

