sim: minor updates

This commit is contained in:
Mikael Pettersson 2018-12-22 17:24:29 +01:00
parent 5104bf8847
commit 9fbacc2a32
2 changed files with 27 additions and 6 deletions

View File

@ -90,13 +90,23 @@ static inline unsigned int BIT36(pdp10_uint36_t X, unsigned int BIT)
return BITS36(X, BIT, BIT);
}
typedef uint32_t pdp10_vaddr_t; /* 30 bits: section number, section offset */
typedef uint32_t pdp10_pc_t; /* 31 bits: global flag, vaddr */
typedef uint32_t pdp10_vaddr_t; /* 30 bits: 12-bit section number, 18-bit section offset */
struct pdp10_cpu {
pdp10_pc_t PC;
pdp10_uint36_t AC[017];
unsigned int flags; /* 13 bits */
pdp10_vaddr_t PC;
pdp10_uint36_t AC[017]; /* copy of ACS[CAB] */
pdp10_uint36_t ACS[8][017];
unsigned int flags:13;
unsigned int CAB:3; /* Current AC Block */
/*
* Previous Context
*/
unsigned int PCS:12; /* Previous Context Section */
unsigned int PCU:1; /* Previous Context User */
unsigned int PAB:3; /* Previous AC Block */
/*
* Memory
*/
struct pdp10_vmem vmem;
};

View File

@ -24,8 +24,19 @@
/* This performs Effective Address Calculation, but not Instruction Fetch
* or looping on XCT instructions; the caller is assumed to handle that.
* Returns (uint64_t)-1 on failure (page fault), a pdp10_uint36_t word on success.
* Returns (uint64_t)-1 on failure (page fault), otherwise a pdp10_vaddr_t
* (30 bits) and a 1-bit local(0)/global(1) flag in the MSB (2^30).
*/
uint64_t pdp10_ea(struct pdp10_cpu *cpu, uint64_t MB);
static inline int pdp10_ea_is_page_fault(uint64_t ea)
{
return ea == (uint64_t)-1;
}
static inline int pdp10_ea_is_global(uint64_t ea)
{
return ea & (1UL << 30);
}
#endif /* PDP10_EA_H */