code clean-up
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-06 17:40:51 +02:00
parent e8333f3468
commit dd67a2a276
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -168,6 +168,33 @@ void init_stack_registers()
STACKFILE[0] = STACKFILE[1] = STACKFILE[2] = STACKFILE[3] = 010000; STACKFILE[0] = STACKFILE[1] = STACKFILE[2] = STACKFILE[3] = 010000;
} }
void produce_set_register(const uint16_t instr, const uint16_t psw, int *const id, json_t *const out)
{
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 = psw;
json_t *obj = generate_test(instr, id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
}
}
void dump_json(const char *const filename, json_t *const j) void dump_json(const char *const filename, json_t *const j)
{ {
FILE *fh = fopen(filename, "w"); FILE *fh = fopen(filename, "w");
@ -185,7 +212,7 @@ void emit_branch_instructions()
return; return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
for(int group=0; group<2; group++) { for(int group=0; group<2; group++) { // word/byte
for(int bt=0; bt<8; bt++) { for(int bt=0; bt<8; bt++) {
if (group == 0 && bt == 0) // SWAB if (group == 0 && bt == 0) // SWAB
continue; continue;
@ -264,9 +291,6 @@ void emit_add_sub_c()
return; return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
int count = 0;
int total = n_test_values * n_test_values * 4 * 2;
time_t start = time(NULL);
for(int group=0; group<4; group++) { for(int group=0; group<4; group++) {
uint16_t instr = 0; uint16_t instr = 0;
int word = group & 1; int word = group & 1;
@ -278,36 +302,8 @@ void emit_add_sub_c()
else if (group == 3) else if (group == 3)
instr = (056 << 6 /* instr */) | (word << 15 /* SBCb/SBCw */) | (1 << 6 /* src=R1 */); instr = (056 << 6 /* instr */) | (word << 15 /* SBCb/SBCw */) | (1 << 6 /* src=R1 */);
for(int v1=0; v1<n_test_values; v1++) { for(int psw_val=0; psw_val<2; psw_val++)
for(int v2=0; v2<n_test_values; v2++) { produce_set_register(instr, psw_val, &id, out);
for(int psw_val=0; psw_val<2; psw_val++) {
count++;
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 = psw_val;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
}
printf("%.2f%% %f \r", count * 100 / (double)total, total / (double)count * (time(NULL) - start));
fflush(NULL);
}
} }
dump_json(filename, out); dump_json(filename, out);
} }
@ -369,9 +365,6 @@ void emit_cmp()
return; return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
int count = 0;
int total = n_test_values * n_test_values * 2 * 2;
time_t start = time(NULL);
for(int group=0; group<2; group++) { for(int group=0; group<2; group++) {
uint16_t instr = 0; uint16_t instr = 0;
int word = group & 1; int word = group & 1;
@ -379,36 +372,8 @@ void emit_cmp()
if (group == 0 || group == 1) if (group == 0 || group == 1)
instr = (2 << 12 /* instr */) | (word << 15 /* CMPb/CMPw */) | (1 << 6 /* src=R1 */); instr = (2 << 12 /* instr */) | (word << 15 /* CMPb/CMPw */) | (1 << 6 /* src=R1 */);
for(int v1=0; v1<n_test_values; v1++) { for(int psw_val=0; psw_val<2; psw_val++)
for(int v2=0; v2<n_test_values; v2++) { produce_set_register(instr, psw_val, &id, out);
for(int psw_val=0; psw_val<2; psw_val++) {
count++;
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 = psw_val;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
}
printf("%.2f%% %f \r", count * 100 / (double)total, total / (double)count * (time(NULL) - start));
fflush(NULL);
}
} }
dump_json(filename, out); dump_json(filename, out);
} }
@ -421,43 +386,13 @@ void emit_add_double_oper_instr()
return; return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
int count = 0;
int total = n_test_values * n_test_values * (8 - 2);
time_t start = time(NULL);
for(int group=0; group<8; group++) { for(int group=0; group<8; group++) {
uint16_t instr = (7 << 12) | (group << 9 /* instr */) | (2 << 6 /* src=R2 */); uint16_t instr = (7 << 12) | (group << 9 /* instr */) | (2 << 6 /* src=R2 */);
if (group == 5 || group == 6) if (group == 5 || group == 6)
continue; continue;
for(int v1=0; v1<n_test_values; v1++) { produce_set_register(instr, 0, &id, out);
for(int v2=0; v2<n_test_values; v2++) {
count++;
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);
}
printf("%.2f%% %f \r", count * 100 / (double)total, total / (double)count * (time(NULL) - start));
fflush(NULL);
}
} }
dump_json(filename, out); dump_json(filename, out);
} }
@ -470,43 +405,12 @@ void emit_bit_instructions()
return; return;
int id = 0; int id = 0;
json_t *out = json_array(); json_t *out = json_array();
int count = 0;
int total = n_test_values * n_test_values * 3 * 2 * 2;
time_t start = time(NULL);
for(int word=0; word<2; word++) { for(int word=0; word<2; word++) {
for(int group=3; group<6; group++) { for(int group=3; group<6; group++) {
uint16_t instr = (word << 15) | (group << 12) | (1 << 6 /* src=R1 */); uint16_t instr = (word << 15) | (group << 12) | (1 << 6 /* src=R1 */);
for(int v1=0; v1<n_test_values; v1++) { for(int psw_val=0; psw_val<2; psw_val++)
for(int v2=0; v2<n_test_values; v2++) { produce_set_register(instr, psw_val, &id, out);
for(int psw_val=0; psw_val<2; psw_val++) {
count++;
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 = psw_val;
json_t *obj = generate_test(instr, &id, mem, 1);
if (obj)
json_array_append_new(out, obj);
}
}
printf("%.2f%% %f \r", count * 100 / (double)total, total / (double)count * (time(NULL) - start));
fflush(NULL);
}
} }
} }
dump_json(filename, out); dump_json(filename, out);
@ -559,29 +463,7 @@ void emit_misc_operations()
else if (group == 2) else if (group == 2)
instr = 0200 | 01; // RTS (R1) instr = 0200 | 01; // RTS (R1)
for(int v1=0; v1<n_test_values; v1++) { produce_set_register(instr, 0, &id, out);
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); dump_json(filename, out);