OSDN Git Service

* contribute Red Hat patch from 2002-06-04.
authorbje <bje>
Wed, 8 Jan 2003 02:51:57 +0000 (02:51 +0000)
committerbje <bje>
Wed, 8 Jan 2003 02:51:57 +0000 (02:51 +0000)
2002-06-04  Graydon Hoare  <graydon@redhat.com>

* cache.h (cache_component::set_refill_latency): New method.
(cache_component::get_refill_latency): New method.
(cache_component::refill_latency_specified): New flag.
(cache_component): Virtualize "refill-latency" attribute,
note when it is set in "refill_latency_specified".
* cache.cxx (read_line): Return either refill latency or
downstream latencies, depending on whether explicit refill
latency has been specified, not sum of both.

sid/component/cache/ChangeLog
sid/component/cache/cache.cxx
sid/component/cache/cache.h

index f8f8866..44b7b00 100644 (file)
        (cache_component::invalidate_set): Likewise.
        * hw-cache.xml: Update documentation.
 
+2002-06-04  Graydon Hoare  <graydon@redhat.com>
+
+       * cache.h (cache_component::set_refill_latency): New method.
+       (cache_component::get_refill_latency): New method.
+       (cache_component::refill_latency_specified): New flag.
+       (cache_component): Virtualize "refill-latency" attribute,
+       note when it is set in "refill_latency_specified".
+       * cache.cxx (read_line): Return either refill latency or
+       downstream latencies, depending on whether explicit refill
+       latency has been specified, not sum of both.
+
 2002-05-17  Ben Elliston  <bje@redhat.com>
 
        * Makefile.am (DEJAGNUTESTS): Add refill.exp.
index 1ef4784..f8e6476 100644 (file)
@@ -72,7 +72,8 @@ cache_component::cache_component (unsigned assocy,
    assoc (assocy),
    hit_latency (0),
    miss_latency (0),
-   refill_latency (0)
+   refill_latency (0),
+   refill_latency_specified (false)
 {
   memset (&stats, 0, sizeof (stats));
 
@@ -139,12 +140,18 @@ cache_component::cache_component (unsigned assocy,
 
   add_attribute ("hit-latency", &hit_latency, "setting");
   add_attribute ("miss-latency", &miss_latency, "setting");
-  add_attribute ("refill-latency", &refill_latency, "setting");
+
+  add_attribute_virtual ("refill-latency", this,
+                        &cache_component::get_refill_latency,
+                        &cache_component::set_refill_latency,
+                        "setting");
 
   // FIXME: state save/restore
 }
 
 
+
+
 // dummy dtor
 cache_component::~cache_component () throw ()
 {
@@ -342,7 +349,12 @@ cache_component::read_line (cache_line& line)
   line.unlock ();
   line.clean ();
   line.validate ();
-  st.latency = refill_latency + overall_latency;
+
+  if (refill_latency_specified)
+    st.latency = refill_latency;
+  else
+    st.latency = overall_latency;
+
   return st;
 }
 
@@ -530,6 +542,21 @@ cache_component::set_hash_mask (const string& value)
   return sid::component::ok;
 }
 
+string
+cache_component::get_refill_latency ()
+{
+  return make_attribute (refill_latency);
+}
+
+sid::component::status
+cache_component::set_refill_latency (const string& value)
+{
+  if (parse_attribute (value, refill_latency) != sid::component::ok)
+    return sid::component::bad_value;
+  refill_latency_specified = true;
+  return sid::component::ok;
+}
+
 sid::component::status
 cache_component::dump (const string& ignore)
 {
index a21b5e6..13fb138 100644 (file)
@@ -168,6 +168,8 @@ private:
   status set_hash_mask (const string& ignore);
   string get_hash_shift ();
   status set_hash_shift (const string& ignore);
+  string get_refill_latency ();
+  status set_refill_latency (const string& ignore);
 
   unsigned line_offset (const cache_line& line, const host_int_4& addr); 
 
@@ -198,6 +200,7 @@ private:
   host_int_2 hit_latency;
   host_int_2 miss_latency;
   host_int_2 refill_latency;
+  bool refill_latency_specified;
 };
 
 template <typename DataType>