1 |
2 |
alfik |
/*
|
2 |
|
|
* Copyright (c) 2014, Aleksander Osman
|
3 |
|
|
* All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Redistribution and use in source and binary forms, with or without
|
6 |
|
|
* modification, are permitted provided that the following conditions are met:
|
7 |
|
|
*
|
8 |
|
|
* * Redistributions of source code must retain the above copyright notice, this
|
9 |
|
|
* list of conditions and the following disclaimer.
|
10 |
|
|
*
|
11 |
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
12 |
|
|
* this list of conditions and the following disclaimer in the documentation
|
13 |
|
|
* and/or other materials provided with the distribution.
|
14 |
|
|
*
|
15 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16 |
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18 |
|
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
19 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21 |
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22 |
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
23 |
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
24 |
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
25 |
|
|
*/
|
26 |
|
|
|
27 |
|
|
package ao486.module.memory;
|
28 |
|
|
|
29 |
|
|
public class GlobalListener implements Listener {
|
30 |
|
|
|
31 |
|
|
public GlobalListener() {
|
32 |
|
|
Input input = new Input();
|
33 |
|
|
set(
|
34 |
|
|
input.cr0_pg, input.cr0_wp, input.cr0_am, input.cr0_cd, input.cr0_nw,
|
35 |
|
|
input.acflag,
|
36 |
|
|
input.cr3_base, input.cr3_pcd, input.cr3_pwt,
|
37 |
|
|
input.pipeline_after_read_empty, input.pipeline_after_prefetch_empty
|
38 |
|
|
);
|
39 |
|
|
|
40 |
|
|
set_reset(input.pr_reset, input.rd_reset, input.exe_reset, input.wr_reset);
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
public void set_reset(boolean pr_reset, boolean rd_reset, boolean exe_reset, boolean wr_reset) {
|
44 |
|
|
this.pr_reset = pr_reset;
|
45 |
|
|
this.rd_reset = rd_reset;
|
46 |
|
|
this.exe_reset = exe_reset;
|
47 |
|
|
this.wr_reset = wr_reset;
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
public void set(
|
51 |
|
|
boolean cr0_pg, boolean cr0_wp, boolean cr0_am, boolean cr0_cd, boolean cr0_nw,
|
52 |
|
|
boolean acflag,
|
53 |
|
|
long cr3_base, boolean cr3_pcd, boolean cr3_pwt,
|
54 |
|
|
boolean pipeline_after_read_empty, boolean pipeline_after_prefetch_empty
|
55 |
|
|
)
|
56 |
|
|
{
|
57 |
|
|
this.cr0_pg = cr0_pg;
|
58 |
|
|
this.cr0_wp = cr0_wp;
|
59 |
|
|
this.cr0_am = cr0_am;
|
60 |
|
|
this.cr0_cd = cr0_cd;
|
61 |
|
|
this.cr0_nw = cr0_nw;
|
62 |
|
|
|
63 |
|
|
this.acflag = acflag;
|
64 |
|
|
|
65 |
|
|
this.cr3_base = cr3_base;
|
66 |
|
|
this.cr3_pcd = cr3_pcd;
|
67 |
|
|
this.cr3_pwt = cr3_pwt;
|
68 |
|
|
|
69 |
|
|
this.pipeline_after_read_empty = pipeline_after_read_empty;
|
70 |
|
|
this.pipeline_after_prefetch_empty = pipeline_after_prefetch_empty;
|
71 |
|
|
}
|
72 |
|
|
|
73 |
|
|
@Override
|
74 |
|
|
public void set_input(int cycle, Input input) throws Exception {
|
75 |
|
|
input.cr0_pg = cr0_pg;
|
76 |
|
|
input.cr0_wp = cr0_wp;
|
77 |
|
|
input.cr0_am = cr0_am;
|
78 |
|
|
input.cr0_cd = cr0_cd;
|
79 |
|
|
input.cr0_nw = cr0_nw;
|
80 |
|
|
|
81 |
|
|
input.acflag = acflag;
|
82 |
|
|
|
83 |
|
|
input.cr3_base = cr3_base;
|
84 |
|
|
input.cr3_pcd = cr3_pcd;
|
85 |
|
|
input.cr3_pwt = cr3_pwt;
|
86 |
|
|
|
87 |
|
|
input.pipeline_after_read_empty = pipeline_after_read_empty;
|
88 |
|
|
input.pipeline_after_prefetch_empty = pipeline_after_prefetch_empty;
|
89 |
|
|
|
90 |
|
|
//reset
|
91 |
|
|
|
92 |
|
|
input.pr_reset = pr_reset;
|
93 |
|
|
input.rd_reset = rd_reset;
|
94 |
|
|
input.exe_reset = exe_reset;
|
95 |
|
|
input.wr_reset = wr_reset;
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
@Override
|
99 |
|
|
public void get_output(int cycle, Output output) throws Exception {
|
100 |
|
|
}
|
101 |
|
|
|
102 |
|
|
boolean cr0_pg;
|
103 |
|
|
public boolean cr0_wp;
|
104 |
|
|
boolean cr0_am;
|
105 |
|
|
boolean cr0_cd;
|
106 |
|
|
public boolean cr0_nw;
|
107 |
|
|
|
108 |
|
|
boolean acflag;
|
109 |
|
|
|
110 |
|
|
long cr3_base;
|
111 |
|
|
boolean cr3_pcd;
|
112 |
|
|
boolean cr3_pwt;
|
113 |
|
|
|
114 |
|
|
boolean pipeline_after_read_empty;
|
115 |
|
|
boolean pipeline_after_prefetch_empty;
|
116 |
|
|
|
117 |
|
|
//reset
|
118 |
|
|
boolean pr_reset;
|
119 |
|
|
boolean rd_reset;
|
120 |
|
|
boolean exe_reset;
|
121 |
|
|
boolean wr_reset;
|
122 |
|
|
}
|