do not (re-)generate if file exists
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-04 09:08:48 +02:00
parent ae0c503054
commit 9635fdda03
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1

View file

@ -1,6 +1,7 @@
#include <jansson.h>
#include <stdio.h>
#include <time.h>
#include <sys/stat.h>
#include "pdp11_defs.h"
#include "sim_defs.h"
@ -35,6 +36,12 @@ int is_prime(int n) {
return 1;
}
int file_exist(const char *const filename)
{
struct stat st;
return stat(filename, &st) == 0;
}
uint16_t test_values[65536];
int n_test_values = 0;
@ -52,8 +59,6 @@ void generate_test_values()
test_values[n_test_values++] = 255;
test_values[n_test_values++] = 32767;
test_values[n_test_values++] = 65535;
printf("%d\n", n_test_values);
}
json_t *generate_test(uint16_t instruction, int *const id, struct mem_t *mem, size_t n_mem)
@ -177,9 +182,12 @@ void dump_json(const char *const filename, json_t *const j)
void emit_branch_instructions()
{
printf("Branch instructions\n");
const char *const filename = "pdp1170-valtest-COND-BRANCHES.json";
if (file_exist(filename))
return;
int id = 0;
json_t *out = json_array();
printf("Branch instructions\n");
for(int group=0; group<2; group++) {
for(int bt=0; bt<8; bt++) {
if (group == 0 && bt == 0) // SWAB
@ -214,14 +222,17 @@ void emit_branch_instructions()
}
}
}
dump_json("pdp1170-valtest-COND-BRANCHES.json", out);
dump_json(filename, out);
}
void emit_condition_sets()
{
printf("Condition set instructions\n");
const char *const filename = "pdp1170-valtest-CONDITIONS.json";
if (file_exist(filename))
return;
int id = 0;
json_t *out = json_array();
printf("Condition set instructions\n");
for(int condition=0; condition<16; condition++) {
uint16_t instr = 0240 + condition;
@ -245,17 +256,20 @@ void emit_condition_sets()
json_array_append_new(out, obj);
}
}
dump_json("pdp1170-valtest-CONDITIONS.json", out);
dump_json(filename, out);
}
void emit_add_sub_c()
{
printf("ADD/SUB/ADC/SBC instructions\n");
const char *const filename = "pdp1170-valtest-ADD_SUB_ADC_SBC.json";
if (file_exist(filename))
return;
int id = 0;
json_t *out = json_array();
int count = 0;
int total = n_test_values * n_test_values * 4 * 2;
time_t start = time(NULL);
printf("ADD/SUB/ADC/SBC instructions\n");
for(int group=0; group<4; group++) {
uint16_t instr = 0;
int word = group & 1;
@ -298,7 +312,7 @@ void emit_add_sub_c()
fflush(NULL);
}
}
dump_json("pdp1170-valtest-ADD_SUB_ADC_SBC.json", out);
dump_json(filename, out);
}
void produce_validation_tests()