source:
trunk/src/l2cache.h
@
7
Last change on this file since 7 was 5, checked in by , 15 years ago | |
---|---|
File size: 1.8 KB |
Rev | Line | |
---|---|---|
[2] | 1 | #ifndef L2CACHE_H_ |
2 | #define L2CACHE_H_ | |
3 | ||
4 | #include <systemc.h> | |
5 | #include "address.h" | |
6 | #include "queue.h" | |
7 | #include "processing_queue.h" | |
8 | #include "cache_store.h" | |
9 | ||
10 | SC_MODULE(L2Cache) | |
11 | { | |
12 | // clock | |
13 | sc_in_clk clock; | |
14 | ||
15 | // signal request from l1 | |
16 | sc_in <RawAddress> in_data; | |
17 | sc_in <bool> in_activate; | |
18 | ||
19 | sc_out <RawAddress> out_data; | |
20 | sc_out <bool> out_activate; | |
21 | ||
22 | // XXX temporary signal for out information (for monitoring) | |
23 | sc_out<bool> miss_info; | |
24 | sc_out<bool> hit_info; | |
25 | ||
26 | // Queue de sortie : pour limiter le nombre de requetes simultannées | |
27 | Queue<Address> *output_queue; | |
28 | ||
29 | // CacheStore : contient les lignes actuellement stockées dans le cache | |
30 | CacheStore *cstore; | |
31 | ||
32 | // Processing queue : timeout interne pour l'envoi de données | |
33 | // qui sont chargées dans ce cache | |
34 | ProcessingQueue *processing_queue; | |
35 | ||
36 | // Latence : délai nécesaire pour temporiser l'envoi de données | |
37 | // chargées dans ce cache | |
38 | unsigned int latency; | |
39 | ||
40 | // methods for handling memory requests (systemc) | |
41 | void read(); | |
42 | void write(); | |
43 | ||
44 | L2Cache(sc_module_name name, | |
45 | int cache_size, | |
46 | int line_width, | |
47 | t_assoc associativity, | |
48 | unsigned int latency) : sc_module(name) | |
49 | { | |
50 | this->cstore = new CacheStore(cache_size, line_width, associativity); | |
51 | this->latency = latency; | |
52 | this->output_queue = new Queue<Address>(10); | |
53 | this->processing_queue = new ProcessingQueue(10); | |
54 | ||
55 | SC_METHOD(read); | |
56 | dont_initialize(); | |
57 | sensitive << clock.pos(); | |
58 | ||
59 | SC_METHOD(write); | |
60 | dont_initialize(); | |
61 | sensitive << clock.pos(); | |
62 | }; | |
63 | ||
64 | SC_HAS_PROCESS(L2Cache); | |
65 | ||
66 | ~L2Cache() | |
67 | { | |
68 | delete output_queue; | |
69 | delete processing_queue; | |
70 | delete cstore; | |
71 | } | |
72 | }; | |
73 | ||
74 | #endif |
Note: See TracBrowser
for help on using the repository browser.