2 # Basic testing for the LRU replacement policy.
4 # Copyright (C) 2001 Red Hat, Inc.
6 source $srcdir/$subdir/utils.exp
9 sid_config_component_test_with_tracing "cache.conf" \
10 "load [sid_find_file libcache.la] cache_component_library" \
11 "hw-cache-4way/16kb/32/lru"
12 if {[sid_start "cache.conf"]} { pass $test } else { fail $test; return }
14 set test "acquire upstream bus handle"
15 set cache_bus [sid_cmd "sid::component::find_bus $victim upstream"]
16 if {$cache_bus != ""} { pass $test } else { fail $test }
18 set test "generate test bus for downstream"
19 set mem_bus [sid_cmd "sid::bus::new"]
20 if {$mem_bus == ""} { fail $test } else { pass $test }
22 set test "connect test bus to cache"
23 set result [sid_cmd "sid::component::connect_accessor $victim downstream $mem_bus"]
24 if {$result == "ok"} { pass $test } else { fail $test }
26 instrument_bus $mem_bus
28 foreach addr {0x100 0x4100 0x8100 0xc100} {
29 set test "read byte from $addr"
31 set result [sid_cmd "sid::bus::read_h4_l1 $cache_bus $addr"]
35 # These should still hit, since there are four lines per set.
36 foreach addr {0x100 0x4100 0x8100 0xc100} {
37 set test "read byte again from $addr"
39 set result [sid_cmd "sid::bus::read_h4_l1 $cache_bus $addr"]
43 # Out of lines in the set!
44 set test "read byte from 0x10100"
46 set result [sid_cmd "sid::bus::read_h4_l1 $cache_bus 0x10100"]
49 # This line should still be present, since it was used recently.
50 set test "read byte from 0x8100"
52 set result [sid_cmd "sid::bus::read_h4_l1 $cache_bus 0x8100"]