-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathukd11a.h
167 lines (149 loc) · 2.35 KB
/
ukd11a.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
// PiDP-11/70
typedef struct Console Console;
struct Console
{
int status_lights;
int address_lights;
int address_select;
int data_lights;
int data_select;
int data_switches;
int cntl_switches;
int toggled_switches;
int knob1, knob1state;
int knob2, knob2state;
Lock sw_lock;
};
enum {
SW_LAMPTEST = 1,
SW_LOAD_ADDR = 2,
SW_EXAM = 4,
SW_DEP = 010,
SW_CONT = 020,
SW_HALT = 040,
SW_SINST = 0100,
SW_START = 0200
};
typedef struct Uword Uword;
struct Uword
{
byte clk; // 3b type of cycle
byte cir; // 1b clock IR
byte wr; // 2b write register
byte cb; // 1b clock B
byte cd; // 1b clock D
byte cba; // 1b clock BA
byte bus; // 3b
byte dad; // 4b
byte sps; // 3b
byte alu; // 5b ALU cntl
byte sbc; // 4b B constants
byte sbm; // 4b B MUX
byte sdm; // 2b D MUX
byte sba; // 1b BA MUX
byte ubf; // 5b branch
byte srx; // 4b register select
byte rif; // 4b R immediate
byte upf; // 8/9b next address
byte mm;
char *name;
};
typedef struct IRdecode IRdecode;
struct IRdecode
{
int flags;
uint ctable;
uint vtable;
word brconst;
byte bubc22;
byte bubc31;
byte bubc33[2];
byte bubc34[2];
byte bubc35[2];
byte bubc36;
byte bubc37;
byte comux;
byte alu1, alu2;
byte stpm;
};
// PDP-11/40
typedef struct KD11A KD11A;
struct KD11A
{
// console
Console con;
int swtch;
int consl;
int exam;
int dep;
int start;
int reset;
int pwrup_init;
// status
int berr;
int trap;
int intr;
int awby;
int brsv;
int bovflw;
int pwrdn;
int stall;
int wait;
int ovlap;
int ps_flags;
int pasta, pastc;
int ps_t;
int ps_prio;
int brq;
// data
word dr;
int dcry;
word br;
word ba;
word reg[16];
// combinational
int radr;
word rd;
word bc;
word dmux;
int coutmux;
word bmux;
word bamux;
word alu, alu_cry;
// timing
int enable_mclk;
int idle;
int clkon;
// IR
word ir;
IRdecode irdec;
// not sure how important these are
int ovlap_cycle;
int ovlap_instr;
// microcontrol
Uword u;
int bubc;
int upp, pupp;
int jberr, jpup, perr;
// Bus
Bus *bus;
int busc;
int busff;
int ckoda, ckovf;
int ovfl_cond;
// ownership
int bbsy;
int cbr, brptr, npr;
int nodat;
// remember BRs
struct {
int (*bg)(void *dev);
void *dev;
} busreq[4];
int br_highest;
int step;
struct timespec start_time, inst_time, bus_time;
};
void KD11A_initonce(void);
void KD11A_poweron(KD11A *cpu);
void KD11A_service(KD11A *cpu);