1 | #include "processor.h" |
---|
2 | #include "l1cache.h" |
---|
3 | #include "address.h" |
---|
4 | #include "raw_address.h" |
---|
5 | #include "monitor.h" |
---|
6 | #include "cache_store.h" |
---|
7 | #define TAILLE_LIGNE 8 |
---|
8 | |
---|
9 | int sc_main(int argc, char **argv) |
---|
10 | { |
---|
11 | if (argc != 2) { |
---|
12 | cout << "usage : " << argv[0] << " filename" << endl; |
---|
13 | exit(0); |
---|
14 | } |
---|
15 | |
---|
16 | sc_clock clock("Clock", 1,SC_NS); |
---|
17 | |
---|
18 | sc_signal<RawAddress> request; |
---|
19 | sc_signal<RawAddress> answer; |
---|
20 | |
---|
21 | sc_signal<bool> l1_activate; |
---|
22 | sc_signal<bool> proc_activate; |
---|
23 | |
---|
24 | sc_signal<bool> l1miss_info; |
---|
25 | sc_signal<bool> l1hit_info; |
---|
26 | |
---|
27 | Processor processor("Processor", argv[1]); |
---|
28 | L1Cache l1cache("L1Cache", 256, TAILLE_LIGNE, FULLY_ASSOCIATIVE, 2); |
---|
29 | Monitor monitor("Monitor"); |
---|
30 | |
---|
31 | processor.clock(clock); |
---|
32 | l1cache.clock(clock); |
---|
33 | monitor.clock(clock); |
---|
34 | |
---|
35 | l1cache.in_activate(l1_activate); |
---|
36 | processor.out_activate(l1_activate); |
---|
37 | |
---|
38 | l1cache.out_activate(proc_activate); |
---|
39 | processor.in_activate(proc_activate); |
---|
40 | |
---|
41 | processor.out_data(request); |
---|
42 | l1cache.in_data(request); |
---|
43 | |
---|
44 | processor.in_data(answer); |
---|
45 | l1cache.out_data(answer); |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | l1cache.hit_info(l1hit_info); |
---|
50 | monitor.l1hit_signal(l1hit_info); |
---|
51 | |
---|
52 | l1cache.miss_info(l1miss_info); |
---|
53 | monitor.l1miss_signal(l1miss_info); |
---|
54 | |
---|
55 | |
---|
56 | |
---|
57 | sc_start(1000, SC_NS); |
---|
58 | return 0; |
---|
59 | } |
---|