HOME

TheInfoList



OR:

The PDP-11 architecture is a CISC
instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described by that ISA, such as a central processing unit (CPU), is called an ' ...
(ISA) developed by
Digital Equipment Corporation Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president unt ...
(DEC). It is implemented by
central processing unit A central processing unit (CPU), also called a central processor, main processor or just processor, is the electronic circuitry that executes instructions comprising a computer program. The CPU performs basic arithmetic, logic, controlling, an ...
s (CPUs) and
microprocessor A microprocessor is a computer processor where the data processing logic and control is included on a single integrated circuit, or a small number of integrated circuits. The microprocessor contains the arithmetic, logic, and control circu ...
s used in
PDP-11 The PDP-11 is a series of 16-bit minicomputers sold by Digital Equipment Corporation (DEC) from 1970 into the 1990s, one of a set of products in the Programmed Data Processor (PDP) series. In total, around 600,000 PDP-11s of all models were sold, ...
minicomputers. It was in wide use during the 1970s, but was eventually overshadowed by the more powerful
VAX-11 The VAX-11 is a discontinued family of 32-bit superminicomputers, running the Virtual Address eXtension (VAX) instruction set architecture (ISA), developed and manufactured by Digital Equipment Corporation (DEC). Development began in 1976. In a ...
architecture in the 1980s.


Memory


Data formats

Sixteen-bit words are stored
little-endian In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
(with least significant
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s first). Thirty-two-bit data—supported as extensions to the basic architecture, e.g.,
floating point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be ...
in the ''FPU Instruction Set'', double-words in the ''Extended Instruction Set'' or long data in the ''Commercial Instruction Set''—are stored in more than one format, including an unusual middle-endian format sometimes referred to as "PDP-endian".


Memory management

The PDP-11's 16-bit addresses can address 64  KB. By the time the PDP-11 yielded to the VAX, 8-bit bytes and hexadecimal notation were becoming standard in the industry; however, numeric values on the PDP-11 always use octal notation, and the amount of memory attached to a PDP-11 is always stated as a number of words. The basic
logical address In computing, a logical address is the address at which an item ( memory cell, storage element, network host) appears to reside from the perspective of an executing application program. A logical address may be different from the physical addre ...
space is 32K words, but the high 4K of physical address space (addresses 160000 through 177777 in the absence of memory management) are not populated because input/output registers on the bus respond to addresses in that range. So originally, a fully expanded PDP-11 had 28K words, or 56 kbytes in modern terms. The processor reserves low memory addresses for two-word vectors that give a program counter and processor status word with which to begin a service routine. When an I/O device interrupts a program, it places the address of its vector on the bus to indicate which service routine should take control. The lowest vectors are service routines to handle various types of trap. Traps occur on some program errors, such as an attempt to execute an undefined instruction; and also when the program executes an instruction such as BPT, EMT, IOT, or TRAP to request service from the operating system.


Memory expansion

During the life of the PDP-11, the 16-bit logical address space became an increasing limitation. Various techniques were used to work around it: *Later-model PDP-11 processors include memory management to support virtual addressing. The physical address space was extended to 18 or 22 bits, hence allowing up to 256 KB or 4 MB of RAM. The logical address space (that is, the address space available at any moment without changing the memory mapping table) remains limited to 16 bits. *Some models, beginning with the PDP-11/45, can be set to use 32K words (64 KB) as the "instruction space" for program code and a separate 32K words of "data space". Some operating systems—notably Unix since edition V7, and RSX11-M+—rely on this feature. *Programming techniques, such as
overlaying Overlaying or overlying is the act of accidentally smothering a child to death by rolling over them in sleep. Alleged instances of overlaying were perceived to be one common way of covering up infanticide in Victorian England. Many wet nurses wer ...
a block of stored instructions or data with another as needed, can conceal paging issues from the application programmer. For example, the
Modula-2 Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It w ...
compiler produces code under which the run-time system swaps 8 Kb pages into memory as individual procedures receive control.


CPU registers

The CPU contains eight general-purpose 16-bit registers (R0 to R7). Register R7 is the
program counter The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, is ...
(PC). Although any register can be used as a stack pointer, R6 is the stack pointer (SP) used for hardware interrupts and traps. R5 is often used to point to the current procedure call frame. To speed up context switching, some PDP-11 models provide dual R1-R5 register sets. Kernel, Supervisor (where present), and User modes have separate memory maps, and also separate stack pointers (so that a user program cannot cause the system to malfunction by storing an invalid value in the stack pointer register).


Addressing modes

Most instructions allocate six bits to specify an operand. Three bits select one of eight addressing modes, and three bits select a general register. The encoding of the six bit operand addressing mode is as follows: In the following sections, each item includes an example of how the operand would be written in assembly language. Rn means one of the eight registers, written R0 through R7.


General register addressing modes

The following eight modes can be applied to any general register. Their effects when applied to R6 (the stack pointer, SP) and R7 (the program counter, PC) are set out separately in the following sections. In index and index deferred modes, X is a 16-bit value taken from a second word of the instruction. In double-operand instructions, both operands can use these modes. Such instructions are three words long. Autoincrement and autodecrement operations on a register are by 1 in byte instructions, by 2 in word instructions, and by 2 whenever a deferred mode is used, since the quantity the register addresses is a (word) pointer.


Program counter addressing modes

When R7 (the program counter) is specified, four of the addressing modes naturally yield useful effects: The only common use of absolute mode, whose syntax combines immediate and deferred mode, is to specify input/output registers, as the registers for each device have specific memory addresses. Relative mode has a simpler syntax and is more typical for referring to program variables and jump destinations. A program that uses relative mode (and relative deferred mode) exclusively for internal references is position-independent; it contains no assumptions about its own location, so it can be loaded into an arbitrary memory location, or even moved, with no need for its addresses to be adjusted to reflect its location ( relocated). In computing such addresses relative to the current location, the processor performed relocation on the fly. Immediate and absolute modes are merely autoincrement and autoincrement deferred mode, respectively, applied to PC. When the auxiliary word is "in the instruction" as the above table says, the PC for the next instruction is automatically incremented past the auxiliary word. As PC always points to words, the autoincrement operation is always by 2.


Stack addressing modes

R6, also written SP, is used as a hardware stack for traps and interrupts. A convention enforced by the set of modes the PDP-11 provides is that a stack grows downward—toward lower addresses—as items are pushed onto it. When a mode is applied to SP, or to any register the programmer elects to use as a software stack, the addressing modes have the following effects: Although software stacks can contain bytes, SP is always a stack of words. Autoincrement and autodecrement operations on SP is always by 2.


Instruction set

The PDP-11 operates on bytes and words. Bytes are specified by a register number—identifying the register's low-order byte—or by a memory location. Words are specified by a register number or by the memory location of the low-order byte, which must be an even number. In most instructions that take operands, bit 15 is set to specify byte addressing, or clear to specify word addressing. In the lists in the following two sections, the assembly-language programmer appended B to the instruction symbol to specify a byte operation; for example, MOV became MOVB. A few instructions, for example MARK and SOB, were not implemented on some PDP-11 models.


Double-operand instructions

The high-order four bits specify the operation to be performed (with bit 15 generally selecting word versus byte addressing). Two groups of six bits specify the source operand addressing mode and the destination operand addressing mode, as defined above. The ADD and SUB instructions use word addressing, and have no byte-oriented variations. Some two-operand instructions utilize an addressing mode operand and an additional register operand: Where a register pair is used (written below as "(Reg, Reg+1)", the first register contains the low-order portion of the operand and must be an even numbered register. The next higher numbered register contains the high-order portion of the operand (or the remainder). An exception is the multiply instruction; Reg may be odd, but if it is, the high 16 bits of the result are not stored.


Single-operand instructions

The high-order ten bits specify the operation to be performed, with bit 15 generally selecting byte versus word addressing. A single group of six bits specifies the operand as defined above.


Branch instructions

In most branch instructions, whether the branch is taken is based on the state of the condition codes. A branch instruction is typically preceded by a two-operand CMP (compare) or BIT (bit test) or a one-operand TST (test) instruction. Arithmetic and logic instructions also set the condition codes. In contrast to
Intel Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California. It is the world's largest semiconductor chip manufacturer by revenue, and is one of the developers of the x86 seri ...
processors in the
x86 architecture x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
, MOV instructions set them too, so a branch instruction could be used to branch depending on whether the value moved was zero or negative. The high-order byte of the instruction specifies the operation. Bits 9 through 15 are the op-code, and bit 8 is the value of the condition code calculation which results in the branch being taken. The low-order byte is a signed word offset relative to the current location of the program counter. This allows for forward and reverse branches in code. The limited range of the branch instructions meant that, as code grew, the target addresses of some branches would become unreachable. The programmer would change the one-word BR to the two-word JMP instruction from the next group. As JMP has no conditional forms, the programmer would change BEQ to a BNE that branched around a JMP. SOB (Subtract One and Branch) is another conditional branch instruction. The specified register is decremented by 1, and if the result is not zero, a reverse branch is taken based on the 6 bit word offset.


Subroutine instructions

The JSR instruction could save any register on the stack. Programs that did not need this feature specified PC as the register (JSR PC, address) and the routine returned using RTS PC. If a routine were called with, for instance, "JSR R4, address", then the old value of R4 would be on the top of the stack and the return address (just after JSR) would be in R4. This let the routine gain access to values coded in-line by specifying (R4)+, or to in-line pointers by specifying @(R4)+. The autoincrementation moved past these data, to the point at which the caller's code resumed. Such a routine would have to specify RTS R4 to return to its caller.


Trap instructions


Trap and Exception Vector Address Assignments


Miscellaneous instructions


Condition-code operations

The four condition codes in the processor status word (PSW) are *N indicating a negative value *Z indicating a zero (equal) condition *V indicating an overflow condition, and *C indicating a carry condition. Instructions in this group were what Digital called "micro-programmed": A single bit in the instruction word referenced a single condition code. The assembler did not define syntax to specify every combination, but the symbols SCC and CCC assembled an instruction that set or cleared, respectively, all four condition codes. Clearing or setting none of the condition codes (opcodes 000240 and 000260, respectively) could effectively be considered as no-operation instructions. In fact, the NOP mnemonic assembled into 000240.


Inconsistent instructions

Over the life of the PDP-11, subtle differences arose in the implementation of instructions and combinations of addressing modes, though no implementation was regarded as correct. The inconsistencies did not affect ordinary use of the PDP-11.


Optional instruction sets


Extended Instruction Set (EIS)

The EIS is an option for 11/35/40 and 11/03, and is standard on newer processors. *MUL, DIV multiply and divide integer operand to register pair *ASH, ASHC arithmetic - shift a register or a register pair. For a positive number it will shift left, and right for a negative one.


Floating Instruction Set (FIS)

The FIS instruction set is an option for the PDP-11/35/40 and 11/03. Single-precision operating on a stack addressed by a register operand. The high-order 13 bits specify the operation to be performed. A three bit field specifies which register is used as the floating point operand stack pointer. Each float is two words and each floating point instruction operates on two floats, returning one float as a result. The selected stack pointer is incremented by a stride of 4 after each operation.


Floating Point Processor (FPP)

This was the optional floating point processor option for 11/45 and most subsequent models. *full floating point operations on single- or double-precision operands, selected by single/double bit in Floating Point Status Register *single-precision floating point data format predecessor of
IEEE 754 The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point arithmetic established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). The standard addressed many problems found i ...
format: sign bit, 8-bit exponent, 23-bit mantissa with hidden bit 24


Commercial Instruction Set (CIS)

The Commercial Instruction Set, known as CIS or CIS11, adds string and
binary coded decimal In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used for ...
(BCD) instructions used by
COBOL COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural and, since 2002, object-oriented language. COBOL is primarily us ...
and
DIBOL DIBOL or Digital's Business Oriented Language is a general-purpose, procedural, imperative programming language, designed for use in Management Information Systems (MIS) software development. It has a syntax similar to FORTRAN and BASIC, alon ...
. It was implemented by optional microcode in the 11/23/24, and by an add-in module in the 11/44 and one version of the 11/74. Strings are represented by two 16-bit integers stored in any two of the general-purpose registers, or as two 16-bit values in subsequent locations in memory. One is designated "n", which is the length up to 64 kB, and the other "A", which is a pointer to the start of the character data in memory. The basic operations are MOVEC, MOVTC and MOVRC, which move the character data in memory from one location to the other, indicated in a pair of registers, or MOVECI, MOVTCI and MOVRCI which did the same with the location indicated by values in memory. MOVEC/MOVECI simply copies the data from one location to another. MOVRC/MOVRCI reverses the original string into the destination. In all of the move instructions, if the source is shorter than the destination, the destination is padded, if the source is longer, it is truncated. If either occurs, the processor status flags are used to indicate this. MOVTC/MOVTCI translates characters during copy using a 256-byte lookup table held in a third n/A pair, with the A pointing to the start of the table and the lower eight bits of n being an ASCII code used to fill the destination string if the source string is shorter. Translations use the source string's ASCII value as an index number and copy the value in the translation table at that index into the destination string. This can be used for
EBCDIC Extended Binary Coded Decimal Interchange Code (EBCDIC; ) is an eight-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. It descended from the code used with punched cards and the corresponding six- ...
conversions, for instance, by placing the corresponding EBCDIC character code for the mapped ASCII codes in the table. The ASCII character "E" is character 69, while it is character 197 in EBCDIC, so to convert EBCDIC to ASCII one would make a table of 256 bytes with a 69 in location 197. String comparisons are handled by CMPC, which sets the processor condition codes based on the results of comparing two strings. LOCC finds the first occurrence of a character in a string, while SKPC searches for the first character that does not match, used for trimming blanks at the start of strings, for instance. SCANC and SPANC are similar to LOCC and SKPC, but match any character in a masked character set. This can be used, for instance, to find the next occurrence of any line-breaking character like VT, LF or CR. Character sets are a table of 256 bytes, split into subsets. These are similar to the translation tables with the lower eight bits of the first word forming a mask, and the second word pointing to the start of the table. The mask selects which of the subsets, up to eight, are part of the character set during comparisons. Using this system, one can define character sets like uppercase, lowercase, digits, etc. and then easily make a union via the mask, for instance, selecting the upper and lowercase subsets to produce the complete set of letters. CIS also includes a set of data types and instructions for manipulating BCD numbers. This data is also represented by two 16-bit registers or memory locations, with the second number being the A identical to the string case. The first word now contains four fields which describe the string representation of the data, which include packed and unpacked digits, handling the sign, and the length of the string, from 0 to 16. DEC referred to unpacked data, with one digit per byte, as "numeric strings". Using packed data, with two BCD digits per byte, a 16-word string held BDC numbers up to 32 digits long. Instructions included ADDP/ADDN for packed and unpacked data, SUBP/SUBN, ASHP/ASHN (arithmetic shift) and CMPP/CMPN (compare). Available for packed data only are MULP and DIVP. It also includes a set of instructions to convert BCD numbers between packed and unpacked formats, as well as to and from binary values. A final set of instructions is used to load string and BCD data to and from the internal registers, avoiding the need for bit-fiddling in code.


Access to Processor Status Word (PSW)

The PSW is mapped to memory address 177 776, and can thus be processed like any data. Instructions found on all but the earliest PDP-11s give programs more direct access to the register. *SPL (set priority level) *MTPS (move to Processor Status) *MFPS (move from Processor Status)


Access to other memory spaces

On PDP-11s that provide multiple instruction spaces and data spaces, a set of non-orthogonal Move instructions give access to other spaces. For example, routines in the operating system that handle run-time service calls use these instructions to exchange information with the caller. *MTPD (move to previous data space) *MTPI (move to previous instruction space) *MFPD (move from previous data space) *MFPI (move from previous instruction space)


Speed

PDP-11 processor speed varies by model, memory configuration, op code, and addressing modes. Instruction timings have up to three components, execute/fetch of the instruction itself and access time for the source and the destination. The last two components depend on the addressing mode. For example, on the PDP-11/70 (circa 1975), an instruction of the form ADD ''x''(R''m''),''y''(R''n'') had a fetch/execute time of 1.35 microseconds plus source and destination times of 0.6 microseconds each, for a total instruction time of 2.55 microseconds. Any case where addressed memory is not in the cache adds 1.02 microseconds. The register-to-register ADD R''m'',R''n'' can execute from the cache in 0.3 microseconds. Floating point is even more complex, since there is some overlap between the CPU and the floating-point processor, but in general, floating point is significantly slower. A single-precision floating add instruction ranges from 2.4 to 5.5 microseconds plus time to fetch the operands.DEC PDP-11/70 Processor Handbook, 1975, Appendix C, Instruction Timing


Interrupts

The PDP-11 operates at a priority level from 0 through 7, specified by three bits in the Processor Status Word (PSW), and high-end models can operate in a choice of modes, Kernel (privileged), User (application), and sometimes Supervisor, according to two bits in the PSW. To request an interrupt, a bus device asserts one of four common bus lines, BR4 through BR7, until the processor responds. Higher numbers indicated greater urgency, perhaps that data might be lost or a desired sector might rotate out of contact with the read/write heads unless the processor responds quickly. The printer's readiness for another character is the lowest priority (BR4), as it can remain ready indefinitely. If the processor is operating at level 5, then BR6 and BR7 would be in order. If the processor is operating at 3 or lower, it will grant any interrupt; if at 7, it will grant none. Bus requests that are not granted are not lost but merely deferred. The device needing service continues to assert its bus request. Whenever an interrupt exceeds the processor's priority level, the processor asserts the corresponding bus grant, BG4 through BG7. The bus-grant lines are not common lines but are a
daisy chain Daisy chain may refer to: * Daisy chain, a garland created from daisy flowers * Daisy chain (climbing), a type of strap * Daisy chain (electrical engineering), a wiring scheme * Daisy chain (fishing), a type of fishing lure * Daisy chain (knot), ...
: The input of each gate is the output of the previous gate in the chain. A gate is on each bus device, and a device physically closer to the processor is earlier in the daisy chain. If the device has made a request, then on sensing its bus-grant input, it concludes it is in control of the bus, and does not pass the grant signal to the next device on the bus. If the device has not made a request, it propagates its bus-grant input to its bus-grant output, giving the next closest device the chance to reply. (If devices do not occupy adjacent slots to the processor board, "grant continuity cards" inserted into the empty slots propagate the bus-grant line.) Once in control of the bus, the device drops its bus request and places on the bus the memory address of its two-word vector. The processor saves the program counter (PC) and PSW, enters Kernel mode, and loads new values from the specified vector. For a device at BR6, the new PSW in its vector typically specifies 6 as the new processor priority, so the processor will honor more urgent requests (BR7) during the service routine, but defer requests of the same or lower priority. With the new PC, the processor jumps to the service routine for the interrupting device. That routine operates the device, at least removing the condition that caused the interrupt. The routine ends with the RTI (ReTurn from Interrupt) instruction, which restores PC and PSW as of just before the processor granted the interrupt. If a bus request is made in error and no device responds to the bus grant, the processor times out and performs a trap that suggests bad hardware.


MACRO-11 assembly language

MACRO-11 MACRO-11 is an assembly language with macro facilities, designed for PDP-11 minicomputer family from Digital Equipment Corporation (DEC). It is the successor to Program Assembler Loader ( PAL-11R), an earlier version of the PDP-11 assembly languag ...
is the
assembly language In computer programming, assembly language (or assembler language, or symbolic machine code), often referred to simply as Assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence be ...
for the PDP-11. It is the successor to
PAL-11 PAL-11R is an assembly language, and an assembler, for the PDP-11's disk operating system, DOS-11. It was the precursor to MACRO-11 MACRO-11 is an assembly language with macro facilities, designed for PDP-11 minicomputer family from Digital Equi ...
(Program Assembler Loader), an earlier version of the PDP-11 assembly language without macro facilities. MACRO-11 is supported on all DEC PDP-11 operating systems. PDP-11
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
systems also include an assembler (called " as"), structurally similar to MACRO-11, but with different syntax and fewer features.


Notes


References


Further reading

* *Michael Singer, ''PDP-11. Assembler Language Programming and Machine Organization'', John Wiley & Sons, NY: 1980. * *


External links

*PDP-11 Processor Handbook (Gordon Bell'
1969 edition1979 edition at bitsavers
)
Preserving the PDP-11 Series of 16-bit minicomputers
*
Gordon Bell Chester Gordon Bell (born August 19, 1934) is an American electrical engineer and manager. An early employee of Digital Equipment Corporation (DEC) 1960–1966, Bell designed several of their PDP machines and later became Vice President of Engi ...
and Bill Strecker's 1975 paper
What We Learned From the PDP-11Ersatz-11
a PDP-11 emulator *Further papers and links o



{{Digital Equipment Corporation PDP-11 Instruction set architectures