test generation fix & misc
Some checks are pending
Build / cmake-builds (push) Waiting to run
Build / makefile (macos-latest, besm6 imlac tt2500 microvax3900 microvax1 rtvax1000 vaxstation3100m76 vaxstation4000m60) (push) Waiting to run
Build / makefile (macos-latest, id16 id32 sds lgp h316 cdc1700 swtp6800mp-a swtp6800mp-a2 tx-0 ssem b5500 sage pdq3 alpha) (push) Waiting to run
Build / makefile (macos-latest, microvax2 vax730 vax750 vax780 vax8200 vax8600 microvax2000 infoserver100 infoserver150vxt microvax3100 microvax3100e vaxstation3100m30 vaxstation3100m38) (push) Waiting to run
Build / makefile (macos-latest, microvax3100m80 vaxstation4000vlc infoserver1000 nova eclipse hp2100 hp3000 i1401 i1620 s3 altair altairz80 gri i7094) (push) Waiting to run
Build / makefile (macos-latest, pdp1 pdp4 pdp6 pdp7 pdp8 pdp9 pdp10 pdp10-ka pdp10-ki pdp10-kl pdp10-ks pdp11 pdp15 vax) (push) Waiting to run
Build / makefile (macos-latest, scelbi 3b2 i701 i704 i7010 i7070 i7080 i7090 sigma uc15 i650 sel32 intel-mds ibm1130) (push) Waiting to run
Build / makefile (ubuntu-latest, besm6 imlac tt2500 microvax3900 microvax1 rtvax1000 vaxstation3100m76 vaxstation4000m60) (push) Waiting to run
Build / makefile (ubuntu-latest, id16 id32 sds lgp h316 cdc1700 swtp6800mp-a swtp6800mp-a2 tx-0 ssem b5500 sage pdq3 alpha) (push) Waiting to run
Build / makefile (ubuntu-latest, microvax2 vax730 vax750 vax780 vax8200 vax8600 microvax2000 infoserver100 infoserver150vxt microvax3100 microvax3100e vaxstation3100m30 vaxstation3100m38) (push) Waiting to run
Build / makefile (ubuntu-latest, microvax3100m80 vaxstation4000vlc infoserver1000 nova eclipse hp2100 hp3000 i1401 i1620 s3 altair altairz80 gri i7094) (push) Waiting to run
Build / makefile (ubuntu-latest, pdp1 pdp4 pdp6 pdp7 pdp8 pdp9 pdp10 pdp10-ka pdp10-ki pdp10-kl pdp10-ks pdp11 pdp15 vax) (push) Waiting to run
Build / makefile (ubuntu-latest, scelbi 3b2 i701 i704 i7010 i7070 i7080 i7090 sigma uc15 i650 sel32 intel-mds ibm1130) (push) Waiting to run

This commit is contained in:
Folkert van Heusden 2025-04-05 01:32:58 +02:00
parent 204e6e435c
commit e61cbf4c6a
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -288,8 +288,8 @@ void emit_add_sub_c()
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = v1;
REGFILE[1][0] = REGFILE[1][1] = v2;
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
REGFILE[1][0] = REGFILE[1][1] = test_values[v2];
init_stack_registers();
@ -342,7 +342,7 @@ void emit_single_operand_instructions()
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = v1;
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
init_stack_registers();
@ -389,8 +389,8 @@ void emit_cmp()
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = v1;
REGFILE[1][0] = REGFILE[1][1] = v2;
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
REGFILE[1][0] = REGFILE[1][1] = test_values[v2];
init_stack_registers();
@ -439,8 +439,8 @@ void emit_add_double_oper_instr()
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = v1;
REGFILE[2][0] = REGFILE[2][1] = v2;
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
REGFILE[1][0] = REGFILE[1][1] = test_values[v2];
init_stack_registers();
@ -487,8 +487,8 @@ void emit_bit_instructions()
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = v1;
REGFILE[1][0] = REGFILE[1][1] = v2;
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
REGFILE[1][0] = REGFILE[1][1] = test_values[v2];
init_stack_registers();
@ -512,6 +512,78 @@ void emit_bit_instructions()
dump_json(filename, out);
}
void emit_misc_operations()
{
printf("misc instructions\n");
const char *const filename = "pdp1170-valtest-MISC.json";
if (file_exist(filename))
return;
int id = 0;
json_t *out = json_array();
int groups[] = { 2, 3, 6 };
for(int group=0; group<3; group++) {
uint16_t instr = groups[group];
init_simh();
saved_PC = 0100;
randomize_registers_all_values();
init_stack_registers();
struct mem_t mem[1] = {
{ 0100, instr }
};
PSW = 0;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
for(int group=0; group<3; group++) {
uint16_t instr = 0;
if (instr == 0)
instr = 0100 | 010; // JMP (R0)
else if (instr == 1)
instr = 04000 | 0110; // JSR R1,(R0)
else if (instr == 2)
instr = 0200 | 01; // RET (R1)
for(int v1=0; v1<n_test_values; v1++) {
for(int v2=0; v2<n_test_values; v2++) {
init_simh();
saved_PC = 0100;
randomize_registers_all_values();
REGFILE[0][0] = REGFILE[0][1] = test_values[v1];
REGFILE[1][0] = REGFILE[1][1] = test_values[v2];
init_stack_registers();
struct mem_t mem[1] = {
{ 0100, instr }
};
PSW = 0;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
}
}
dump_json(filename, out);
}
void produce_validation_tests()
{
srand(123); // for reproducability
@ -525,6 +597,7 @@ void produce_validation_tests()
emit_single_operand_instructions(); // single_operand_instructions
emit_bit_instructions(); // double_operand_instructions
emit_cmp(); // double_operand_instructions
emit_misc_operations();
// TODO:
// - double_operand_instructions: MOV