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