Commit graph

71 commits

Author SHA1 Message Date
Mark Pizzolato
b5a325f467 VAX: Correct ROM device help text to describe built-in ROM as default 2020-06-06 10:03:32 -07:00
Mark Pizzolato
94f5034712 VAX, MicroVAX I & II: Revamped Qbus memory access as Qbus peripheral 2019-05-12 21:52:06 -07:00
Mark Pizzolato
621e97e170 MicroVAX1, all VAX: Add model specific instruction execution and emulation
- Different VAX models had different groups of instructions which were
  implemented in hardware vs trappng to the OS for emulation.  Functionality
  has been added to differentiate the various mix of instruction groups for
  different models and to display both the groups and the actual instructions.
- Visibility to Instruction groups is provided by SHOW CPU INSTRUCTIONS
  and the list of the active instructions implemented and emulated via
  SHOW CPU -V INSTRUCTIONS.
- The MicroVAX I CPU handled some execution fault conditions differently
  from other VAX systems these differences are now specifically handled.
- Add build time test support to MicroVAX I running EHKAA v1.13
  suggested in #683
- Add more CPU debug details relating to exception and interrupt processing
2019-04-30 14:28:37 -07:00
Matt Burke
7eee73770d makefile: Add missing SDL support for VAXstation simulators.
- Minor naming corrections to VAX simulators
2019-04-23 18:21:16 -07:00
Mark Pizzolato
0ca011cd46 VAX: Parse for switches in BOOT command implementations 2018-09-27 06:35:31 -07:00
Mark Pizzolato
dc13df7b7b VAX: Set CPU model correctly on each boot
Previously the CPU model was only being set when the CPU ROM was
implicitly loaded from the internal ROM image at boot time.  Other
loading of ROM code never set the configured model correctly.
2018-08-02 11:26:43 -07:00
Mark Pizzolato
4431350bd1 VAXStations: Fix set model message text when video isn't available 2018-07-13 02:25:22 -07:00
Mark Pizzolato
a6d2e5dd4f VAX, VAX780: Properly handle maximum interval value 2018-01-12 11:28:35 -08:00
Mark Pizzolato
ee4c33ead2 VAX: Fix Interval Timers
- Properly set the Interval Register when a running timer is stopped
- Peoperly clear timer interrupt pending when CSR is updated
- Properly handle the case when the timer is started with the interval
   register is 0.
- Properly stop the running timer when it is restarted or adjusted
   with a new interval value.
- Better debug info
2018-01-07 13:46:07 -08:00
Mark Pizzolato
4a8564aa51 VAX: Add Bitfield detail to SYSD CNF and TMR CSR REGister definitions 2017-12-28 16:49:04 -08:00
Mark Pizzolato
ddb0ee2895 VAX: Add missing TCSR1 REGister declaration in SYSD device
Remove duplicate REGister declaration of TIVEC0
2017-12-22 01:49:01 -08:00
Mark Pizzolato
bdddcb4004 VAX, MicroVAX2: Add display of ROM and NVR address ranges 2017-12-18 05:10:27 -08:00
Mark Pizzolato
9f7519b886 VAX: Added detail to interval timer debug output 2017-08-01 06:49:59 -07:00
Mark Pizzolato
6e31112469 VAX, MicroVAX2: Update ROM memory access to use common code 2017-01-05 05:53:00 -08:00
Mark Pizzolato
bcac7d0973 VAX: Change interval timers to pass boot ROM diagnostics.
Various boot ROM activities, including testing the Interval Timers, presume
that ROM based code execute instructions at 1 instruction per usec.
To accommodate this, we not only throttle memory accesses to ROM space,
but we also use instruction based delays when the interval timers are
programmed from the ROM for short duration delays.
2017-01-02 13:48:23 -08:00
Mark Pizzolato
d456bac8fc All VAX: Simplify interval timers to leverage new usec timing APIs 2016-12-30 10:34:29 -08:00
Mark Pizzolato
7022f0c1b2 VAX: Fix interval timer to properly synchronize with calibrated clock ticks 2016-12-14 09:30:44 -08:00
Mark Pizzolato
a7593385aa VAX: Fixed Interval timer simplification
Reading the interval timer register while the timer is running needed
to be reflect usecs
2016-12-08 05:32:08 -08:00
Mark Pizzolato
63a16c4ed4 VAX: Simplify Interval Timer implementation
Use actual microsecond references, with the value synchronized to the CLK
device and all delays scaled to the calibrated instruction execution rate.
2016-12-06 13:36:01 -08:00
Mark Pizzolato
7498f183d2 VAX: Added debug options for SYSD device (TMR, TODR, CNF) 2016-12-05 14:57:35 -08:00
Mark Pizzolato
5531ccb175 ALL: Massive 'const' cleanup
These changes facilitate more robust parameter type checking and helps
to identify unexpected coding errors.

Most simulators can now also be compiled with a C++ compiler without
warnings.

Additionally, these changes have also been configured to facilitate easier
backporting of simulator and device simulation modules to run under the
simh v3.9+ SCP framework.
2016-05-15 15:25:33 -07:00
Mark Pizzolato
253f8a8dcf VAX: Move CPU register and routine declarations into vax_defs.h
Avoid redundant declarations in every simulator module that uses them
and allow compiler to validate consistency of declarations and definitions.
2016-02-29 16:37:18 -08:00
Mark Pizzolato
ed64606ea3 VAX: Fix inconsistencies in setting CPU model for simulators that have different models 2016-01-22 08:44:09 -08:00
Mark Pizzolato
688416a4d7 VAX, MicroVAX1, MicroVAX2: Provide consistent messages when attempting to change CPU Model.
As discussed in issue #269
2016-01-21 07:37:06 -08:00
Mark Pizzolato
41978eca80 All: Convert from C runtime library perror() to sim_perror so that all messages will arrive in the same place(s). 2015-04-03 19:56:37 -07:00
Mark Pizzolato
5e556cc70a ALL VAX: Fix vax_cpu to be model invariant and implement platform specific machine behavior in model specific machine_check routine. As per Bob Supnik. Fix #198 2015-03-30 10:27:02 -07:00
Mark Pizzolato
ef9d1adce1 PDP10, PDP11, VAX: const cleanup 2015-02-13 06:18:24 -08:00
Mark Pizzolato
e00438b051 VAX: Add VCB01(QVSS) device to MicroVAX 3900 simulator 2015-01-13 05:42:10 -08:00
Mark Pizzolato
8cbe4ba0bd VAX: Properly inline memory reference functions for performance. Fix #169 2014-12-31 13:25:49 -08:00
Mark Pizzolato
3951ad2432 Cleanup of unneeded global extern declarations 2014-10-10 08:18:15 -07:00
Mark Pizzolato
eaae19463c SCP: Initial merge of old style single line help with hierarchical help 2014-02-01 07:04:44 -08:00
Mark Pizzolato
bf58edfaab VAX: Fix for unaligned memory reference to IO and Register Space (from Bob Supnik)
Design Notes for Fixing VAX Unaligned Access to IO and Register Space

Problem Statement: VAX unaligned accesses are handled by reading the
surrounding longword (or longwords) and

a) for reads, extracting the addressed addressed word or longword
b) for writes, inserting the addressed word or longword and then
   writing the surrounding longword (or longwords) back

This is correct for all memory cases. On the 11/780, the unaligned
access to register or IO space causes an error, as it should. On
CVAX, it causes incorrect behavior, by either performing too many
QBus references, or performing read-modify-writes instead of pure
writes, or accessing the wrong Qbus locations.

The problem cannot be trivially solved with address manipulation.
The core issues is that on CVAX, unaligned access is done to
exactly as many bytes as are required, using a base longword
address and a byte mask. There are five cases, corresponding to
word and longword lengths, and byte offsets 1, 2 (longword only),
and 3. Further, behavior is different for reads and writes, because
the Qbus always performs word operations on reads, leaving it to
the processor to extract a byte if needed.

Conceptual design: Changes in vax_mmu.c:

Unaligned access is done with two separate physical addresses, pa
and pa1, because if the access crosses a page boundary, pa1 may
not be contiguous with pa. It's worth noting that in an unaligned
access, the low part of the data begins at pa (complete with byte
offset), but the high parts begins at pa1 & ~03 (always in the
low-order end of the second longword).

To handle unaligned data, we will add two routines for read and
write unaligned:

	data = ReadU (pa, len);
	WriteU (pa, len, val);

Note that the length can be 1, 2, or 3 bytes. For ReadU, data is
return right-aligned and masked. For WriteU, val is expected to
be right-aligned and masked.

The read-unaligned flows are changed as follows:

if (mapen && ((off + lnt) > VA_PAGSIZE)) {              /* cross page? */
    vpn = VA_GETVPN (va + lnt);                         /* vpn 2nd page */
    tbi = VA_GETTBI (vpn);
    xpte = (va & VA_S0)? stlb[tbi]: ptlb[tbi];          /* access tlb */
    if (((xpte.pte & acc) == 0) || (xpte.tag != vpn) ||
        ((acc & TLB_WACC) && ((xpte.pte & TLB_M) == 0)))
        xpte = fill (va + lnt, lnt, acc, NULL);         /* fill if needed */
    pa1 = ((xpte.pte & TLB_PFN) | VA_GETOFF (va + 4)) & ~03;
    }
else pa1 = ((pa + 4) & PAMASK) & ~03;                   /* not cross page */
bo = pa & 3;
if (lnt >= L_LONG) {                                    /* lw unaligned? */
    sc = bo << 3;
    wl = ReadU (pa, L_LONG - bo);                       /* read both fragments */
    wh = ReadU (pa1, bo);                               /* extract */
    return ((wl | (wh << (32 - sc))) & LMASK);
    }
else if (bo == 1)                                       /* read within lw */
    return ReadU (pa, L_WORD);
else {
    wl = ReadU (pa, L_BYTE);                            /* word cross lw */
    wh = ReadU (pa1, L_BYTE);                           /* read, extract */
    return (wl | (wh << 8));
    }

These are not very different, but they do reflect that ReadU returns
right-aligned and properly masked data, rather than the encapsulating
longword.

The write-unaligned flows change rather more drastically:

if (mapen && ((off + lnt) > VA_PAGSIZE)) {
    vpn = VA_GETVPN (va + 4);
    tbi = VA_GETTBI (vpn);
    xpte = (va & VA_S0)? stlb[tbi]: ptlb[tbi];          /* access tlb */
    if (((xpte.pte & acc) == 0) || (xpte.tag != vpn) ||
        ((xpte.pte & TLB_M) == 0))
        xpte = fill (va + lnt, lnt, acc, NULL);
    pa1 = ((xpte.pte & TLB_PFN) | VA_GETOFF (va + 4)) & ~03;
    }
else pa1 = ((pa + 4) & PAMASK) & ~03;
bo = pa & 3;
if (lnt >= L_LONG) {
    sc = bo << 3;
    WriteU (pa, L_LONG - bo, val & insert[L_LONG - bo]);
    WriteU (pa, bo, (val >> (32 - sc)) & insert[bo]);
    }
else if (bo == 1)                                       /* read within lw */
    WriteU (pa, L_WORD, val & WMASK);
else {                                                  /* word cross lw */
    WriteU (pa, L_BYTE, val & BMASK);
    WriteU (pa, L_BYTE, (val >> 8) & BMASK);
    }
return;
}

Note that all the burden here has been thrown on the WriteU routine.

-------------

ReadU is the simpler of the two routines that needs to be written.
It will handle memory reads and defer register and IO space to
model-specific unaligned handlers.

int32 ReadU (uint32 pa, int32 lnt)
{
int32 dat;
int32 sc = (pa & 3) << 3;

if (ADDR_IS_MEM (pa))
    dat = M[pa >> 2];
else {
    mchk = REF_V;
    if (ADDR_IS_IO (pa))
       dat = ReadIOU (pa, lnt);
    else dat = ReadRegU (pa, lnt);
    }
return ((dat >> sc) & insert[lnt]);
}

Note that the ReadIOU and ReadRegU return a "full longword," just
like their aligned counterparts, and ReadU right-aligns the result,
just as ReadB, ReadW, and ReadL do.

WriteU must handle the memory read-modify-write sequence. However,
it defers register and IO space to model-specific unaligned handlers.

void WriteU (uint32 pa, int32 lnt, int32 val)
{
if (ADDR_IS_MEM (pa)) {
    int32 bo = pa & 3;
    int32 sc = bo << 3;
    M[pa >> 2] = (M[pa >> 2] & ~(insert[len] << sc) | (val << sc);
    }
else if ADDR_IS_IO (pa)
    WriteIOU (pa, lnt, val);
else WriteRegU (pa, lnt, val);
return;
}

--------------

For the 11/780, ReadIOU, ReadRegU, WriteIOU, and WriteRegU all do the
same thing: they throw an SBI machine check. We can write explicit
routines to do this (and remove the unaligned checks from all the
normal adapter flows), or leave things as they are and simply define
the four routines as macros that go to the normal routines. So there's
very little to do.

On CVAX, I suspect that ReadRegU and WriteRegU behave like the
normal routines. The CVAX specs don't say much, but CMCTL (the memory
controller) notes that it ignores the byte mask and treats every
access as an aligned longword access. I suspect this is true for
the other CVAX support chips, but I no longer have chip specs.

The Qbus, on the other hand... that's a fun one. Note that all of
these cases are presented to the existing aligned IO routine:

bo = 0, byte, word, or longword length
bo = 2, word
bo = 1, 2, 3, byte length

All the other cases are going to end up at ReadIOU and WriteIOU,
and they must turn the request into the exactly correct number of
Qbus accesses AND NO MORE, because Qbus reads can have side-effects,
and word read-modify-write is NOT the same as a byte write.

The read cases are:

bo = 0, byte or word - read one word
bo = 1, byte - read one word
bo = 2, byte or word - read one word
bo = 3, byte - read one word
bo = 0, triword - read two words
bo = 1, word or triword - read two words

ReadIOU is very similar to the existing ReadIO:

int32 ReadIOU (uint32 pa, int32 lnt)
{
int32 iod;

iod = ReadQb (pa);                                      /* wd from Qbus */
if ((lnt + (pa & 1)) <= 2)                              /* byte or word & even */
    iod = iod << ((pa & 2)? 16: 0);                     /* one op */
else iod = (ReadQb (pa + 2) << 16) | iod;               /* two ops, get 2nd wd */
SET_IRQL;
return iod;
}

The write cases are:

bo = x, lnt = byte - write one byte
bo = 0 or 2, lnt = word - write one word
bo = 1, lnt = word - write two bytes
bo = 0, lnt = triword - write word, byte
bo = 1, lnt = triword - write byte, word

WriteIOU is similar to the existing WriteIO:

void WriteIO (uint32 pa, int32 val, int32 lnt)
{
switch (lnt) {
case L_BYTE:                                            /* byte */
    WriteQb (pa, val & BMASK, WRITEB);
    break;
case L_WORD:                                            /* word */
    if (pa & 1) {                                       /* odd addr? */
        WriteQb (pa, val & BMASK, WRITEB);
        WriteQb (pa + 1, (val >> 8) & BMASK, WRITEB);
        }
    else WriteQb (pa, val, WRITE);
    break;
case 3:                                                 /* triword */
    if (pa & 1) {                                       /* odd addr? */
        WriteQb (pa, val & BMASK, WRITEB);
        WriteQb (pa + 1, (val >> 8) & WMASK, WRITE);
        }
    else {
        WriteQb (pa, val & WMASK, WRITE);
        WriteQb (pa + 2, (val >> 16) & BMASK, WRITEB);
        }
    break;
    }
SET_IRQL;
return;
}

-----------------

I think this handles all the cases.

/Bob Supnik

Conflicts:
	VAX/vax780_defs.h
	VAX/vax_mmu.c
	VAX/vaxmod_defs.h
2013-12-22 04:10:01 -08:00
Mark Pizzolato
6cf54e8341 Fixes for stable operation with SIM_ASYNCH_CLOCKS defined 2013-05-07 11:22:29 -07:00
Mark Pizzolato
96dbeae08f Added SHOW CPU MEMORY support for all VAX simulators to display the memory controller and board configuration 2013-04-08 12:18:09 -07:00
Mark Pizzolato
51badc2d8e The MicroVAX specific CPU Boot help has been moved to the MicroVAX specific modules 2013-03-19 01:52:31 -07:00
Mark Pizzolato
28f645aeab Compiler suggested cleanups 2013-03-13 22:28:14 -07:00
Mark Pizzolato
864b581e35 Adding more device help 2013-02-05 13:59:59 -08:00
Mark Pizzolato
28b90552b7 Revised all VAX simulator devices to have proper help information defined to make "HELP dev SHOW" and "HELP dev SET" most useful. 2013-02-02 16:29:38 -08:00
Mark Pizzolato
8df4b94e7f Added a SET CPU MODEL=(MicroVAX|VAXServer) to the VAX 3900 simulator 2013-01-29 08:37:58 -08:00
Mark Pizzolato
c729942de6 Added SET CPU AUTOBOOT to the MicroVAX II and VAX 3900 simulators 2013-01-26 17:07:27 -08:00
Mark Pizzolato
6dcf5ba7d9 Renamed the VAX860 simulator to VAX8600, and used the VAX system model names for all simulators 2013-01-26 13:24:28 -08:00
Mark Pizzolato
7a9db0fe64 Clean up output formatting for SHOW DEVICE, SHOW CONFIG and changed SHOW SYSTEM to SHOW FEATURES 2013-01-26 10:20:31 -08:00
Mark Pizzolato
cbe11147fc Created a way for devices to have a description presentation routine and if it is supplied for its output to be visible with a SHOW SYSTEM command. Provided device description routines for devices used in the VAX simulators 2013-01-25 12:04:25 -08:00
Mark Pizzolato
a60d9070db Adding register descriptions to VAX processor devices 2013-01-16 17:26:30 -08:00
Mark Pizzolato
923d5411f5 Added HELP CPU to all VAX simulators 2013-01-15 10:18:49 -08:00
Mark Pizzolato
8720c8c87b Made the VAX model visible with a SHOW CPU MODEL command for all simulators and made the model persist across a SAVE/RESTORE for the VAX simulators with a settable model 2013-01-14 06:53:48 -08:00
Mark Pizzolato
dac73b9381 Migrating scp and library global variables to be declared as extern in the appropriate library include file and remove repetitive declarations in referencing modules. 2013-01-10 13:29:15 -08:00
Mark Pizzolato
50cf91d441 Merge branch 'SerialMux' and compiler suggested cleanup 2012-12-18 09:52:14 -08:00
Mark Pizzolato
a3b0dc38fd Change the semantics of sim_is_active to return a t_bool (which was 98% of how it was used), and added new sim_activate_time to return the time a unit will be activated (the value previously returned). This affected a handful of used of sim_is_active in device implementations which were adjusted to use the sim_activate_time API. 2012-12-12 11:01:00 -08:00
Mark Pizzolato
b01fa8fbb0 Addition of MicroVAX II (VAX630) and rtVAX 1000 (or Industrial VAX 620) processor simulators from Matt Burke
Generalized the Boot Code loading support to use common code which has been added to vax_cpu.c
2012-11-09 12:18:15 -08:00