Commit graph

37 commits

Author SHA1 Message Date
Lars Brinkhoff
c6b9402f8c VAX: Add UW device to 8600 and 8200.
The VAXstation 100 "unibus window" interface board should work with
any Unibus VAX.
2024-06-08 14:45:06 -04: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
Bob Supnik
3f9a77bd10 VAX, VAX780: Added hook for unpredictable indexed immediate
Originally, the VAX allowed immediate operands (8F) to be used without
restrictions in address mode instructions, either standalone or indexed.
Starting with MicroVAX II, immediate indexed became reserved. This
remained true for all subsequent chip implementations. The SRM was
ECOed in March, 1985 to make immediate indexed unpredictable.

In MicroVAX II, immediate g-floating operands didn't work correctly. The
problem was found a couple of months after tape-out. While the index
flows could be fixed, and were fixed according to the microcode revision
history:

;    7-May-84    [RMS]    Fixed FD problem in index flows (JLR)

the problem in indexed immediate could only be fixed by a significant
hardware change in an area that was already packed full. The VAX
Architecture Team, which had always been very sympathetic to the
VAX chip efforts, proposed a much simpler solution: make immediate
indexed unpredictable. It was useless, in any case.

I'm rather surprised that this wasn't flagged by the 780 diagnostics.
Maybe it was never tested. It was tested in HCORE (the original MicroVAX I
core diagnostic that is failing), but I removed it subsequently:

; 8-may-85    rms    removed indexed immediate tests

Bottom line - the simulator is right for the chip VAXes (including, I think,
V11) and wrong for MicroVAX I and probably the 8600, 780, 750, and 730.

# Conflicts:
#	VAX/vax_cpu.c
2019-04-23 22:58:02 -07:00
Lars Brinkhoff
da256fcc28 PDP10, PDP11, Unibus VAXen: CH11 Chaosnet interface. 2018-11-22 07:50:57 +01:00
Mark Pizzolato
be52190067 All VAX: extend REI debugging support
Identify reserved operand fault reason details.
2018-09-27 06:41:40 -07:00
Mark Pizzolato
7677dad67d PDP11: Properly range check DMA access to the I/O page
Make sure that DMA access to the I/O page can only see addresses on the
Qbus/Unibus and not internal CPU registers
2018-09-06 11:03:45 -07:00
Mark Pizzolato
cc7721b96e PDP11: Allow DZ devices Unibus and Qbus to have correct number of lines 2018-04-09 18:05:53 -07:00
Bob Supnik
a7216dbbd1 All VAX: Added model-specific AST validation test
From page 6-6 of DEC STD 032 (the VAX architecture spec):
"Execution of MTPR src, #PR$_ASTLVL with src<31:0> GEQU 5 results in
UNDEFINED behavior. The preferred implementation is to cause a reserved
operand fault." MicroVAX II, CVAX, and Rigel all conform to the preferred
behavior, as does the current simulator, which was written from the CVAX
microcode. NVAX masks to 3b and does not take an exception on a value
GEQU 5.

The 1982 Architecture Handbook describes ASTLVL as a 3b register, with
src<31:3> ignored/read as zero, and exceptions taken on values GEQU 5.
The780 microcode masks the input value to 3b before doing the GEQU 5 test.

The ASTLVL test needs to be model specific.

I suspect the behavior became undefined when MicroVAX II simplified the
original test to save a microword. I do not see how the code fragment Matt
references could work on a MicroVAX II, which was supported under 4.5.
Perhaps the device Matt mentions couldn't exist on a MicroVAX II?

For those who wants the gory details... uVAX, CVAX, and Rigel do an
unsigned compare on the unmasked src and the constant 5. Carry out
means reserved operand. Overflow is ignored. So an input of 0x80000002 -
0x00000005 (done in the data path as 0x80000002 + 0xFFFFFFFB) generates overflow (ignored) and carry out.

# Conflicts:
#	VAX/vaxmod_defs.h
2017-05-18 12:45:21 -07:00
Mark Pizzolato
7d432406b6 PDP11, PDP10, all VAX: General extern cleanup.
Remove explicit redundant extern declarations in source files that are
defined in processor include files.
2017-02-04 19:37:20 -08:00
Mark Pizzolato
ae25c72a8e PDP11, VAX730, VAX750, VAX780, VAX8600: Moved CR11/CD11 from BR4 to BR6 2017-01-07 04:56:52 -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
1af590d806 PDP11, VAX8600, VAX780, VAX750: Fix to auto configure Massbus adapters
When a mix of Massbus devices are configured with some enabled and
others disabled, the MBA's need to be allocated and properly configured
in the desired preferred order (RP, TU, RS).  On the PDP11, this interacts
with auto-configure since the RH devices are visible in the Unibus I/O
page.  On the PDP11 the second Massbus device can only be configured
if the TM device is disabled since the auto-configure assigned vectors
overlap for RHB and TM.

Problem originally reported in #301.
2016-05-07 15:17:24 -07:00
Mark Pizzolato
2b155ba29d VAX780, VAX750, VAX730, VAX8600: Add TC11/TU56 (DECtape) device to Unibus VAX simulators
VMS Driver and support files for the TC11 should be available at
http://bitsavers.org/bits/DEC/vax/vms/dkdriver_vms.zip
2016-03-27 12:28:02 -07:00
Mark Pizzolato
bfe87ed1c5 VAX780, VAX750, VAX730, VAX8600: Add TC11/TU56 (DECtape) device to Unibus VAX simulators 2016-03-25 04:01:44 -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
3e3c05523c PDP11, VAX: Fix AutoConfigure to allow multiple dynamically configured devices to allocate from the same pool of fixed addresses.
Dynamically configured devices simulate multiple controllers with a single DEVICE structure and can have the number of controllers being simulated set by the user.  DLI, DZ, DUP, DMC, TDC, VH, DC are all dynamically configured devices.
DLI and TDC are dynamically configured devices which get static bus addresses.
2016-01-06 08:08:19 -08:00
Mark Pizzolato
ed57f061e2 All VAX: Always return the correct Qbus/Unibus interrupt vector bits for all devices. Fix #239
Vector values contained in device information blocks are the true bus relative vector values.  CPU specific biased vector values are produced by the respective vector fetching logic and vector values are limited to 9 bits with <1:0> = 0 as specified in both the Unibus and Qbus documents.
2015-10-08 04:43:21 -07:00
Mark Pizzolato
9f59823ae3 PDP11, all VAX: Add TU58 device simulator with support for 32 drives plus the VAX 730 and 750 console devices 2015-09-22 15:06:12 -07:00
Mark Pizzolato
4baecec0b1 VAX750: Added VAX. 11.750 Boot ROM booting options
VAX 11/.750 Boot ROM code makes non-longword memory references to MassBus and Unibus register space.  Minor changes were necessary to allow this behavior which was architecturally undefined behavior, but had real code which depended on it.

Added a BOOTDEV option to the CPU to reflect the 4 position boot device selection switch on real VAX 11/750 hardware.

The UBA750 initial state started with the UBA map registers validly mapping the first 256KB of RAM to Unibus space.

Added simulated PCS/WCS memory which boot code on some operating systems (Ultrix and other BSD derived systems) automatically loaded on the VAX 11/750.  PCS/WCS was also automatically loaded by the newer versions of the BOOT ROMs.
2015-09-10 21:42:16 -07:00
Mark Pizzolato
230e588b5d ALL: Merge with Supnik-Current 2015-05-10 06:05:11 -07:00
Mark Pizzolato
8cbe4ba0bd VAX: Properly inline memory reference functions for performance. Fix #169 2014-12-31 13:25:49 -08:00
Mark Pizzolato
3e01bef859 VAX: Fix the PxBR and SBR validation tests to correctly reflect the 780 microcode patch 38 from Bob Supnik
This fix allows older Unix operating systems to once again run with the VAX 780 simulator.
2014-09-05 13:59:12 -07: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
Timothe Litt
91c7d26095 SHOW IOSPACE, again
Show IOSPACE doesn't always get the number of devices right due to device creativity.

o The distinction between UNIT and DEVICE has blurred
o MUX devices merge several physical devices into one device/unit
o Dynamic device sizing has made things more volatile.

This edit solves the problem for SHOW IOSPACE by adding an (optional) word to the DIBs.
The word contains the amount of IO space consumed by each instance of the physical device that's being emulated.
E.G., if it's a DZ11, the device is the DZ11 module, or 8 lines, even though the MUX device may support 32.

This enables SHOW IOSPACE to determine the number of physical devices being emulated, which is what folks need when configuring software.  The word may have other uses - in a generic dynamic device sizing routine - which is why the amount of IOSPACE per device was chosen rather than the 'number of physical devices.'

The edit should not make any existing device regress.  If the new word (ulnt) is zero (not initialized), SHOW IOSPACE will default to the number of units in the device, or if there's no device (CPUs), 1 as before.  If it is present, the number of devices is the calculated as total allocation/allocation-per-device.

The edit updates all the devices that seem to require this treatment, and all the processors that define the UNIBUS/QBUS DIBs.
2013-07-11 15:39:15 -04:00
Mark Pizzolato
89bd58a6fa Addition of DUP11 simulation to all Unibus simulators (PDP11, PDP10, and all Unibus VAXen) 2013-05-27 16:24:18 -07:00
Mark Pizzolato
a005822186 Extended the VAX 8600 memory to 512MB and reworked the memory board slot allocation logic to fill as many slots as possible. 2013-04-05 12:16:01 -07:00
Mark Pizzolato
8116b7571d Fix VAX 8600 memory controller attribute descriptions to properly reflect the board size and slots.
Fixed value of 8600/8650 SID register ECO and PLANT fields.
Added SHOW CPU MEMORY command to display memory board configuration
2013-03-24 08:44:10 -07:00
Mark Pizzolato
388b2be156 Added missing SET CPU MODEL to VAX 8600 simulator 2013-03-19 07:39:24 -07:00
Mark Pizzolato
9b3694b102 Fixed extended VAX 8600 memory of 260MB. 2013-03-18 13:25:49 -07:00
Mark Pizzolato
55e45c99a7 Correct VAX 8600 Maximum memory size since 64MB boards were available (Johnny Billquist)
The actual machine can have a max to 260MB of memory.
There are three different memory boards that exists for the 86x0, from a software point of view.
4MB, 16MB, and 64MB. In addition, you can mix different boards.
The rule is to put large boards first, and smaller boards later.
Even more fun is the fact that the 16MB and 64MB boards are stacked and thus take up two backplane slots in the backplane, while the 4MB board only takes up one slot.
To complete the picture, there are 8 slots in the memory backplane. You start by putting boards in slot 1, going to slot 8. The boards taking up two slots actually use slot n, while covering slot n-1. That means that the board in slot 1 does not cover up any other slot.
If you are using 16MB boards, the max memory is 68MB.
Slot 1,3,5 and 7 will have 16MB boards. And then you can place a 4MB board in slot 8.
Same story with the 64MB boards.
2013-03-18 05:36:24 -07:00
Mark Pizzolato
d5ca542102 Changed use of compile #defines which start with a _ character to not do this since defined symbols starting with _ are reserved to local compiler/runtime implementations in the C language. This addresses issue #32 2013-03-12 11:07:58 -07: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
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
b2ed63f31a Removed IOBA_FLOAT and replaced with IOBA_AUTO 2012-12-28 12:15:08 -08:00
Mark Pizzolato
10e32ab1e3 VAX 8600 adjustments for complete auto configure 2012-12-27 12:23:31 -08:00
Mark Pizzolato
ac53fd10a6 VAX 8600 Simulator from Matt Burke 2012-12-26 11:50:10 -08:00