Processors of the DEC PDP-11

Since the early 70's in the world began a 10-year era of domination of the company DEC. DEC computers were significantly cheaper than those produced by IBM and therefore attracted attention from small organizations for which IBM systems were unaffordable. With these computers also begins the era of mass professional programming. The PDP-11 computer series was very successful. Various PDP-11 models were produced from the early 70's to the early 90's. They were successfully cloned in the SU and became the first mass popular computer systems there. Some of the SU made PDP-11 compatible computers have several unique traits. For example, several models like DVK are rather personal computers than minicomputers and several models like UKNC and BK are pure personal computers. The mentioned BK became the first PC available for the SU ordinary people to buy since 1985. By the way, it is very likely that the number of the PDP-11 computers produced in the USSR was larger than the total number of computers of this architecture produced in the rest of the world.

DEC also promoted the more expensive and complex computers of the VAX-11 family, the situation around which was somewhat politicized. From the second half of the 70's, DEC practically stopped development in the PDP-11 series. In particular the support of hexadecimal numbers for the assembler was not introduced. Oracle DBMS was originally created for the PDP-11 in 1979, but the next version was not released for these computers in 1983 – they preferred MS-DOS systems. The performance of PDP-11 systems has also remained virtually unchanged since the mid-70's. All this is very surprising, since DEC achieved major success precisely with the relatively inexpensive PDP-11 computers, and the abandonment of their development in favor of the expensive, almost mainframe VAX turned out to be a voluntary rejection of further successes. Although most likely the refusal did not happen voluntarily, but under pressure from IBM, which in such an elegant way broke its dangerous competitor, forcing it to "compete" in the field of IBM. Perhaps big politics was also involved here, since in 1974 the PDP-11 architecture began to be cloned in the USSR and a little later there was a strange shift in DEC's priorities. There was a de-facto abandonment of the PDP-11 development, in particular the very interesting 11/74 multiprocessor model. DEC's weirdness ended exactly by the early 90s, when the USSR collapsed.

This is the LCM's PDP-11/70 (Miss Piggy), it still works and is freely available through the network

The PDP-11 used various processors compatible with the main command system for example, the LSI-11, F-11, J-11. In the late 70's DEC made a cheap processor T-11 for microcomputers. However despite the seemingly large and high-quality software that could eventually be transferred to the system using it, the T-11 was not noticed by the manufacturers of any computer systems. The only exception was one model of the Atari gaming console. The T-11 found itself a mass application only in the world of embedded equipment, although in terms of capabilities it was slightly higher than the z80. The SU mass-produced processors K1801VM1, K1801VM2, K1801VM3, etc. similar to DEC processors and also exact copies of some DEC processors. The T11 and J11 clones began to be produced only by the beginning of the 90s. The J11 cloning was considered a particularly great success at that time, but in fact it was a step on the road to nowhere, just waste of resources. The K1801VM1 was functionally close to the T-11. Interestingly, it was hastily converted from the original K1801VE1 processor, which was used in the first Soviet personal computer Electronica NC-8010 in 1981, by coercive command, rather because of the overall political situation. It is especially difficult to understand such a command against the background of the COCOM restrictions in force at that time. The K1801VM2 processor, which was used in the DVK and UKNC, should theoretically be about two times faster than the K1801VM1 but in practice it was only slightly faster. The K1801VM3, in turn, is somewhat faster than the K1801VM2, supports memory management and largely corresponds, besides its significantly lower clock speed and correspondingly lower performance, to the best PDP-11 processors, its performance is close to the Intel 8086.

The PDP-11 processor command system is almost completely orthogonal, a pleasant quality, but when it is brought to the extreme it can create ridiculous commands. The command system of the PDP-11 processors has had an impact on many architectures and in particular on the Motorola 68000. It is possible that the use of several stacks in 68k is a direct consequence of the fact that many PDP-11 models also use several stacks. Assembler mnemonics for the PDP-11 became the basis of assemblers for some other popular processors: the 680x, 6502, ARM.

The PDP-11 system of commands is strictly 16 bit. All 8 general purpose registers (and the program counter in this architecture is the usual R7 register) are 16 bit, the processor status word (it contains typical flags) is 16 bit too, the size of instructions is from 1 to 3 16-bit words. Any operand of an instruction can be (although there are exceptions, for example, the XOR instruction) any type – this is orthogonality. Among the types of operands are registers and memory locations. Programmers in the 80s sometimes didn't understand why the Intel's x86 instruction system misses memory to memory types of instructions. This was the influence of the PDP-11/VAX school, where you can easily write the full addresses of each operand. This indeed is slow and especially slow for systems with typical slow RAM which was used since the early 90's. It is possible to form a memory address using a register, a register with an offset, a register with autoincrement or autodecrement. The PDP-11 instruction system gives us a possibility to use double indirect access to memory through a register, for example, MOV @(R0)+,@-(R1) means the same as the operator **–r1 = **r1++; in the C/C++ programming languages, where r0 and r1 are declared as signed short **r0, **r1;.

Another example, the instruction MOVB @11(R2),@-20(R3) corresponds to **(r3-20) = **(r2+11);, where r2 and r3 are declared as char **r2, **r3;.

In the modern popular architectures, one instruction for such cases can be insufficient, it may require at least 10 instructions. It is also possible to get an address relative to the current value of the program counter. I will give another example with more simple addressing. The x86 instruction ADD [BX+11],16 corresponds to ADD #16,11(R4). In DEC assemblers it is common to write operands from left to right, unlike Intel where they write from the right-left. There is a reason to believe that the GNU assembler for x86 was made under the influence of the PDP-11 assembler. Although the PDP-11 assembler has a strange exception for the CMP instruction where operands are placed as on x86.

Division and multiplication instructions are only signed and not available on all processors. The division instruction, as on the 68k, but unlike the x86, correctly sets the flags which allows you to work normally with overflow cases. However, not all PDP-11 models that support division work correctly with flags during such overflow. The arithmetic of the decimal numbers is optional too – it is a part of so-called commercial instruction set in DEC terminology. Interestingly, these instructions were added from the VAX architecture, but it turned out that they were faster on the PDP-11 than on the VAX, and they were eventually dropped from further support because of that!

As an oddity of full orthogonality I will give an example of the command MOV #11,#22, which after execution turns into MOV #11,#11 – it is an example of using a direct constant as an operand. Another curious instruction is a unique instruction MARK which code needs to be placed on the stack and which may never be used explicitly. Calling subroutines in the architecture of the PDP-11 is also somewhat peculiar. The corresponding instruction first saves the allocated register (can be any) on the stack, then saves the program counter in this register and only then writes a new value to the program counter. The return from the subroutine instruction must do the reverse and know which register was used when calling the subroutine. As an example of an unusual command, you can also point to multiplication, in which depending on the number of the register used for the result, you can get either the full 32-bit product, or only its lower 16 bits. The presence in the command system of absolutely useless instructions CLV, SEV, CLZ, SEZ, CLN, SEN demonstrates some ill-conceivedness in the details of this system. Working with flags has some other drawbacks. For example, the SWAB command, which swaps bytes in a word, for some reason resets the carry flag. The TST, CLR, and COM instructions also change this flag unnecessarily. Also, the work with the carry in the ADC and SBC commands is somewhat awkwardly implemented, for example, to make addition of two words with the carry on the PDP-11, two commands are needed, while on the x86 or 68k one is enough. Although on the IBM/370 such an operation requires even three commands. It may come as some surprise that some typical instructions are executed differently on different processors, for example, MOV R0,(R0)+ или MOV SP,-(SP) – such instructions are considered by the standard DEC assembler as erroneous. Some instructions that use the instruction counter (PC) as a normal register are also executed differently. Generally speaking, there are quite a few differences between the various PDP-11 models, so it's not exactly easy to write code that can be executed on different systems. And while the lack of general support for the exotic MARK instruction doesn't make a difference, the lack of support for the popular SOB (an interesting word!) and XOR instructions can be annoying. However, the PDP-11 processors allow, through exception programming, to simulate the execution of almost any instruction, which, while slowing code execution, alleviates the problem. On the x86, it became possible to emulate missing instructions in a similar way only with the 80386.

An unusual architectural characteristic of some PDP-11 models is that registers, such as the processor status word or R1, are accessible via addresses like normal memory! This feature, however, creates vulnerabilities when working with memory protection. Another unusual feature is that some PDP-11 models have supervisor mode, which unlike many other architectures, is not privileged, but is just an optional user mode. The privileged mode is called kernel mode.

Instructions that use PC as a normal register can be quite puzzling when encountering them. Try to understand what INC PC, CALL (PC), MOV -(PC),-(PC) mean, for example – such commands are sometimes really used, the former can be useful for creating a fast double loop!

There are two main options for dealing with real numbers. The first is the FIS (Floating Instruction Set) extension which allows you to work at a basic level with short real numbers. As a rule, FIS was used at the software emulation level. The second is the FP11 floating point instruction set extension which gives much more capabilities. These extensions use different instructions. It wasn't until the late 1980s that the K1801VM4 chip was created in the USSR which implemented the second extension.

It is interesting that among the programmers for the PDP-11 there is a culture of working directly with machine codes. Programmers could for example work without a disassembler when debugging. Or even write small programs directly into memory, without assembling!

Instruction timings were not too fast. Even for the J-11, a memory access takes up to 8 clock cycles. In comparison, for the Z80, 8088 or 68000 it is only 4 clock cycles. It was surprising to find out that on a BK home computer the instruction to send from a register to a register takes as much as 12 clocks (10 clocks when using the code in ROM), and the instructions with two operands with double indirect addressing are executed for more than 100 clocks. The Z80 does 16-bit register transfer for 8 clocks. However the slowness of the BK is caused not so much by the processor, but by the slow way of working with memory. If a fast enough way was used the BK would send 16 register bits for 8 clock cycles too. Once there was a lot of controversy, which is faster than the BK or Sinclair ZX Spectrum? I must say that the Spectrum is one of the fastest mass 8-bit personal computers when using the top 32 KB of memory. Therefore it is not surprising than the Spectrum is faster than the BK but not much. The BK could even be a little faster if it would work faster with memory.

At first glance, the code density is also rather a weak point of the PDP-11 architecture. Instruction codes must be multiples of the machine word length – 2 bytes, which is especially frustrating when working with byte arguments or simple commands like setting or resetting a flag. But when compared with other architectures, the PDP-11 sometimes shows even better code density in practice!

There were interesting attempts to make a personal computer on the basis of PDP-11 architecture. One of the first PC's in the world that appeared only a bit later that the Apple ][ and Commodore PET and rather a bit earlier than the Tandy TRS-80, was the Terak 8510/a, which had black and white graphics and an ability to load an incomplete variant of Unix. This computer was quite expensive and as far as I know was only used in the system of higher education in the USA. The Heathkit H11 was produced since 1978, it was a kit-format computer. DEC itself also tried to make its own PC, but very inconsistently. DEC for example produced PC's based on the z80 and 8088 explicitly playing against its own main developments. Interestingly, some PDP-11 models used two sets of registers like the Z80.

In 1978 DEC launched the PDT-11 series of intelligent terminals, the best of which, the PDT-11/150, could be used as a PC. The real personal computers based on the PDP-11 architecture were the DEC PRO-325/350 (1982) and 380 (1985). In fact, they were workstations. However DEC for some reason only limitedly provided its well-known system software for them. This, together with DEC's general reluctance to develop the PDP-11 architecture, caused these theoretically perfectly competitive IBM PC units to rapidly disappear from the IT space. Interestingly, for these machines DEC offered a board with the Z80 processor to run CP/M. DEC did not offer IBM PC compatibility boards. By doing so, DEC was effectively putting the Pro systems on a par with 8-bit machines! And while by performance the Pro-325/350 was somewhat slower than the first IBM PC, the Pro-380 overtook the top Turbo PC XT. In terms of software class, DEC Pro significantly surpassed IBM PC XT.

Best of all personalization of technologies of mini-computers turned out in the USSR, where produced the BK, DVK, UKNC, ... By the way the Electronica-85 was a quite accurate clone of the DEC PRO-350 based on the F-11 clone. In addition, the CP1600 processor, akin to the PDP-11 architecture, was used in the Intellivision game consoles which were popular in the early 80's.

Made in USSR 16-bit home computer (model of 1987) – it is almost PDP-11 compatible

Processors of the top PDP-11 computers can address up to 4 MB of memory, but for one program can usually get no more than 64 KB. However, using the special capabilities of hardware and system software, it was possible to create large codes. The best DEC processors, for example, the J-11 can use a separate address space for instructions and data, which doubles the size of the address space and does not slow down execution. The original processors which were made in the USSR could not do such separations. Also here it is worth noting that even the first x86 processors were able to do this directly "out of the box" and were even more advanced, allocating up to 256 KB with similar separation, and if you count the port space, then a total of 320 KB could be allocated. The size of executable code in the PDP-11 can also be increased through memory-based overlays. Working with the PDP-11 overlays requires thorough support from the OS and compilers, and is slower than far calls in the first x86. You can use virtual arrays to work with big data on the PDP-11, which again requires good support from the OS and compilers, and is also slower than working with large arrays in the first x86.

In terms of performance, the best processors for the PDP-11 are close to the 8086 in terms of the number of operations per megahertz. However, due to the higher frequencies used, the best PDP-11 was faster than the first IBM PC, but the first IBM PC AT became almost equal to it. The DEC Pro-325/350 personal computers were approximately the same in performance as the first IBM PCs at 4 MHz, and the Pro-380 was somewhat slower than the first IBM PC AT. By the way, the first DEC microprocessors, the LSI-11 and F-11, were even slower than the first Soviet chips K1801VM1 and K1801VM2. Therefore, we can assume that DEC microprocessors were designed only to make production cheaper. Interestingly, the LSI-11 and F-11 consist of several chips, while the J-11, T-11 and all Soviet ones consist of one.

Edited by Richard BN


mirror