2001-09-27 Frank Ch. Eigler <fche@redhat.com>
* cache.cxx (emit_report): Remove extra blank line.
(set_hash_mask, set_hash_shift): Exchange names to match functionality.
* cacheutil.cxx (cache ctor): Compute good default hash_params.
+2001-09-27 Frank Ch. Eigler <fche@redhat.com>
+
+ * cache.cxx (emit_report): Remove extra blank line.
+ (set_hash_mask, set_hash_shift): Exchange names to match functionality.
+ * cacheutil.cxx (cache ctor): Compute good default hash_params.
+
2001-09-26 Frank Ch. Eigler <fche@redhat.com>
* cacheutil.cxx (hash_fn): Detect index overflow. Complain loudly.
void
cache_component::emit_report (host_int_4 ignore)
{
- cout << report_heading << endl << endl
+ cout << report_heading << endl
<< "reads: " << make_attribute (stats.reads) << endl
<< "read hits: " << read_hit_rate () << endl
<< "writes: " << make_attribute (stats.writes) << endl
}
sid::component::status
-cache_component::set_hash_mask (const string& value)
+cache_component::set_hash_shift (const string& value)
{
unsigned shift;
}
sid::component::status
-cache_component::set_hash_shift (const string& value)
+cache_component::set_hash_mask (const string& value)
{
sid::host_int_4 mask;
num_non_tag_bits = log2 (line_size);
- // suitable defaults
- hash_params.mask = 0x3fe0;
- hash_params.shift = 5;
+ // Pick a default hash function: the next few bits above the intra-line address bits
+ unsigned cache_set_bits = log2 (sets.size());
+ hash_params.mask = ((1U << cache_set_bits) - 1) << num_non_tag_bits;
+ hash_params.shift = num_non_tag_bits;
}
cache::~cache ()