Skip to content

Commit c95f123

Browse files
committed
[cpu] ROUNDTUITAL now includes a URL for relevant feature request.
The FR URL may include some additional information about what needs to be implemented, or pointers to documentation, etc. The key idea here is that having a specific bug report provides a place for users to explain what program they were running that depends on the missing feature.
1 parent a472716 commit c95f123

File tree

7 files changed

+214
-31
lines changed

7 files changed

+214
-31
lines changed

cpu/src/alarm.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ pub enum AlarmDetails {
184184

185185
// The following alarms didn't exist in the real TX-2:
186186
/// Something is not implemented
187-
ROUNDTUITAL(String),
187+
ROUNDTUITAL {
188+
explanation: String,
189+
bug_report_url: &'static str,
190+
},
188191

189192
/// Loop in deferred addressing (detection of this is not a feature
190193
/// of the TX-2).
@@ -225,7 +228,7 @@ impl AlarmDetails {
225228
message: _,
226229
} => AlarmKind::IOSAL,
227230
AlarmDetails::MISAL { affected_unit: _ } => AlarmKind::MISAL,
228-
AlarmDetails::ROUNDTUITAL(_) => AlarmKind::ROUNDTUITAL,
231+
AlarmDetails::ROUNDTUITAL { .. } => AlarmKind::ROUNDTUITAL,
229232
AlarmDetails::DEFERLOOPAL { address: _ } => AlarmKind::DEFERLOOPAL,
230233
AlarmDetails::BUGAL {
231234
instr: _,
@@ -269,10 +272,13 @@ impl Display for AlarmDetails {
269272
msg
270273
)
271274
}
272-
ROUNDTUITAL(msg) => {
275+
ROUNDTUITAL {
276+
explanation,
277+
bug_report_url,
278+
} => {
273279
write!(
274280
f,
275-
"ROUNDTUITAL: the program used a feature not supported in the emulator: {msg}",
281+
"ROUNDTUITAL: the program used a feature not supported in the emulator: {explanation}. See feature request at {bug_report_url}",
276282
)
277283
}
278284

cpu/src/alarmunit.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,14 @@ fn unmaskable_alarms_are_not_maskable() {
201201
assert!(matches!(
202202
alarm_unit.fire_if_not_masked(Alarm {
203203
sequence: Some(Unsigned6Bit::ZERO),
204-
details: AlarmDetails::ROUNDTUITAL("I am not maskable!".to_string()),
204+
details: AlarmDetails::ROUNDTUITAL {
205+
explanation: "The ROUNDTUITAL alarm is not maskable!".to_string(),
206+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/144",
207+
},
205208
}),
206209
Err(Alarm {
207210
sequence: Some(_),
208-
details: AlarmDetails::ROUNDTUITAL(_),
211+
details: AlarmDetails::ROUNDTUITAL { .. },
209212
})
210213
));
211214
// Verify that the alarm manager considers that an unmasked (in

cpu/src/control.rs

Lines changed: 175 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,164 @@ impl ControlUnit {
11641164
Opcode::Ios => control.op_ios(ctx, mem, devices),
11651165
Opcode::Tsd => control.op_tsd(ctx, devices, prev_program_counter, mem),
11661166
Opcode::Sed => control.op_sed(ctx, mem),
1167-
_ => Err(Alarm {
1167+
Opcode::Exx => Err(Alarm {
11681168
sequence: control.regs.k,
1169-
details: AlarmDetails::ROUNDTUITAL(format!(
1170-
"The emulator does not yet implement opcode {opcode}",
1171-
)),
1169+
details: AlarmDetails::ROUNDTUITAL {
1170+
explanation: "The emulator does not yet implement opcode EXX".to_string(),
1171+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/16",
1172+
},
1173+
}),
1174+
Opcode::Adx => Err(Alarm {
1175+
sequence: control.regs.k,
1176+
details: AlarmDetails::ROUNDTUITAL {
1177+
explanation: "The emulator does not yet implement opcode ADX".to_string(),
1178+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/18",
1179+
},
1180+
}),
1181+
Opcode::Spf => Err(Alarm {
1182+
sequence: control.regs.k,
1183+
details: AlarmDetails::ROUNDTUITAL {
1184+
explanation: "The emulator does not yet implement opcode SPF".to_string(),
1185+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/13",
1186+
},
1187+
}),
1188+
Opcode::Flf | Opcode::Flg => Err(Alarm {
1189+
sequence: control.regs.k,
1190+
details: AlarmDetails::ROUNDTUITAL {
1191+
explanation: "The emulator does not yet implement opcode {opcode}"
1192+
.to_string(),
1193+
// Note: that bug report covers two opcodes.
1194+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/14",
1195+
},
1196+
}),
1197+
Opcode::Ite | Opcode::Ita | Opcode::Una | Opcode::Dsa => Err(Alarm {
1198+
sequence: control.regs.k,
1199+
details: AlarmDetails::ROUNDTUITAL {
1200+
explanation: "The emulator does not yet implement opcode {opcode}"
1201+
.to_string(),
1202+
// Note: this bug report covers several opcodes.
1203+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/25",
1204+
},
1205+
}),
1206+
Opcode::Jov => Err(Alarm {
1207+
sequence: control.regs.k,
1208+
details: AlarmDetails::ROUNDTUITAL {
1209+
explanation: "The emulator does not yet implement opcode JOV".to_string(),
1210+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/11",
1211+
},
1212+
}),
1213+
Opcode::Jpa => Err(Alarm {
1214+
sequence: control.regs.k,
1215+
details: AlarmDetails::ROUNDTUITAL {
1216+
explanation: "The emulator does not yet implement opcode JPA".to_string(),
1217+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/9",
1218+
},
1219+
}),
1220+
Opcode::Jna => Err(Alarm {
1221+
sequence: control.regs.k,
1222+
details: AlarmDetails::ROUNDTUITAL {
1223+
explanation: "The emulator does not yet implement opcode JNA".to_string(),
1224+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/10",
1225+
},
1226+
}),
1227+
Opcode::Exa => Err(Alarm {
1228+
sequence: control.regs.k,
1229+
details: AlarmDetails::ROUNDTUITAL {
1230+
explanation: "The emulator does not yet implement opcode EXA".to_string(),
1231+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/143",
1232+
},
1233+
}),
1234+
Opcode::Ins => Err(Alarm {
1235+
sequence: control.regs.k,
1236+
details: AlarmDetails::ROUNDTUITAL {
1237+
explanation: "The emulator does not yet implement opcode INS".to_string(),
1238+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/26",
1239+
},
1240+
}),
1241+
Opcode::Com => Err(Alarm {
1242+
sequence: control.regs.k,
1243+
details: AlarmDetails::ROUNDTUITAL {
1244+
explanation: "The emulator does not yet implement opcode COM".to_string(),
1245+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/27",
1246+
},
1247+
}),
1248+
Opcode::Cya | Opcode::Cyb | Opcode::Cab => Err(Alarm {
1249+
sequence: control.regs.k,
1250+
details: AlarmDetails::ROUNDTUITAL {
1251+
explanation: "The emulator does not yet implement opcode {opcode}"
1252+
.to_string(),
1253+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/24",
1254+
},
1255+
}),
1256+
Opcode::Noa => Err(Alarm {
1257+
sequence: control.regs.k,
1258+
details: AlarmDetails::ROUNDTUITAL {
1259+
explanation: "The emulator does not yet implement opcode NOA".to_string(),
1260+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/22",
1261+
},
1262+
}),
1263+
Opcode::Nab => Err(Alarm {
1264+
sequence: control.regs.k,
1265+
details: AlarmDetails::ROUNDTUITAL {
1266+
explanation: "The emulator does not yet implement opcode NAB".to_string(),
1267+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/23",
1268+
},
1269+
}),
1270+
Opcode::Add => Err(Alarm {
1271+
sequence: control.regs.k,
1272+
details: AlarmDetails::ROUNDTUITAL {
1273+
explanation: "The emulator does not yet implement opcode ADD".to_string(),
1274+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/28",
1275+
},
1276+
}),
1277+
Opcode::Sca => Err(Alarm {
1278+
sequence: control.regs.k,
1279+
details: AlarmDetails::ROUNDTUITAL {
1280+
explanation: "The emulator does not yet implement opcode SCA".to_string(),
1281+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/19",
1282+
},
1283+
}),
1284+
Opcode::Scb => Err(Alarm {
1285+
sequence: control.regs.k,
1286+
details: AlarmDetails::ROUNDTUITAL {
1287+
explanation: "The emulator does not yet implement opcode SCB".to_string(),
1288+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/20",
1289+
},
1290+
}),
1291+
Opcode::Sab => Err(Alarm {
1292+
sequence: control.regs.k,
1293+
details: AlarmDetails::ROUNDTUITAL {
1294+
explanation: "The emulator does not yet implement opcode SAB".to_string(),
1295+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/21",
1296+
},
1297+
}),
1298+
Opcode::Tly => Err(Alarm {
1299+
sequence: control.regs.k,
1300+
details: AlarmDetails::ROUNDTUITAL {
1301+
explanation: "The emulator does not yet implement opcode TLY".to_string(),
1302+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/32",
1303+
},
1304+
}),
1305+
Opcode::Div => Err(Alarm {
1306+
sequence: control.regs.k,
1307+
details: AlarmDetails::ROUNDTUITAL {
1308+
explanation: "The emulator does not yet implement opcode DIV".to_string(),
1309+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/31",
1310+
},
1311+
}),
1312+
Opcode::Mul => Err(Alarm {
1313+
sequence: control.regs.k,
1314+
details: AlarmDetails::ROUNDTUITAL {
1315+
explanation: "The emulator does not yet implement opcode MUL".to_string(),
1316+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/30",
1317+
},
1318+
}),
1319+
Opcode::Sub => Err(Alarm {
1320+
sequence: control.regs.k,
1321+
details: AlarmDetails::ROUNDTUITAL {
1322+
explanation: "The emulator does not yet implement opcode SUB".to_string(),
1323+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/29",
1324+
},
11721325
}),
11731326
}
11741327
}
@@ -1344,9 +1497,15 @@ impl ControlUnit {
13441497
// we don't know what the TX-2 did in this case.
13451498
Err(self.alarm_unit.always_fire(Alarm {
13461499
sequence: self.regs.k,
1347-
details: AlarmDetails::ROUNDTUITAL(format!(
1500+
details: AlarmDetails::ROUNDTUITAL {
1501+
explanation: format!(
13481502
"memory unit indicated address {operand_address:o} is not mapped and we don't know what to do when QSAL is masked",
1349-
))
1503+
),
1504+
// Note: there are two different ways in which
1505+
// we can raise a ROUNDTUITAL alarm referring
1506+
// to this bug report URL.
1507+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/142",
1508+
}
13501509
}))
13511510
}
13521511
Err(MemoryOpFailure::ReadOnly(_, _)) => unreachable!(),
@@ -1508,10 +1667,16 @@ impl ControlUnit {
15081667
// QSAL is masked. I don't know what the TX-2 did in this situation.
15091668
return Err(self.alarm_unit.always_fire(Alarm {
15101669
sequence: self.regs.k,
1511-
details: AlarmDetails::ROUNDTUITAL(format!(
1512-
"we don't know how to handle {} when QSAL is masked",
1513-
msg()
1514-
)),
1670+
details: AlarmDetails::ROUNDTUITAL {
1671+
explanation: format!(
1672+
"we don't know how to handle {} when QSAL is masked",
1673+
msg()
1674+
),
1675+
// Note: there are two different ways in
1676+
// which we can raise a ROUNDTUITAL alarm
1677+
// referring to this bug report URL.
1678+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/142",
1679+
},
15151680
}));
15161681
}
15171682
Ok((word, extra)) => {

cpu/src/control/op_index.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,13 @@ impl ControlUnit {
176176
}
177177
_ => Err(self.alarm_unit.always_fire(Alarm {
178178
sequence: self.regs.k,
179-
details: AlarmDetails::ROUNDTUITAL(format!(
180-
"SKX configuration {:#o} is not implemented yet",
181-
inst.configuration()
182-
)),
179+
details: AlarmDetails::ROUNDTUITAL {
180+
explanation: format!(
181+
"SKX configuration value {:#o} is not implemented yet",
182+
inst.configuration()
183+
),
184+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/138",
185+
},
183186
})),
184187
}
185188
}

cpu/src/control/op_io.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,12 @@ impl ControlUnit {
113113
// Select unit XXX
114114
Err(self.alarm_unit.always_fire(Alarm {
115115
sequence: self.regs.k,
116-
details: AlarmDetails::ROUNDTUITAL(format!(
117-
"IOS operand {operand:o}: Select Unit command is not yet implemented.",
118-
)),
116+
details: AlarmDetails::ROUNDTUITAL {
117+
explanation: format!(
118+
"IOS operand {operand:o}: Select Unit command is not yet implemented.",
119+
),
120+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/139",
121+
},
119122
}))
120123
}
121124
_ => {
@@ -338,10 +341,12 @@ impl ControlUnit {
338341
.alarm_unit
339342
.always_fire(Alarm {
340343
sequence: self.regs.k,
341-
details: AlarmDetails::ROUNDTUITAL(
342-
"TSD output in assembly mode is not yet implemented."
343-
.to_string(),
344-
),
344+
details: AlarmDetails::ROUNDTUITAL{
345+
explanation:
346+
"TSD output in assembly mode is not yet implemented."
347+
.to_string(),
348+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/140",
349+
},
345350
})),
346351
}
347352
}

cpu/src/control/op_jump.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ impl ControlUnit {
6767
// need to implement it. It's not yet implemented.
6868
return Err(self.alarm_unit.always_fire(Alarm {
6969
sequence: self.regs.k,
70-
details: AlarmDetails::ROUNDTUITAL(
71-
"deferred JMP is not yet implemented".to_string(),
72-
),
70+
details: AlarmDetails::ROUNDTUITAL {
71+
explanation: "deferred JMP is not yet implemented".to_string(),
72+
bug_report_url: "https://github.com/TX-2/TX-2-simulator/issues/141",
73+
},
7374
}));
7475
}
7576

cpu/src/control/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn test_roundtuital_not_maskable() {
7474
Err((
7575
Alarm {
7676
sequence: _,
77-
details: AlarmDetails::ROUNDTUITAL(_),
77+
details: AlarmDetails::ROUNDTUITAL { .. },
7878
},
7979
_,
8080
)) => (),

0 commit comments

Comments
 (0)