keep track of memory writes
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 19:40:07 +02:00
parent e409fad0c5
commit 7ea9e4442b
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
3 changed files with 41 additions and 3 deletions

View file

@ -94,6 +94,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") message(STATUS "CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
endif (NOT CMAKE_BUILD_TYPE) endif (NOT CMAKE_BUILD_TYPE)
endif () endif ()
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
# SIMH_SYSTEM_ID: Roughly analogous to the autoconf system triple. Used (almost exclusively) # SIMH_SYSTEM_ID: Roughly analogous to the autoconf system triple. Used (almost exclusively)
# as part of the dependencies' top-level directory name. # as part of the dependencies' top-level directory name.

View file

@ -279,6 +279,17 @@ typedef struct {
/* Global state */ /* Global state */
struct __mem_writes {
int32_t addr;
uint16_t data;
} *mem_writes;
int n_mem_writes = 0;
void init_mem_writes()
{
mem_writes = (struct __mem_writes *)malloc(sizeof(struct __mem_writes) * 256);
}
uint16 *M = NULL; /* memory */ uint16 *M = NULL; /* memory */
int32 REGFILE[6][2] = { {0} }; /* R0-R5, two sets */ int32 REGFILE[6][2] = { {0} }; /* R0-R5, two sets */
int32 STACKFILE[4] = { 0 }; /* SP, four modes */ int32 STACKFILE[4] = { 0 }; /* SP, four modes */
@ -2780,6 +2791,7 @@ if ((va & 1) && CPUT (HAS_ODD)) { /* odd address? */
ABORT (TRAP_ODD); ABORT (TRAP_ODD);
} }
pa = relocW (va); /* relocate */ pa = relocW (va); /* relocate */
if (BPT_SUMM_WR && if (BPT_SUMM_WR &&
(sim_brk_test (va & 0177777, BPT_WRVIR) || (sim_brk_test (va & 0177777, BPT_WRVIR) ||
sim_brk_test (pa, BPT_WRPHY))) /* write breakpoint? */ sim_brk_test (pa, BPT_WRPHY))) /* write breakpoint? */
@ -2818,9 +2830,21 @@ if (BPT_SUMM_WR &&
PWriteW (data, pa); PWriteW (data, pa);
} }
void reset_mem_writes()
{
n_mem_writes = 0;
}
void PWriteW (int32 data, int32 pa) void PWriteW (int32 data, int32 pa)
{ {
if (ADDR_IS_MEM (pa)) { /* memory address? */ if (ADDR_IS_MEM (pa)) { /* memory address? */
if (data > 0xffff)
printf("FAIL %x\n", data);
mem_writes[n_mem_writes].addr = pa;
mem_writes[n_mem_writes].data = data;
n_mem_writes++;
WrMemW (pa, data); WrMemW (pa, data);
return; return;
} }

View file

@ -21,6 +21,15 @@ extern DEVICE cpu_dev;
extern int32 STACKFILE[4]; extern int32 STACKFILE[4];
extern int32 sim_interval; extern int32 sim_interval;
struct __mem_writes {
int32_t addr;
uint16_t data;
};
extern struct __mem_writes *mem_writes;
extern int n_mem_writes;
extern void reset_mem_writes();
extern void init_mem_writes();
struct mem_t { struct mem_t {
uint32_t addr; uint32_t addr;
uint16_t value; uint16_t value;
@ -123,12 +132,12 @@ json_t *generate_test(uint16_t instruction, int *const id, struct mem_t *mem, si
json_t *memory_o = json_array(); json_t *memory_o = json_array();
for(size_t i=0; i<n_mem; i++) { for(int i=0; i<n_mem_writes; i++) {
char buffer[16]; char buffer[16];
sprintf(buffer, "%06o", mem[i].addr); sprintf(buffer, "%06o", mem_writes[i].addr);
json_t *get_mem = json_object(); json_t *get_mem = json_object();
json_object_set(get_mem, buffer, json_integer(PReadW(mem[i].addr))); json_object_set(get_mem, buffer, json_integer(mem_writes[i].data));
json_array_append_new(memory_o, get_mem); json_array_append_new(memory_o, get_mem);
} }
@ -153,6 +162,8 @@ void init_simh()
// reset_all(0); is this required? // reset_all(0); is this required?
cpu_reset(&cpu_dev); cpu_reset(&cpu_dev);
sim_interval = 32767; sim_interval = 32767;
reset_mem_writes();
} }
void randomize_registers_all_values() void randomize_registers_all_values()
@ -545,6 +556,8 @@ void produce_validation_tests()
{ {
srand(123); // for reproducability srand(123); // for reproducability
init_mem_writes();
generate_test_values(); generate_test_values();
emit_branch_instructions(); // conditional_branch_instructions* emit_branch_instructions(); // conditional_branch_instructions*