Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: Block.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | #ifndef __Block_h | |
24 | #define __Block_h | |
25 | ||
26 | #include <stdlib.h> | |
27 | #include <string> | |
28 | #include <sstream> | |
29 | ||
30 | #include "List.h" | |
31 | #include "Map.h" | |
32 | //#include "Register.h" | |
33 | //#include "RegisterArray.h" | |
34 | using namespace std; | |
35 | ||
36 | class Register; | |
37 | class RegisterArray; | |
38 | ||
39 | class Block { | |
40 | ||
41 | List<Register> registers; | |
42 | List<RegisterArray> registerArrays; | |
43 | ||
44 | Addr minAddr; | |
45 | Addr maxAddr; | |
46 | bool final; | |
47 | ||
48 | string fullName; | |
49 | ||
50 | Map<Register> *map; | |
51 | ||
52 | public: | |
53 | Block(string n); | |
54 | ~Block(); | |
55 | void addRegister (Register *r); | |
56 | void addRegisterArray (RegisterArray *r); | |
57 | void regCheck (Register *r); | |
58 | void regArrayCheck (RegisterArray *r); | |
59 | Register* regLookup (Addr a); | |
60 | Register* regLookup (string n); | |
61 | bool regRead (Addr a, Data *d); | |
62 | bool regRead (string n, Data *d); | |
63 | bool regWrite (Addr a, Data d); | |
64 | bool regWrite (string n, Data d); | |
65 | void enableWriteBlockCB (); | |
66 | void disableWriteBlockCB (); | |
67 | void enableReadBlockCB (); | |
68 | void disableReadBlockCB (); | |
69 | void printThis (ostream &os); | |
70 | string getFullName() { return fullName; } | |
71 | void resetThis (); | |
72 | void finalize (); | |
73 | virtual Data regReadBlockCB(Register *r, Data origValue, Data readValue) | |
74 | { | |
75 | return readValue; | |
76 | } | |
77 | virtual void regWriteBlockCB(Register *r, Data origValue, Data writeValue) {} | |
78 | ||
79 | }; | |
80 | ||
81 | #endif |