TRAP test

This commit is contained in:
Folkert van Heusden 2025-04-06 19:03:53 +02:00
parent 640643cb65
commit 7d68b74113
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -467,9 +467,7 @@ void emit_misc_operations()
printf("misc instructions\n"); printf("misc instructions\n");
const char *const filename = "pdp1170-valtest-MISC.json"; const char *const filename = "pdp1170-valtest-MISC.json";
if (file_exist(filename)) if (file_exist(filename) == 0) {
return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
@ -515,6 +513,34 @@ void emit_misc_operations()
dump_json(filename, out); dump_json(filename, out);
} }
// TRAP
const char *const filename2 = "pdp1170-valtest-MISC2.json";
if (file_exist(filename2) == 0) {
int id = 0;
json_t *out = json_array();
uint16_t instr = 0104420; // TRAP #020
init_simh();
saved_PC = 0100;
randomize_registers_all_values();
init_stack_registers();
struct mem_t mem[1] = {
{ 0100, instr }
};
PSW = 012;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
dump_json(filename2, out);
}
}
void produce_validation_tests() void produce_validation_tests()
{ {
srand(123); // for reproducability srand(123); // for reproducability