From aca7b32d6ed6cdd7dd479f01a2ebb004cde201d5 Mon Sep 17 00:00:00 2001 From: brolley Date: Fri, 29 Aug 2003 19:45:10 +0000 Subject: [PATCH] 2003-08-29 Dave Brolley * compSched.cxx (operator <<): Stream active_p and active_pin. (operator >>): Ditto. (active_p): New member of scheduler_component. (active_pin): Ditto. (advance): Drive active_pin with 1 or 0 as the enable threshold is crossed. (scheduler_component): Initialize active_p. Add "active_pin". (sid-sched.xml): Document "active" pin and interaction between "enabled?" and "enable-threshold". (sid-sched.txt): Regenerated. --- sid/component/sched/ChangeLog | 13 +++++++++++++ sid/component/sched/compSched.cxx | 24 ++++++++++++++++++++++++ sid/component/sched/sid-sched.txt | 21 ++++++++++++++++++--- sid/component/sched/sid-sched.xml | 16 ++++++++++++---- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/sid/component/sched/ChangeLog b/sid/component/sched/ChangeLog index 96f8e0de4b..daa1651715 100644 --- a/sid/component/sched/ChangeLog +++ b/sid/component/sched/ChangeLog @@ -1,3 +1,16 @@ +2003-08-29 Dave Brolley + + * compSched.cxx (operator <<): Stream active_p and active_pin. + (operator >>): Ditto. + (active_p): New member of scheduler_component. + (active_pin): Ditto. + (advance): Drive active_pin with 1 or 0 as the enable + threshold is crossed. + (scheduler_component): Initialize active_p. Add "active_pin". + (sid-sched.xml): Document "active" pin and interaction between + "enabled?" and "enable-threshold". + (sid-sched.txt): Regenerated. + 2003-02-06 Frank Ch. Eigler * compSched.cxx (operator <<,>>): Clean up decls of these templates. diff --git a/sid/component/sched/compSched.cxx b/sid/component/sched/compSched.cxx index 1f35657a3a..f7abc88b73 100644 --- a/sid/component/sched/compSched.cxx +++ b/sid/component/sched/compSched.cxx @@ -1215,10 +1215,12 @@ operator << (ostream& o, const scheduler_component& it) o << "scheduler-state " << it.enable_threshold << " " << it.enable_p << " " + << it.active_p << " " << it.yield_host_time_threshold << " " << it.yield_host_time_p << " " << it.sched.step_cycle_limit << " " // this is a component attribute << it.advance_count << " " + << it.active_pin << " " << it.yield_pin << " " << it.advance_pin << endl; @@ -1260,10 +1262,12 @@ operator >> (istream& i, scheduler_component& it) { i >> it.enable_threshold >> it.enable_p + >> it.active_p >> it.yield_host_time_threshold >> it.yield_host_time_p >> it.sched.step_cycle_limit >> it.advance_count + >> it.active_pin >> it.yield_pin >> it.advance_pin; @@ -1333,12 +1337,14 @@ class scheduler_component: public scheduler_component_base int enable_p; int yield_host_time_threshold; int yield_host_time_p; + bool active_p; host_int_8 advance_count; callback_pin advance_pin; callback_pin time_query_pin; callback_pin yield_pin; output_pin time_low_pin; output_pin time_high_pin; + output_pin active_pin; public: @@ -1392,9 +1398,25 @@ protected: << " yield_host_time_threshold==" << this->yield_host_time_threshold << endl; #endif + // Drive the active pin if the threshold has been crossed. + if (UNLIKELY(! this->active_p)) + { + this->active_pin.drive (1); + this->active_p = true; + } + this->advance_count ++; this->sched.advance (this->yield_host_time_p >= this->yield_host_time_threshold); } + else + { + // Drive the active pin if the threshold has been crossed. + if (UNLIKELY(this->active_p)) + { + this->active_pin.drive (0); + this->active_p = false; + } + } } @@ -1431,6 +1453,7 @@ public: clients(0), num_clients(0), enable_threshold(1), + active_p (false), enable_p(1), yield_host_time_threshold(1), yield_host_time_p(0), @@ -1457,6 +1480,7 @@ scheduler_component::scheduler_component_ctor_1() add_pin ("time-high", & this->time_high_pin); add_pin ("time-low", & this->time_low_pin); add_pin ("yield", & this->yield_pin); + add_pin ("active", & this->active_pin); add_attribute ("yield", & this->yield_pin, "pin"); add_attribute ("enable-threshold", & this->enable_threshold, "setting"); add_attribute ("enabled?", & this->enable_p, "setting"); diff --git a/sid/component/sched/sid-sched.txt b/sid/component/sched/sid-sched.txt index ef35077a2a..0761897701 100644 --- a/sid/component/sched/sid-sched.txt +++ b/sid/component/sched/sid-sched.txt @@ -148,7 +148,20 @@ Functionality: | | driving the N-event output pins | | | with some value. A counter | | | accessed by the advance-count | - | | attribute is incremented. | + | | attribute is incremented. If | + | | the attribute enabled? has been | + | | changed from a value below | + | | enable-threshold to a value | + | | greater than or equal to | + | | enable-threshold, then the pin | + | | active will be driven with the | + | | value 1. If the attribute | + | | enabled? has been changed from | + | | a value grater than or equal to | + | | enable-threshold to a value | + | | less than enable-threshold, | + | | then the pin active will be | + | | driven with the value 0. | | | | | | Whether any particular N-event | | | pin is driven depends on the | @@ -245,6 +258,8 @@ Component Reference: |----------+---------+---------------+------------| |yield |in |any |advancing | |----------+---------+---------------+------------| + |active |out |boolean |advancing | + |----------+---------+---------------+------------| |N-event |out |no value |advancing | |----------+---------+---------------+------------| |N-control |in |coded value |subscription| @@ -288,9 +303,9 @@ Component Reference: |-------------------------+--------+--------+----------------+-------------|| |yield |pin |- |- |advancing || |-------------------------+--------+--------+----------------+-------------|| - |enable-theshold |setting |numeric |'1' |advancing || + |enabled? |setting |numeric |'1' |advancing || |-------------------------+--------+--------+----------------+-------------|| - |enabled? |setting |numeric |enable-threshold|advancing || + |enable-threshold |setting |numeric |'1' |advancing || |-------------------------+--------+--------+----------------+-------------|| |yield-host-time-threshold|setting |numeric |'1' |timing || |-------------------------+--------+--------+----------------+-------------|| diff --git a/sid/component/sched/sid-sched.xml b/sid/component/sched/sid-sched.xml index e647eaa19d..17f4c446f7 100644 --- a/sid/component/sched/sid-sched.xml +++ b/sid/component/sched/sid-sched.xml @@ -8,6 +8,7 @@ + @@ -26,8 +27,8 @@ - - + + @@ -136,14 +137,21 @@

When you have disabled the scheduler by setting the - enabled? attribute to a value less than enable-threshold, + enabled? attribute to a value less than enable-threshold, advancing as described below, does not occur.

Whenever the advance input pin is driven, the scheduler may dispatch one or more signals by driving the N-event output pins with some value. A counter accessed by the advance-count - attribute is incremented. + attribute is incremented. If the attribute enabled? has + been changed from a value below enable-threshold to a value + greater than or equal to enable-threshold, then the pin + active will be driven with the value 1. If the attribute + enabled? has been changed from a value grater than or equal to + enable-threshold to a value less than + enable-threshold, then the pin + active will be driven with the value 0.

Whether any particular N-event pin is driven depends on -- 2.11.0