Recent from talks
Nothing was collected or created yet.
IBM System/360 architecture
View on Wikipedia| Designer | IBM |
|---|---|
| Bits | 32-bit |
| Introduced | April 7, 1964 |
| Design | CISC |
| Type | Register-Register Register-Memory Memory-Memory |
| Encoding | Variable (2, 4 or 6 bytes long) |
| Branching | Condition code, indexing, counting |
| Endianness | Big |
| Page size | N/A, except for 360/67 |
| Open | Yes |
| Registers | |
| General-purpose | 16× 32-bit |
| Floating-point | 4× 64-bit |
| History of IBM mainframes, 1952–present |
|---|
| Market name |
| Architecture |
The IBM System/360 architecture is the model independent architecture for the entire S/360 line of mainframe computers, including but not limited to the instruction set architecture. The elements of the architecture are documented in the IBM System/360 Principles of Operation[1][2] and the IBM System/360 I/O Interface Channel to Control Unit Original Equipment Manufacturers' Information manuals.[3]
Features
[edit]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The System/360 architecture provides the following features:
- 16 32-bit general-purpose registers
- 4 64-bit floating-point registers
- 64-bit processor status register (PSW), which includes a 24-bit instruction address
- 24-bit (16 MB) byte-addressable memory space
- Big-endian byte/word order
- A standard instruction set, including fixed-point binary arithmetic and logical instructions, present on all System/360 models (except the Model 20, see below).
- A commercial instruction set, adding decimal arithmetic instructions, is optional on some models, as is a scientific instruction set, which adds floating-point instructions. The universal instruction set includes all of the above plus the storage protection instructions and is standard for some models.
- The Model 44 provides a few unique instructions for data acquisition and real-time processing and is missing the storage-to-storage instructions. However, IBM offered a 'Commercial Instruction Set" feature that ran in bump storage and simulated the missing instructions.
- The Model 20 offers a stripped-down version of the standard instruction set, limited to eight general registers with halfword (16-bit) instructions only, plus the commercial instruction set, and unique instructions for input/output.
- The Model 67 includes some instructions to handle 32-bit addresses and "dynamic address translation", with additional privileged instructions to provide virtual memory.[7]
Memory
[edit]Memory (storage) in System/360 is addressed in terms of 8-bit bytes. Various instructions operate on larger units called halfword (2 bytes), fullword (4 bytes), doubleword (8 bytes), quad word (16 bytes) and 2048 byte storage block, specifying the leftmost (lowest address) of the unit. Within a halfword, fullword, doubleword or quadword, low numbered bytes are more significant than high numbered bytes; this is sometimes referred to as big-endian. Many uses for these units require aligning them on the corresponding boundaries. Within this article the unqualified term word refers to a fullword.
The original architecture of System/360 provided for up to 224 = 16,777,216 bytes of memory. The later Model 67 extended the architecture to allow up to 232 = 4,294,967,296[a] bytes of virtual memory.
Addressing
[edit]System/360 uses truncated addressing similar to that of the UNIVAC III.[8] That means that instructions do not contain complete addresses, but rather specify a base register and a positive offset from the addresses in the base registers. In the case of System/360 the base address is contained in one of 15[b] general registers. In some instructions, for example shifts, the same computations are performed for 32-bit quantities that are not addresses.
Data formats
[edit]The S/360 architecture defines formats for characters, integers, decimal integers and hexadecimal floating point numbers. Character and integer instructions are mandatory, but decimal and floating point instructions are part of the Decimal arithmetic and Floating-point arithmetic features.
- Characters are stored as 8-bit bytes.
- Integers are stored as two's complement binary halfword or fullword values.
- Packed decimal numbers are stored as 1 to 16 8-bit bytes containing an odd number of decimal digits followed by a 4-bit sign. Sign values of hexadecimal A, C, E, and F are positive and sign values of hexadecimal B and D are negative. Digit values of hexadecimal A-F and sign values of 0-9 are invalid, but the PACK and UNPK instructions do not test for validity.
- Zoned decimal numbers are stored as 1 to 16 8-bit bytes, each containing a zone in bits 0-3 and a digit in bits 4-7. The zone of the rightmost byte is interpreted as a sign.
- Floating point numbers are only stored as fullword or doubleword values on older models. On the 360/85[9] and 360/195[10] there are also extended precision floating point numbers stored as quadwords. For all three formats, bit 0 is a sign and bits 0-7 are a characteristic (exponent, biased by 64). Bits 8-31 (8-63) are a hexadecimal fraction. For extended precision, the low order doubleword has its own sign and characteristic, which are ignored on input and generated on output.
Instruction formats
[edit]Instructions in the S/360 are two, four or six bytes in length, with the opcode in byte 0. Instructions have one of the following formats:
- RR (two bytes). Generally byte 1 specifies two 4-bit register numbers, but in some cases, e.g., SVC, byte 1 is a single 8-bit immediate field.
- RS (four bytes). Byte 1 specifies two register numbers; bytes 2-3 specify a base and displacement.
- RX (four bytes). Bits 0-3 of byte 1 specify either a register number or a modifier; bits 4-7 of byte 1 specify the number of the general register to be used as an index; bytes 2-3 specify a base and displacement.
- SI (four bytes). Byte 1 specifies an immediate field; bytes 2-3 specify a base and displacement.
- SS (six bytes). Byte 1 specifies two 4-bit length fields or one 8-bit length field; bytes 2-3 and 4-5 each specify a base and displacement. The encoding of the length fields is length-1.
Instructions must be on a two-byte boundary in memory; hence the low-order bit of the instruction address is always 0.
Program Status Word (PSW)
[edit]The Program Status Word (PSW)[2]: 71–72 contains a variety of controls for the currently operating program. The 64-bit PSW describes (among other things) the address of the current instruction being executed, condition code and interrupt masks.
| Bits | Contents | Explanation |
|---|---|---|
| 0-7 | System Mask | bits 0-5: enable channels 0-5, bit 6: enable all remaining channels,[c] bit 7: enable External interruptions (timer, interrupt key, and external signal[13] |
| 8-11 | Protection key | CPU protection key to compare against storage protection keys |
| 12 | ASCII mode | enable ASCII mode for packed decimal instructions, never used by IBM software[d] |
| 13 | Machine checks | enable Machine check interruptions |
| 14 | Wait State | processor is halted, an interruption, if enabled, will cause the processor to resume executing instructions |
| 15 | Problem state | enable to prevent the use of instructions reserved for supervisor state |
| 16-31 | Interruption Code | code to indicate the type of interruption, inserted when the PSW is stored, during IPLoad, this is the address of the device from which the program was loaded[14] |
| 32-33 | Instruction Length Code | length in halfwords or 0 if unavailable |
| 34-35 | Condition Code | see individual instructions for encoding |
| 36-39 | Program Mask | bit 36: enable fixed-point overflow, bit 37: decimal overflow, bit 38: exponent underflow, bit 39: significance[13] |
| 40-63 | Instruction Address | address of next instruction, except for a program interruptions with ILC 0 |
Load Program Status Word (LPSW) is a privileged instruction that loads the Program Status Word (PSW), including the program mode, protection key, and the address of the next instruction to be executed. LPSW is most often used to "return" from an interruption by loading the "old" PSW which is associated with the interruption class. Other privileged instructions (e.g., SSM, STNSM, STOSM, SPKA, etcetera) are available for manipulating subsets of the PSW without causing an interruption or loading a PSW; and one non-privileged instruction (SPM) is available for manipulating the program mask.
Interruption system
[edit]The architecture[2]: 77–83 defines 5 classes of interruption. An interruption is a mechanism for automatically changing the program state; it is used for both synchronous[e] and asynchronous events.
| Interruption class | Old PSW | New PSW | Priority | ||
|---|---|---|---|---|---|
| hex | dec | hex | dec | ||
| Input/Output[15] | 38 | 56 | 78 | 120 | 4 |
| Program[16] | 28 | 40 | 68 | 104 | 2 |
| Supervisor Call[17] | 20 | 32 | 60 | 96 | 2 |
| External[18] | 18 | 24 | 58 | 88 | 3 |
| Machine Check[19] | 30 | 48 | 70 | 112 | 1 |
There are two storage fields assigned to each class of interruption on the S/360; an old PSW double-word and a new PSW double-word. The processor stores the PSW, with an interruption code inserted, into the old PSW location and then loads the PSW from the new PSW location. This generally replaces the instruction address, thereby effecting a branch, and (optionally) sets and/or resets other fields within the PSW, thereby effecting a mode change.
The S/360 architecture defines a priority to each interruption class, but it is only relevant when two interruptions occur simultaneously; an interruption routine can be interrupted by any other enabled interruption, including another occurrence of the initial interruption. For this reason, it is normal practice to specify all of the mask bits, with the exception of machine-check mask bit, as 0 for the "first-level" interruption handlers. "Second-level" interruption handlers are generally designed for stacked interruptions (multiple occurrences of interruptions of the same interruption class).
Input/Output interruption
[edit]An I/O interruption[15] occurs at the completion of a channel program, after fetching a CCW with the PCI bit set and also for asynchronous events detected by the device, control unit or channel, e.g., completion of a mechanical movement. The system stores the device address into the interruption code and stores channel status into the CSW at location 64 ('40'X).
Program interruption
[edit]A Program interruption[2]: 16, 79–80.1 occurs when an instruction encounters one[f] of 15[g] exceptions; however, if the Program Mask bit corresponding to an exception is 0 then there is no interruption for that exception. On 360/65,[21]: 12 360/67[11]: 46 and 360/85[9]: 12 the Protection Exception and Addressing Exception interruptions can be imprecise, in which case they store an Instruction Length Code of 0. The Interruption code may be any of
| hex bits 26-31 |
Dec | Exception | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 0 |
Imprecise interruption[f] on 360/91,[20]: 15 360/95 or 360/195[10]: 14
| ||||||||||||||||||||||||||
| 1 | 1 | Operation[22] | ||||||||||||||||||||||||||
| 2 | 2 | Privileged operation[22] | ||||||||||||||||||||||||||
| 3 | 3 | Execute[22] | ||||||||||||||||||||||||||
| 4 | 4 | Protection[22] | ||||||||||||||||||||||||||
| 5 | 5 | Addressing[23] | ||||||||||||||||||||||||||
| 6 | 6 | Specification[24] | ||||||||||||||||||||||||||
| 7 | 7 | Data[24] | ||||||||||||||||||||||||||
| 8 | 8 | Fixed-point overflow[24] | ||||||||||||||||||||||||||
| 9 | 9 | Fixed-point divide[24] | ||||||||||||||||||||||||||
| A | 10 | Decimal overflow[24] | ||||||||||||||||||||||||||
| B | 11 | Decimal divide[24] | ||||||||||||||||||||||||||
| C | 12 | Exponent overflow[24] | ||||||||||||||||||||||||||
| D | 13 | Exponent underflow[24] | ||||||||||||||||||||||||||
| E | 14 | Significance[24] | ||||||||||||||||||||||||||
| F | 15 | Floating-point divide[25] | ||||||||||||||||||||||||||
| 10 | 16 | |||||||||||||||||||||||||||
| 11 | 17 | |||||||||||||||||||||||||||
| 12 | 18 |
- An operation exception[22] is recognized when a program attempts to execute an instruction with an opcode that the computer does not implement. In particular, an operation exception is recognized when a program is written for an optional feature, e.g., floating point, that is not installed.
- A privileged operation exception[22] is recognized when a program attempts to execute a privileged instruction when the problem state bit in the PSW is 1.
- An execute exception[22] is recognized when the operand of an EXECUTE instruction (EX) is another EXECUTE instruction.
- A protection exception[22] is recognized when a program attempts to store into a location whose storage protect key does not match[j] the PSW key, or to fetch from a fetch protected location whose storage protect key does not match the PSW key.
- An addressing exception[23] is recognized when a program attempts to access a storage location that is not currently available. This normally occurs with an address beyond the capacity of the machine, but it may also occur on machines that allow blocks of storage to be taken offline.
- A specification exception[24] is recognized when an instruction has a length or register field with values not permitted by the operation, or when it has an operand address that does not satisfy the alignment requirements of the opcode, e.g., a LH instruction with an odd operand address on a machine without the byte alignment feature.
- A data exception[24] is recognized when a decimal instruction specifies invalid operands, e.g., invalid data, invalid overlap.
- A fixed-point overflow exception[24] is recognized when significant bits are lost in a fixed point arithmetic or shift instruction, other than divide.
- A fixed-point divide exception[24] is recognized when significant bits are lost in a fixed point divide or Convert to Binary instruction.
- A decimal overflow exception[24] is recognized when significant digits are lost in a decimal arithmetic instruction, other than divide.
- A decimal divide exception[24] is recognized when significant bits are lost in a decimal divide instruction. The destination is not altered.
- An exponent overflow exception[24] is recognized when the characteristic in a floating-point arithmetic operation exceeds 127 and the fraction is not zero.
- An exponent underflow exception[24] is recognized when the characteristic in a floating-point arithmetic operation is negative and the fraction is not zero.
- A significance exception[24] is recognized when the fraction in a floating-point add or subtract operation is zero.
- A floating-point divide exception[25] is recognized when the fraction in the divisor of a floating-point divide operation is zero.
Supervisor Call interruption
[edit]A Supervisor Call interruption[17] occurs as the result of a Supervisor Call instruction; the system stores bits 8-15 of the SVC instruction as the Interruption Code.
External interruption
[edit]An External[26][k] interruption occurs as the result of certain asynchronous events. Bits 16-24 of the External Old PSW are set to 0 and one or more of bits 24-31 is set to 1
| PSW bit | Type of external interruption |
|---|---|
|
24 |
Timer |
|
25 |
Interrupt key |
|
26 |
External signal 2 Malfunction alert on 360/65[21] in Multisystem mode |
|
27 |
External signal 3 System Call on 360/65[21] in Multisystem mode |
|
28 |
External signal 4 |
|
29 |
External signal 5 |
|
30 |
External signal 6 |
|
31 |
External signal 7 |
Machine Check interruption
[edit]A Machine Check interruption[19] occurs to report unusual conditions associated with the channel or CPU that cannot be reported by another class of interruption. The most important class of conditions causing a Machine Check is a hardware error such as a parity error found in registers or storage, but some models may use it to report less serious conditions. Both the interruption code and the data stored in the scanout area at '80'x (128 decimal) are model dependent.
Input/Output
[edit]This article describes I/O from the CPU perspective. It does not discuss the channel cable or connectors, which have a separate article; there is a summary elsewhere and details can be found in the IBM literature[3] and in FIPS PUB 60-2.[27]
I/O is carried out by a conceptually separate processor called a channel. Channels have their own instruction set, and access memory independently of the program running on the CPU. On the smaller models (through 360/50) a single microcode engine runs both the CPU program and the channel program. On the larger models the channels are in separate cabinets and have their own interfaces to memory. A channel may contain multiple subchannels, each containing the status of an individual channel program. A subchannel associated with multiple devices that cannot concurrently have channel programs is referred to as shared; a subchannel representing a single device is referred to as unshared.
There are three types of channels on the S/360:
- A byte multiplexer channel is capable of executing multiple CCWs concurrently; it is normally used to attach slow devices such as card readers and telecommunications lines. A byte multiplexer channel could have a number of selector subchannels, each with only a single subchannel, which behave like low-speed selector channels.
- A selector channel has only a single subchannel, and hence is only capable of executing one channel command at a time. It is normally used to attach fast devices that are not capable of exploiting a block multiplexer channel to suspend the connection, such as magnetic tape drives.
- A block multiplexer channel is capable of concurrently running multiple channel programs, but only one at a time can be active. The control unit can request suspension at the end of a channel command and can later request resumption. This is intended for devices in which there is a mechanical delay after completion of data transfer, e.g., for seeks on moving-head DASD. The block multiplexer channel was a late addition to the System/360 architecture; early machines had only byte multiplexer channels and selector channels. The block multiplexer channel is an optional feature only on the models 85 and 195. The block multiplexor channel is also available on the later System/370 computers.
Conceptually peripheral equipment is attached to a S/360 through control units, which in turn are attached through channels. However, the architecture does not require that control units be physically distinct, and in practice they are sometimes integrated with the devices that they control. Similarly, the architecture does not require the channels to be physically distinct from the processor, and the smaller S/360 models (through 360/50) have integrated channels that steal cycles from the processor.
Peripheral devices are addressed with 16-bit[l] addresses.,[2]: 89 referred to as cua or cuu; this article will use the term cuu. The high 8 bits identify a channel, numbered from 0 to 6,[c] while the low 8 bits identify a device on that channel. A device may have multiple cuu addresses.
Control units are assigned an address "capture" range. For example, a CU might be assigned range 20-2F or 40-7F. The purpose of this is to assist with the connection and prioritization of multiple control units to a channel. For example, a channel might have three disk control units at 20-2F, 50-5F, and 80-8F. Not all of the captured addresses need to have an assigned physical device. Each control unit is also marked as High or Low priority on the channel.
Device selection progresses from the channel to each control unit in the order they are physically attached to their channel. At the end of the chain the selection process continues in reverse back towards the channel. If the selection returns to the channel then no control unit accepted the command and SIO returns Condition Code 3. Control units marked as High Priority check the outbound CUU to be within their range. If so, then the I/O is processed. If not, then the selection is passed to the next outbound CU. Control units marked as Low Priority check for inbound (returning) CUU to be within their range. If so, then the I/O is processed. If not, then the selection is passed to the next inbound CU (or the channel). The connection of three controls unit to a channel might be physically -A-B-C and, if all are marked as High then the priority would be ABC. If all are marked low then the priority would be CBA. If B was marked High and AC low then the order would be BCA. Extending this line of reasoning then the first of N controllers would be priority 1 (High) or 2N-1 (Low), the second priority 2 or 2N-2, the third priority 3 or 2N-3, etc. The last physically attached would always be priority N.
There are three storage fields reserved for I/O; a double word I/O old PSW, a doubleword I/O new PSW and a fullword Channel Address Word (CAW). Performing an I/O normally requires the following:
- initializing the CAW with the storage key and the address of the first CCW
- issuing a Start I/O (SIO) instruction that specifies the cuu for the operation
- waiting[m] for an I/O interruption
- handling any unusual conditions indicated in the Channel Status Word (CSW)
A channel program consists of a sequence of Channel Control Words (CCWs) chained together (see below.) Normally the channel fetches CCWs from consecutive doublewords, but a control unit can direct the channel to skip a CCW and a Transfer In Channel (TIC) CCW can direct the channel to start fetching CCWs from a new location.
There are several defined ways for a channel command to complete. Some of these allow the channel to continue fetching CCWs, while others terminate the channel program. In general, if the CCW does not have the chain-command bit set and is not a TIC, then the channel will terminate the I/O operation and cause an I/O interruption when the command completes. Certain status bits from the control unit suppress chaining.
The most common ways for a command to complete are for the count to be exhausted when chain-data is not set and for the control unit to signal that no more data transfers should be made. If Suppress-Length-Indication (SLI) is not set and one of those occurs without the other, chaining is not allowed. The most common situations that suppress chaining are unit-exception and unit-check. However, the combination of unit-check and status-modifier does not suppress chaining; rather, it causes the channel to do a command retry, reprocessing the same CCW.
In addition to the interruption signal sent to the CPU when an I/O operation is complete, a channel can also send a Program-Controlled interruption (PCI) to the CPU while the channel program is running, without terminating the operation, and a delayed device-end interruption after the I/O completion interruption.
Channel status
[edit]These conditions are detected by the channel and indicated in the CSW.[28]
- Program-controlled interruption[29] indicates that the channel has fetched a CCW with the PCI bit set. The channel continues processing; this interruption simply informs the CPU of the channel's progress. An example of the use of Program-controlled interruption is in the "Program Fetch" function of Contents Supervision, whereby the control program is notified that a Control/Relocation Record has been read. To ensure that this record has been completely read into main storage, a "disabled bit spin", one of the few which remains in the control program, is initiated. Satisfaction of the spin indicates that the Control/Relocation Record is completely in main storage and the immediately preceding Text Record may be relocated. After relocation, a NOP CCW is changed to a TIC and the channel program continues. In this way, an entire load module may be read and relocated while utilizing only one EXCP, and possibly only one revolution of the disk drive. PCI also has applications in teleprocessing access method buffer management.
- Incorrect length[30] indicates that the data transfer for a command completed before the Count was exhausted. This indication is suppressed if the Suppress-Length-Indication bit in the CCW is set.
- Program check[30] indicates one of the following errors
- Nonzero bits where zeros are required
- An invalid data or CCW address
- The CAW or a TIC refers to a TIC
- Protection check[31] indicates that the protection key in the CAW is non-zero and does not match the storage protection key.
- Channel data check[32] indicates a parity error during a data transfer.
- Channel control check[32] indicates a channel malfunction other than Channel data check or Interface control check.
- Interface control check[32] indicates an invalid signal in the channel to control unit interface.
- Chaining check[32] indicates lost data during data chaining.
Unit status
[edit]These conditions are presented to the channel by the control unit or device.[33] In some cases they are handled by the channel and in other cases they are indicated in the CSW. There is no distinction between conditions detected by the control unit and conditions detected by the device.
- Attention[34] indicates an unusual condition not associated with an ongoing channel program. It often indicates some sort of operator action like requesting input, in which case the CPU would respond by issuing a read-type command, most often a sense command (04h) from which additional information could be deduced. Attention is a special condition, and requires specific operating system support, and for which the operating system has a special attention table[n] with a necessarily limited number of entries.
- Status modifier[35] (SM) indicates one of three unusual conditions
- A Test I/O instruction was issued to a device that does not support it.
- A Busy status refers to the control unit rather than to the device.
- A device has detected a condition that requires skipping a CCW. A CCW with a command for which Status Modifier is possible will normally specify command chaining, in which case the SM is processed by the channel and does not cause an interruption.
- A typical channel program where SM occurs is
...
Search Id Equal
TIC *-8
Read Data
- where the TIC causes the channel to refetch the search until the device indicates a successful search by raising SM.
- Control unit end[36] indicates that a previous control unit busy status has been cleared.
- Busy[37] indicates that a device (SM=0) or a control unit (SM=1) is busy.
- Channel end[38] indicates that the device has completed the data transfer for a channel command. There may also be an Incorrect length indication if the Count field of the CCW is exhausted, depending on the value of the Suppress-Length-Indication bit.
- Device end[38] indicates that the device has completed an operation and is ready to accept another. DE may be signalled concurrently with CE or may be delayed.
- Unit check[39] indicates that the device or control unit has detected an unusual condition and that details may be obtained by issuing a Sense command.
- Unit exception[40] indicates that the device has detected an unusual condition, e.g., end of file.
Channel Address Word
[edit]The fullword Channel Address Word[2]: 99 (CAW) contains a 4-bit storage protection key and a 24-bit address of the channel program to be started.
Channel Command Word
[edit]A Channel Command Word is a doubleword containing the following:
- an 8-bit channel Command Code[41]
- a 24-bit address[42]
- a 5-bit flag field[43]
- an unsigned halfword Count field[42]
CCW Command codes
[edit]The low order 2 or 4 bits determine the six types of operations that the channel performs;.[2]: 100, 105 The encoding is
| bits | Command |
|---|---|
| **** 0000 | Invalid in a CCW, simulated by the processor's Test I/O (TIO) instruction |
| MMMM 0100 | Sense[44] |
| **** 1000 | Transfer in Channel (TIC)[45] |
| MMMM 1100 | Read Backward[46] |
| MMMM MM01 | Write[47] |
| MMMM MM10 | Read[47] |
| MMMM MM11 | Control[44] |
The meaning of the high order six or four bits, the modifier bits, M in the table above, depends upon the type of I/O device attached, see e.g., DASD CKD CCWs. All eight bits are sent to and interpreted in the associated control unit (or its functional equivalent).
Control is used to cause a state change in a device or control unit, often associated with mechanical motion, e.g., rewind, seek.
Sense is used to read data describing the status of the device. The most important case is that when a command terminates with unit check, the specific cause can only be determined by doing a Sense and examining the data returned. A Sense command with the modifier bits all zero is always valid.
A noteworthy deviation from the architecture is that DASD use Sense command codes for Reserve and Release, instead of using Control.
CCW flags
[edit]The flags in a CCW affect how it executes and terminates.
| bit | flag | effect | |
|---|---|---|---|
| 32 | CD | Chain-Data | Continue operation using the storage area defined by the next CCW.[48] |
| 33 | CC | Chain-Command | Continue with the Command in the next CCW.[49] |
| 34 | SLI[o] | Suppress-Length-Indication | Continue channel program after count mis-match.[50] |
| 35 | SKIP | Skip | Do not read from or write into storage.[51] |
| 36 | PCI | Program-Controlled-Interruption | Request interruption when fetching CCW.[52] |
Channel Status Word
[edit]The Channel Status Word (CSW)[2]: 113–121 provides data associated with an I/O interruption.
| bits | field |
|---|---|
| 0-3 | Key[53] |
| 4-7 | 0000 |
| 8-31 | Command Address[53] |
| 32-47 | Status[54] |
| 32-39 |
|
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40-47 |
|
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48-63 | Count[55] |
- The Protection Key field contains the protect key from the CAW at the time that the I/O operation was initiated for I/O complete or PCI interruptions.[53]
- The Command Address field contains the address+8 of the last CCW fetched for an I/O complete or PCI interruption. However, there are 9 exceptions[53]
- The Status field contains one byte of Channel status bits, indicating conditions detected by the channel[28] and one byte of Unit status bits, indicating conditions detected by the I/O unit[33] There is no distinction between conditions detected by the control unit and conditions detected by the device.
- The Residual Count is a half word that gives the number of bytes in the area described by the CCW that have not been transferred to or from the channel[55] The difference between the count in the CCW and the residual count gives the number of bytes transferred.
I/O instructions
[edit]The S/360 has four[56] I/O instructions: Start I/O (SIO), Test I/O (TIO), Halt I/O (HIO) and Test Channel (TCH). All four are privileged and thus will cause a privileged operation program interruption if used in problem state. The B1 (base) and D1 (displacement) fields are used to calculate the cuu (channel and device number); bits 8-15 of the instructions are unused and should be zero for compatibility with the S/370.
Start I/O (SIO)
[edit]SIO[57] attempts to start the channel program pointed to by the CAW, using the storage protection key in the CAW.
Test I/O (TIO)
[edit]TIO[58] tests the status of a channel and device. It may also store a CSW, in which case it completes with condition code 1.
Halt I/O (HIO)
[edit]HIO[59] attempt to terminate an active channel program. It may also store a CSW, in which case it completes with condition code 1.
Test Channel (TCH)
[edit]TCH[60] tests the status of a channel. It does not affect the status of an active channel program and does not store a CSW,
Operator controls
[edit]
The architecture of System/360 specified the existence of several common functions, but did not specify their means of implementation. This allowed IBM to use different physical means, e.g., dial, keyboard, pushbutton, roller, image or text on a CRT, for selecting the functions and values on different processors. Any reference to key or switch should be read as applying to, e.g., a light-pen selection, an equivalent keyboard sequence.
- System Reset sends a reset signal on every I/O channel and clears the processor state; all pending interruptions are cancelled. System Reset is not guaranteed to correct parity errors in general registers, floating point registers or storage. System Reset does not reset the state of shared I/O devices.
- Initial Program Load (IPL)[61] is a process for loading a program when there isn't a loader available in storage, usually because the machine was just powered on or to load an alternative operating system.[2]: 123 This process is sometimes known as Booting.
- As part of the IPL facility the operator has a means of specifying a 12-bit[c] device address, typically with three dials as shown in the operator controls drawing. When the operator[p] selects the Load function, the system performs a System Reset, sends a Read IPL[q] channel command to the selected device in order to read 24 bytes into locations 0-23 and causes the channel to begin fetching CCWs at location 8; the effect is as if the channel had fetched a CCW from location 0 with a length of 24, an address of 0 and the flags containing Command Chaining + Suppress Length Indication. At the completion of the operation, the system stores the I/O address in the halfword at location 2 and loads the PSW from location 0.
- Initial program loading is typically done from a tape, a card reader, or a disk drive. Generally, the operating system was loaded from a disk drive; IPL from tape or cards was used only for diagnostics or for installing an operating system on a new computer.
- Emergency pull switch[62] (Emergency power off, EPO) sends an EPO signal to every I/O channel, then turns off power to the processor complex. Because EPO bypasses the normal sequencing of power down, damage can result, and the EPO control has a mechanical latch to ensure that a customer engineer inspects the equipment before attempting to power it back on.
- Power on[62] powers up all components of the processor complex and performs a system reset.
- Power off[62] initiates an orderly power-off sequence. Although the contents of storage are preserved, the associated storage keys may be lost.
- The Interrupt key[62] causes an external interruption with bit 25 set in the External Old PSW.
- The Wait light[62] indicates that the PSW has bit 14 (wait) set; the processor is temporarily halted but resumes operation when an interruption condition occurs.
- The Manual light[62] indicates that the CPU is in a stopped state.
- The System light[62] indicates that a meter is running, either due to CPU activity or due to I/O channel activity.
- The Test light[62] indicates that certain operator controls are active, when certain facilities, e.g., INSTRUCTION STEP, have been used by a Diagnose instruction or when abnormal thermal conditions exist. The details are model dependent.
- The Load light[62] is turned on by IPL and external start. It is turned off by loading the PSW from location 0 at the completion of the load process.
- The Load unit[63] controls provide the rightmost 11[r] bits of the device from which to perform an IPL.
- The Load Key[64] starts the IPL sequence.
- The Prefix Select Key Switch[64] selects whether IPL will use the primary prefix or the alternative prefix.
- The System-Reset Key[64] initiates a System Reset.
- The Stop Key[64] puts the CPU in a stopped state; channel programs continue running and interruption conditions remain pending.
- The Rate Switch[64] determines the mode in which the processor fetches instructions. Two modes are defined by the architecture:
- PROCESS
- INSTRUCTION STEP
- The Start Key[64] initiates instruction fetching in accordance with the setting of the Rate Switch.
- The Storage-Select Switch[65] determines the type of resource accessed by the Store Key and Display Key. Three selections are defined by the architecture:
- Main storage
- General registers
- Floating-point registers
- The Address Switches[65] specify the address or register number for the Store Key, Display Key and, on some models, the Set IC Key..
- The Data Switches[65] specify the data for the Store Key and, on some models, the Set IC Key.
- The Store Key[65] stores the value in the Data Switches as specified by the Storage-Select Switch and the Address Switches.
- The Display Key[65] displays the value specified by the Storage-Select Switch and the Address Switches.
- The Set IC=[65] sets the instruction address portion of the PSW from the Data Switches or the Address Switches, depending on the model.
- The Address-Compare Switches[65] select the mode of comparison and what is compared. Stop on instruction address compare is present on all models, but stop on data address compare is only present on some models.
- The Alternate-Prefix Light[65] is on when the prefix trigger is in the alternate state.
Optional features
[edit]Byte-aligned operands
[edit]On some models, e.g., the S/360-85,[9] the alignment requirements for some problem-state instructions were relaxed. There is no mechanism to turn off this feature, and programs depending on receiving a program check type 6 (alignment) on those instructions must be modified.
Decimal arithmetic
[edit]The decimal arithmetic feature provides instructions that operate on packed decimal data. A packed decimal number has 1-31 decimal digits followed by a 4-bit sign. All of the decimal arithmetic instructions except PACK and UNPACK generate a Data exception if a digit is not in the range 0-9 or a sign is not in the range A-F.
Direct Control
[edit]The Direct Control[66] feature provides six external signal lines and an 8-bit data path to/from storage.[67]
Floating-point arithmetic
[edit]The floating-point arithmetic feature provides 4 64-bit floating point registers and instructions to operate on 32 and 64 bit hexadecimal floating point numbers. The 360/85 and 360/195 also support 128 bit extended precision floating point numbers.
Interval timer
[edit]If the interval timer feature[2]: 17.1 is installed, the processor decrements the word at location 80 ('50'X) at regular intervals; the architecture does not specify the interval but does require that value subtracted make it appear as though 1 were subtracted from bit 23 300 times per second. The smaller models decremented at the same frequency (50 Hz or 60 Hz) as the AC power supply, but larger models had a high resolution timer feature. The processor causes an External interruption when the timer goes to zero.
Multi-system operation
[edit]Multi-system operation[68] is a set of features to support multi-processor systems, e.g., Direct Control, direct address relocation (prefixing).
Storage protection
[edit]If the storage protection feature[2]: 17-17.1 is installed, then there is a 4-bit storage key associated with every 2,048-byte block of storage and that key is checked when storing into any address in that block by either a CPU or an I/O channel. A CPU or channel key of 0 disables the check; a nonzero CPU or channel key allows data to be stored only in a block with the matching key.
Storage Protection was used to prevent a defective application from writing over storage belonging to the operating system or another application. This permitted testing to be performed along with production. Because the key was only four bits in length, the maximum number of different applications that could be run simultaneously was 15.
An additional option available on some models was fetch protection. It allowed the operating system to specify that blocks were protected from fetching as well as from storing.
Deviations and extensions
[edit]The System/360 Model 20 is radically different and should not be considered to be a S/360.
The System/360 Model 44 is missing certain instructions, but a feature allowed the missing instructions to be simulated in hidden memory thus allowing the use of standard S/360 operating systems and applications.
Some models have features that extended the architecture, e.g., emulation instructions, paging, and some models make minor deviations from the architecture. Examples include:
- The multisystem feature on the S/360-65 which modifies the behavior of the direct control feature and of the Set System Mask (SSM) instruction.[21]
- The System/360 Model 67-2 had similar, but incompatible, changes.[11]
Some deviations served as prototypes for features of the S/370 architecture.
See also
[edit]Notes
[edit]- ^ Twice the size of the later System/370
- ^ A specification of general register 0 yield a base address of zero rather than the register content.
- ^ a b c On a processor that complies with the S/360 architecture, the highest channel number is 6. Eleven bits are sufficient to identify the cuu, and seven bits are sufficient to provide masking of I/O interruptions. However, on a 360/67-2 with two 2846 channel controllers, channels are numbered 0-6 and 8-14;[11]: 15 similarly, the 360/195 had an extended channel feature[10]: 21 but numbered the channels 0 through 13.[10]: 25 I/O interruptions for Channel Controller 1 on the 360/67-2 were masked using control registers, and the 360/195 used bit 7 (Channel 6) of the System Mask as a summary mask bit for channels 6 and up. Interruptions from More than Seven Channels[12] describes the summary masking for additional channels, but other text in Principles of Operation still refers to a limit of 7 channels. Standard software supported channels 0-F.
- ^ Because the design of the S/360 occurred simultaneously with the development of ASCII, IBM's ASCII support did not match the standard that was ultimately adopted.
- ^ The S/360 literature does not use the terms fault or trap
- ^ a b On the 360/91,[20]: 15 360/95 and 360/195[10]: 14 a Program interruption may occur for multiple imprecise exceptions. The ILC in the Program Old PSW is 0, bits 26-31 are 0 and bits 16-27 are a mask indicating which exceptions occurred; there is no provision for reporting multiple occurrences of the same exception. Reporting of multiple imprecise exceptions is not part of the S/360 architecture.
- ^ a b c d There are 17 possible exceptions on the 360/67,[11]: 17 but page exception and segment exception are not part of the S/360 architecture; similarly, interruption code 18 ('0012'X) on a 360/65 multiprocessor is not part of the S/360 architecture.
- ^ The Specification bit is not used for imprecise interruptions on the 360/195
- ^ a b Not Used on 360/91
- ^ A PSW key of 0 matches any storage key.
- ^ Even though a timer expiration is an internal event, it causes an External interruption and for this reason, this interruption is usually referred to as a timer/external interruption.
- ^ Because of the limits on the channel number, S/360 and early S/370 software only used 12 bits to store device addresses.
- ^ But continuing with unrelated work.
- ^ The OS uses the attention index in a Unit Control Block (UCB) as an index into the attention table.
- ^ Also known as Suppress Incorrect Length Indication (SILI)
- ^ Or an equivalent automated facility.
- ^ Read with all modifier bits zero
- ^ There is an inconsistency, in that Interruptions from More than Seven Channels[12] allows for more channels.
References
[edit]- S360
- IBM System/360 Principles of Operation. Systems Reference Library (Eighth ed.). IBM. September 1968. A22-6821-7.
- ^ IBM (1964), IBM System/360 Principles of Operation (PDF), First Edition, A22-6821-0
- ^ a b c d e f g h i j k IBM (September 1968), IBM System/360 Principles of Operation (PDF), Eighth Edition, A22-6821-7 Revised by IBM (May 12, 1970), ibid., GN22-0354 and IBM (June 8, 1970), ibid., GN22-0361
- ^ a b IBM, IBM System/360 I/O Interface Channel to Control Unit Original Equipment Manufacturers' Information (PDF), Fifth Edition, A22-6843-3
- ^ S360, p. 15, Program Status Word.
- ^ S360, pp. 15 – , 16, Interruption.
- ^ S360, p. 77, Interruptions.
- ^ IBM Corporation (1974). IBM System/360 System Summary (PDF). p. 3-3. Retrieved July 16, 2017.
- ^ Reference Manual UNIVAC III Data Processing System (PDF), Sperry Rand Corporation, 1962, UT-2488
- ^ a b c IBM (June 1968), IBM System/360 Model 85 Functional Characteristics (PDF), SECOND EDITION, A22-6916-1
- ^ a b c d e IBM (August 1970), IBM System/360 Model 195 Functional Characteristics (PDF), Second Edition, GA22-6943-1
- ^ a b c d e f IBM (February 1972), IBM System/360 Model 67 Functional Characteristics (PDF), Third Edition, GA27-2719-2
- ^ a b PoOps, p. 121.4.
- ^ a b PoOps, p. 71.
- ^ PoOps, p. 77.
- ^ a b PoOps, pp. 78–79.
- ^ PoOps, pp. 79–80.1.
- ^ a b PoOps, pp. 80.1–81.
- ^ PoOps, pp. 81–82.
- ^ a b PoOps, pp. 82–83.
- ^ a b IBM (1968-03-18), IBM System/360 Model 91 Functional Characteristics (PDF), Third Edition, A22-6907-2
- ^ a b c d e IBM (September 1968), "Appendix A. Multiprocessing System", IBM System/360 Model 65 Functional Characteristics (PDF), Fourth Edition, pp. 30–34, A22-6884-3
- ^ a b c d e f g h PoOps, p. 79.
- ^ a b PoOps, pp. 79–80.
- ^ a b c d e f g h i j k l m n o p q r PoOps, p. 80.
- ^ a b PoOps, p. 80.1.
- ^ PoOps, p. 81.
- ^ I/O Channel Interface (PDF) (Report). National Technical Information Service. July 29, 1983. FIPS PUB 60-2. Retrieved May 18, 2023.
- ^ a b c PoOps, pp. 116–118.
- ^ a b PoOps, pp. 116–117.
- ^ a b c d PoOps, p. 117.
- ^ a b PoOps, pp. 117–118.
- ^ a b c d e f g h PoOps, p. 118.
- ^ a b c PoOps, pp. 113–116.
- ^ a b PoOps, p. 113.
- ^ a b PoOps, pp. 113–114.
- ^ a b PoOps, p. 114.
- ^ a b PoOps, pp. 114–115.
- ^ a b c d PoOps, p. 115.
- ^ a b PoOps, pp. 115–116.
- ^ a b PoOps, p. 116.
- ^ PoOps, p. 100.
- ^ a b PoOps, pp. 100–101.
- ^ PoOps, pp. 99–100, 101–105.
- ^ a b PoOps, pp. 106–107.
- ^ PoOps, pp. 107–108.
- ^ PoOps, pp. 105–106.
- ^ a b PoOps, p. 105.
- ^ PoOps, pp. 101–103.
- ^ PoOps, pp. 101, 103.
- ^ PoOps, pp. 99–100.
- ^ PoOps, pp. 103–104.
- ^ PoOps, pp. 104–105.
- ^ a b c d PoOps, p. 119.
- ^ PoOps, pp. 113–118.
- ^ a b PoOps, p. 120.
- ^ S360, pp. 93–98, Control of Input/Output Devices.
- ^ S360, pp. 94–95, Start I/O.
- ^ S360, pp. 95–96, Test I/O.
- ^ S360, pp. 96–98, Halt I/O.
- ^ S360, p. 98, Test Channel.
- ^ PoOps, p. 123.
- ^ a b c d e f g h i PoOps, p. 124.
- ^ PoOps, pp. 124–125.
- ^ a b c d e f PoOps, p. 125.
- ^ a b c d e f g h PoOps, p. 126.
- ^ PoOps, p. 17.1.
- ^ IBM, IBM System/360 Direct Control and External Interrupt Features Original Equipment Manufacturers' Information (PDF), Third Edition, A22-6845-2
- ^ PoOps, pp. 17.1–18.
Further reading
[edit]- Prasad, N.S. (1989). IBM Mainframes. McGraw-Hill. ISBN 0070506868. — Chapter 3 (pp. 41–110) describes the System/360 architecture.
- Greiner, Dan (August 10, 2011). "IBM z/Architecture CPU Features - A Historical Perspective" (PDF). Evolution of The IBM Mainframe Architecture. SHARE 117 in Orlando. SHARE. Session 9220. Retrieved February 7, 2023.
External links
[edit]- Introduction to IBM System/360 Architecture (Student Text)
IBM System/360 architecture
View on GrokipediaOverview and Design Principles
Core Architectural Goals
The IBM System/360 was announced on April 7, 1964, as a revolutionary family of compatible computers designed to span a wide range of performance levels, from small-scale to large-scale systems, thereby unifying IBM's previously fragmented product lines that included incompatible scientific and commercial machines.[1] This ambitious project, led by chief architect Gene Amdahl and his team, aimed to replace diverse architectures such as the IBM 1401 for business data processing and the IBM 7090 for scientific computing, which had created significant customer challenges in software migration and maintenance.[6] The design effort, spanning the early 1960s, sought to establish a single architectural foundation that would support both workloads efficiently, marking a pivotal shift toward enterprise computing scalability.[7] Central to the System/360's goals was achieving binary compatibility across all models, enabling software developed for one machine to run unchanged on others without recompilation, a innovation that facilitated cost-effective scaling for users as their needs grew.[8] The architecture introduced byte-addressable main storage, allowing flexible data access at the 8-bit byte level rather than word-aligned boundaries, which supported a uniform data representation versatile for both scientific floating-point operations and commercial decimal arithmetic.[8] This uniformity extended to a cohesive instruction set that balanced efficiency for diverse applications, eliminating the silos of prior systems.[8] Key innovations included provisions for emulating legacy IBM systems, such as the 1401 and 7090, through a combination of hardware-assisted and software-based mechanisms, ensuring a smooth transition for existing customers without immediate data or program loss.[9] The overall objective was to create a "family" of machines sharing the same instruction set and data formats, promoting long-term software investment protection and enabling IBM to dominate the emerging mainframe market.[8] While virtual memory was not part of the base architecture, the design's modular storage approach laid groundwork for future extensions, emphasizing extensibility as a core principle.[8]Compatibility Across Models
A fundamental aspect of the IBM System/360 architecture was its provision for strict upward and downward compatibility across all models in the family, ensuring that object programs written for any model could execute unchanged on any other model, provided the target system possessed the necessary storage capacity, I/O devices, and optional features.[8] This compatibility operated at the program bit level, meaning identical inputs produced identical outputs regardless of the model's performance differences, as long as the program did not rely on model-specific timing or unavailable facilities.[10] For instance, programs developed for the low-end Model 20 could run unmodified on high-end models like the Model 91, facilitating scalability for users upgrading hardware without software rewrites.[8] Central to this compatibility was the Basic Instruction Set (BIS), a common core of instructions implemented uniformly across all models, encompassing fixed-point arithmetic, logical operations, branching, and data movement functions such as load (LR), add (AR), branch on condition (BC), and move characters (MVC).[10] The BIS formed the mandatory foundation, while optional features like decimal arithmetic (e.g., add decimal, AP) and floating-point operations (e.g., load floating-point, LER) were available only on advanced models but did not disrupt core compatibility when absent, as programs invoking them would simply raise an operation exception.[10] This design allowed the architecture to support a wide range of applications while maintaining a unified programming interface.[8] To bridge the gap with prior IBM systems, certain System/360 models incorporated emulation techniques via built-in microcode and optional hardware features, enabling execution of legacy programs from systems like the IBM 704 and 709 series.[11] For example, the Model 65 and similar configurations used microcode to emulate 7090 instructions, allowing customers to migrate scientific workloads without immediate recompilation.[11] These emulations were integrated into the control unit, preserving the System/360's architectural uniformity while supporting transitional use cases.[10] The architecture's scalability was demonstrated by performance ratios spanning orders of magnitude, from the Model 30's approximately 0.035 million instructions per second (MIPS) to the Model 91's 16.6 MIPS, all while upholding the same instruction set and compatibility standards.[12][13] This range, achieved through variations in cycle times, pipeline depths, and memory speeds rather than architectural changes, underscored the design's emphasis on a single, extensible platform.[8]Memory and Addressing
Main Storage Organization
The IBM System/360 main storage is organized as a byte-addressable memory system, where each 8-bit byte position is assigned a unique address ranging from 0 to the maximum capacity minus one.[10] This design allows for flexible data placement, with storage locations accessed in ascending order during operations. The basic storage units include the halfword (2 consecutive bytes or 16 bits), the fullword (4 consecutive bytes or 32 bits), and the doubleword (8 consecutive bytes or 64 bits), which align on natural boundaries to optimize access efficiency.[10] Main storage in the System/360 employs magnetic core technology, a reliable non-volatile medium composed of small ferrite cores wired into matrices for high-speed random access.[10] Capacities vary significantly across models to support diverse computational needs, starting at a minimum of 4 KB for the Model 20 and extending up to 8 MB for high-end configurations like the Model 85.[14][15] For example, the Model 20 typically supports increments from 4 KB to 32 KB, while larger models such as the 85 integrate multiple storage units to achieve megabyte-scale totals, enabling handling of complex workloads without frequent external I/O. Access to main storage occurs through dedicated cycles independent of CPU instruction execution, supporting fetches of fullwords or halfwords as required by the operation.[10] When a halfword access is specified, the system retrieves a fullword from storage but processes only the relevant portion, ensuring alignment and parity checks on the entire fetched unit. The base architecture lacks an integrated cache, relying instead on direct core access for all reads and writes, though subsequent models introduced buffering enhancements.[10] Storage protection is enforced through 4-bit keys assigned to fixed-size blocks of 2K bytes, to control access and prevent unauthorized modifications.[10] Each block's key is compared against the protection key in the current Program Status Word (PSW) during store operations; a mismatch triggers a protection exception, safeguarding multitasking environments. Keys are managed via specialized instructions, such as Set Storage Key, and stored in dedicated locations outside the main addressable space.[10] This mechanism divides the entire storage into protected segments, with the number of blocks scaling with total capacity—for instance, an 8 MB system would feature 4096 such key-protected units.[10]Addressing Modes and Limits
The IBM System/360 employs 24-bit real addressing, allowing access to a maximum of 16 megabytes (2^24 bytes) of main storage, with addresses treated as unsigned binary integers that wrap around from 16,777,215 to 0 if overflow occurs during computation.[10] This design supports direct, contiguous addressing without virtual memory mechanisms in the base architecture, ensuring straightforward memory reference while limiting the addressable space to the physical storage capacity of the system model.[10] An addressing exception is generated if an operand extends beyond the available storage or model-specific limits, providing a mechanism for error detection.[10] The primary addressing mode in the System/360 is base-displacement addressing, which computes effective addresses by adding the contents of a base register, an optional index register, and a 12-bit displacement field from the instruction.[10] In this scheme, the base and index registers contribute their low-order 24 bits as unsigned values, while the displacement provides a relative offset ranging from 0 to 4,095 bytes, enabling efficient access to data structures like arrays or tables without requiring full 24-bit addresses in every instruction.[10] Instructions in formats such as RX (register-and-indexed-storage) specify these components via 4-bit fields for the base (B2), index (X2), and a register operand (R1), with the effective address formed as base + index + displacement, ignoring any overflow beyond 24 bits.[10] This mode facilitates modular programming by allowing base registers to hold relocation constants for position-independent code.[10] Addressing operations rely on 16 general-purpose registers (GPRs), numbered 0 through 15, each 32 bits wide, where the low-order 24 bits serve as the address value during computation.[10] These registers can function as base, index, or accumulator, with even-numbered pairs (e.g., 0 and 1) optionally coupled for 64-bit double-precision operations, though addressing typically uses the 24-bit portion.[10] Register 0, when used as a base or index, is treated as containing zero, optimizing certain addressing scenarios without explicit loading.[10] The current instruction address is specified in the Program Status Word (PSW), a 64-bit control register where bits 8 through 31 hold the 24-bit address of the leftmost byte of the next instruction to execute.[10] This address is updated sequentially after each instruction fetch or modified by branch instructions, ensuring continuous program execution within the 24-bit space.[10]Data Representation
Basic Data Types
The IBM System/360 architecture employs binary integers as a fundamental data type for fixed-point arithmetic, represented in two's complement notation for signed values, with the sign bit occupying the leftmost (highest-order) position—0 indicating positive or zero, and 1 indicating negative.[10] These integers are available in varying lengths to support different precision needs, with the basic unit of storage being an 8-bit byte.[10] Binary integers come in four primary sizes: 1-byte (8 bits), suitable for small signed values ranging from -128 to +127; 2-byte halfwords (16 bits), handling signed values from -32,768 to +32,767; 4-byte fullwords (32 bits), accommodating signed values from -2,147,483,648 to +2,147,483,647; and 8-byte doublewords (64 bits), handling signed values from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807.[10] For unsigned operations, these same formats are treated as logical quantities without sign interpretation, enabling bitwise manipulations rather than arithmetic on magnitudes.[10] Negative values in two's complement form invert all bits of the positive equivalent and add 1, ensuring seamless arithmetic carry propagation across the sign bit.[10]| Size | Bits | Signed Range (Two's Complement) | Typical Use Case |
|---|---|---|---|
| Byte | 8 | -128 to +127 | Small counters or flags |
| Halfword | 16 | -32,768 to +32,767 | Medium-precision indices |
| Fullword | 32 | -2,147,483,648 to +2,147,483,647 | General arithmetic and addresses |
| Doubleword | 64 | -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | High-precision arithmetic and extended addresses |
Character and Packed Formats
The IBM System/360 architecture employs the Extended Binary Coded Decimal Interchange Code (EBCDIC) as its primary 8-bit character encoding scheme, supporting 256 distinct codes for alphanumeric and control characters in commercial data processing applications.[10] Each EBCDIC character occupies one byte, with bit positions 0 through 7 defining the code; for instance, the null character is represented as 0000 0000 in binary, while the blank is 0100 0000, and numeric digits 0-9 span 1111 0000 to 1111 1001 when using the preferred zone of 1111.[10] This format ensures compatibility with character-sensitive input/output devices, such as printers and card readers, and facilitates direct manipulation of text data without requiring binary-to-decimal conversions for display purposes.[10] For numeric data in business-oriented tasks, the System/360 supports packed decimal format, which encodes decimal digits using binary-coded decimal (BCD) nibbles to optimize storage efficiency.[10] In this format, each byte holds two 4-bit digits (ranging from 0000 to 1001 for 0-9), except for the low-order byte, where the rightmost nibble indicates the sign—typically 1100 for positive and 1101 for negative in EBCDIC mode.[10] Fields can vary from 1 to 16 bytes, accommodating up to 31 digits plus the sign, and are aligned on byte boundaries for operands in decimal arithmetic operations.[10] This structure allows for compact representation of large decimal numbers, such as financial amounts, while preserving exact decimal precision without the rounding errors possible in binary formats.[10] Zoned decimal format provides a human-readable alternative for decimal numbers, particularly suited for compatibility with legacy punched-card systems and direct I/O handling.[10] Each digit occupies a full 8-bit byte, consisting of a 4-bit zone (usually 1111 in EBCDIC) in the left nibble and a 4-bit BCD digit in the right nibble; the sign is encoded in the zone nibble of the low-order byte, with positive indicated by 1010 (A), 1100 (C), or 1111 (F) and negative by 1011 (B), 1101 (D), or 1110 (E); preferred in EBCDIC mode are 1111 for positive and 1110 for negative.[10] This one-digit-per-byte arrangement, exemplified by a number like 123 stored as three bytes with zones F1, F2, F3 (in hexadecimal), enables straightforward printing and input without additional translation, though it consumes more storage than packed decimal.[10] To manage these formats seamlessly, the System/360 includes dedicated conversion instructions that handle transformations between character, zoned, and packed representations, often implicitly during arithmetic operations like addition or multiplication to ensure operands are in the appropriate form.[10] For example, the PACK instruction converts a zoned decimal field to packed decimal by right-to-left processing, inserting leading zeros if needed, while UNPACK performs the reverse to produce zoned output for display; similarly, CVB and CVD enable radix shifts to and from binary integers for mixed computations.[10] These mechanisms, along with editing instructions like EDIT for formatting packed data into zoned patterns, support efficient data interchange in commercial environments without manual intervention.[10]| Format | Byte Structure | Nibble Details | Maximum Size | Primary Use Case |
|---|---|---|---|---|
| EBCDIC | 1 character per 8 bits | N/A (full byte codes) | 256 codes | Alphanumeric text and I/O |
| Packed Decimal | 2 digits per 8 bits (except sign) | 4 bits per digit; sign in low-order | 31 digits + sign | Efficient decimal arithmetic |
| Zoned Decimal | 1 digit per 8 bits | 4-bit zone + 4-bit digit; sign in zone | Variable (1 byte/digit) | Human-readable I/O and cards |
Instruction Set
Instruction Lengths and Formats
The IBM System/360 architecture employs instructions of fixed lengths—2, 4, or 6 bytes—all multiples of 2 bytes to ensure halfword alignment in main storage.[10] The length of an instruction is determined by the first two bits of its 8-bit operation code: bits 0-1 equal to 00 indicate a 2-byte instruction, 01 or 10 indicate a 4-byte instruction, and 11 indicates a 6-byte instruction.[10] This design avoids variable-length opcodes, with all operand fields occupying fixed bit positions within the instruction to facilitate efficient decoding by the central processing unit.[10] The RR (register-to-register) format is the shortest at 2 bytes and supports operations between general registers without memory access. It consists of an 8-bit opcode in bits 0-7, a 4-bit first register designation (R1) in bits 8-11, and a 4-bit second register designation (R2) in bits 12-15.[10] This compact structure enables rapid arithmetic and logical operations directly on register contents, such as addition or branching based on register conditions.[10] Most instructions use the 4-byte formats, including RX and RS, which incorporate memory addressing via base-index-displacement mechanisms. The RX (register-and-indexed-storage) format specifies a register operation on a memory operand: bits 0-7 hold the opcode, bits 8-11 the register (R1), bits 12-15 an optional index register (X2, zero if unused), bits 16-19 a base register (B2), and bits 20-31 a 12-bit displacement (D2) for effective address computation.[10] Similarly, the RS (register-and-storage) format, also 4 bytes, handles operations between registers and storage or between two storage locations: it shares the opcode and R1 fields with RX but uses bits 12-15 for a second register or mask (R3), followed by B2 and D2 as in RX.[10] These formats support a wide range of load, store, and computational instructions by combining register immediacy with flexible memory addressing.[10] The 6-byte format, primarily SS (storage-and-storage), accommodates operations between two memory operands, such as decimal arithmetic or data movement. It extends the structure with two full address specifications: bits 0-7 for the opcode, bits 8-11 for the length of the first operand (L1, 0-15 indicating 1-16 bytes), bits 12-15 for the length of the second operand (L2, similarly), bits 16-19 for the first base register (B1), bits 20-31 for the first displacement (D1), bits 32-35 for the second base register (B2), and bits 36-47 for the second displacement (D2).[10] This longer format ensures precise control over multi-operand storage interactions while maintaining the architecture's uniform addressing principles.[10]| Format | Length (Bytes) | Key Fields | Bit Positions | Primary Use |
|---|---|---|---|---|
| RR | 2 | Opcode, R1, R2 | 0-7 (Opcode), 8-11 (R1), 12-15 (R2) | Register-to-register operations |
| RX | 4 | Opcode, R1, X2, B2, D2 | 0-7 (Opcode), 8-11 (R1), 12-15 (X2), 16-19 (B2), 20-31 (D2) | Register to indexed storage |
| RS | 4 | Opcode, R1, R3, B2, D2 | 0-7 (Opcode), 8-11 (R1), 12-15 (R3), 16-19 (B2), 20-31 (D2) | Register and storage operations |
| SS | 6 | Opcode, L1, L2, B1, D1, B2, D2 | 0-7 (Opcode), 8-11 (L1), 12-15 (L2), 16-19 (B1), 20-31 (D1), 32-35 (B2), 36-47 (D2) | Storage-to-storage operations |
Basic Instruction Types
The IBM System/360 instruction set encompasses approximately 100 to 150 base instructions, forming the core of its computational capabilities and enabling a wide range of program execution without reliance on optional features.[10] These instructions are functionally categorized to support essential operations such as data movement, numerical computation, bitwise manipulation, and control flow, ensuring compatibility across the architecture's diverse models.[10] This categorization reflects the system's design philosophy of providing a uniform, general-purpose set of operations that abstract hardware differences while maintaining efficiency in processing fixed-point data and addresses.[10] Load and store instructions handle the transfer of data between the 16 general-purpose registers and main storage, serving as the primary mechanism for accessing memory in a load-store architecture.[10] Key examples include the Load (L) instruction, which retrieves a full word from a specified storage location into a target register, and the Store (ST) instruction, which writes the contents of a register to storage.[10] Variants such as Load Halfword (LH) and Store Halfword (STH) operate on 16-bit fields, while Load Multiple (LM) and Store Multiple (STM) allow efficient bulk transfers across multiple consecutive registers, optimizing data handling in loops or subroutine calls.[10] Additional instructions like Load Address (LA), Insert Character (IC), and Store Character (STC) support address computation and byte-level operations, essential for indexing and character processing.[10] Arithmetic instructions perform fixed-point operations on integer data, supporting addition, subtraction, multiplication, and division to enable precise numerical computations within the 32-bit register framework.[10] The Add (A) instruction computes the sum of a register value and a storage operand, placing the result in the register and updating condition codes to indicate overflow or equality.[10] Similarly, Subtract (S) yields the difference, while Multiply (M) produces a double-word product from two 32-bit operands, and Divide (D) computes both quotient and remainder.[10] Halfword variants like Add Halfword (AH) extend these to shorter operands, facilitating compact arithmetic on addresses or small integers without sign extension issues.[10] These operations set condition codes that can trigger branches, integrating arithmetic seamlessly with program control.[10] Logical instructions execute bitwise operations and comparisons on binary data, treating operands as unsigned bit patterns to support masking, merging, and equality checks.[10] The AND (N) instruction performs a bitwise conjunction between a register and storage operand, useful for clearing specific bits; OR (O) merges bits by setting them where either operand has a 1; and Exclusive OR (X) toggles bits where operands differ, commonly employed for bit flipping or parity calculations.[10] The Compare (C) instruction evaluates algebraic or logical equality between operands, setting condition codes without altering data, which is fundamental for decision-making in algorithms.[10] These instructions, like their arithmetic counterparts, update condition codes to reflect results such as zero, greater than, or less than, enabling conditional execution paths.[10] Branch instructions manage program flow by altering the instruction address based on conditions, counters, or direct specification, providing the means for loops, jumps, and subroutine invocation.[10] The Branch on Condition (BC) instruction tests the current condition code against a mask and branches to a target address if the condition matches, supporting flexible tests for equality, overflow, or carry.[10] Unconditional variants include Branch and Link (BAL), which saves the return address in a register for subroutine calls, while Branch on Count (BCT) decrements a register and branches if non-zero, ideal for loop control.[10] Index-based branches like Branch on Index High (BXH) and Branch on Index Low or Equal (BXL) compare register pairs against limits, facilitating array traversal and bounds checking in a single operation.[10] Together, these instructions ensure deterministic control flow, with condition codes from prior operations serving as the basis for decisions.[10]Processor Control
Program Status Word Structure
The Program Status Word (PSW) serves as the primary control register in the IBM System/360 central processing unit (CPU), encapsulating the essential state information required for instruction execution, status switching, and interruption handling. It maintains the address of the next instruction to be executed, along with indicators for the CPU's operational mode, interruption permissions, and the results of prior operations. The PSW is integral to the processor's runtime behavior, enabling seamless transitions between program execution and exceptional conditions without losing context. The architecture supports single-PSW mode for basic operation and double-PSW mode (with storage protection feature) for separate supervisor and problem state PSWs, enhancing protection by isolating user and system contexts.[10] The PSW is an 8-byte (64-bit) doubleword structure stored in main storage and addressable as such. During normal operation, a single PSW governs the CPU state; however, in single- and double-PSW modes, interruptions involve storing the current (old) PSW at a designated location and loading a new PSW to resume or switch execution contexts. This mechanism preserves the full CPU status, including the instruction address and mode indicators, facilitating recovery and continuation after events like program exceptions or external signals.[10] The PSW's fields are precisely defined by bit positions, as outlined in the following table, which details their roles in controlling execution and protection:| Bit Positions | Field Name | Description |
|---|---|---|
| 0-7 | System Mask | An 8-bit mask controlling interruptions; bit 0 masks I/O interruptions from all channels, and bits 1-7 mask external interruptions for classes 1-7.[10] |
| 8-11 | Protection Key | A 4-bit value (0-15) used for storage protection; it must match the key associated with accessed storage locations to authorize operations. If the protection feature is not installed, protection is not enforced, and the key should be set to 0.[10] |
| 12 | ASCII Mode (A) | A 1-bit indicator; set to 1 for ASCII mode (generating ASCII zone codes in decimal results) or 0 for EBCDIC mode.[10] |
| 13 | Machine-Check Mask (M) | A 1-bit mask; set to 1 to enable machine-check interruptions or 0 to suppress them in response to hardware malfunctions.[10] |
| 14 | Wait State (W) | A 1-bit flag; set to 1 when the CPU is in a wait state (halted but responsive to interruptions) or 0 for active execution.[10] |
| 15 | Problem State (P) | A 1-bit indicator for CPU mode; set to 1 for problem state (user mode, restricting privileged instructions) or 0 for supervisor state (full access). This bit, in conjunction with the protection key and program mask, enforces the supervisor/user distinction.[10] |
| 16-31 | Interruption Code | A 16-bit code specifying the cause of an interruption, such as program exceptions or I/O completion (e.g., 00000000 for certain I/O classes).[10] |
| 32-33 | Instruction Length Code (ILC) | A 2-bit code indicating the length of the interrupted instruction: 00 = length unavailable/not precise, 01 = 1 halfword, 10 = 2 halfwords, 11 = 3 halfwords.[10] |
| 34-35 | Condition Code (CC) | A 2-bit value (0-3) summarizing the outcome of the most recent instruction: 0 for equal or zero result, 1 for less than or negative, 2 for greater than or positive, and 3 for overflow or special conditions (e.g., in comparisons, 0 indicates equality, 1 low, and 2 high). These codes enable conditional branching and status checks.[10] |
| 36-39 | Program Mask | A 4-bit mask for program exceptions: bit 36 for fixed-point overflow, bit 37 for decimal overflow, bit 38 for exponent underflow, and bit 39 for loss of significance; each bit set to 1 enables the corresponding interruption. This mask, alongside the system mask, modulates exception handling in supervisor or user modes.[10] |
| 40-63 | Instruction Address | A 24-bit address (right-justified) pointing to the leftmost byte of the next instruction to execute; it advances sequentially or via branching and is not validated for storage availability until fetched.[10] |
Operator Facilities
The operator console in the IBM System/360 served as the primary interface for system operators to monitor, control, and communicate with the machine during operation and maintenance. It typically consisted of the IBM 1052 Printer-Keyboard, a modified Selectric typewriter integrated with the system control panel, which allowed operators to enter commands via the keyboard and receive printed output for system messages and status updates.[10][16] Alternatively, the IBM 2260 Display Station could be used as a console option, providing a cathode-ray tube for visual display of information and keyboard input, connected via the 2848 Display Control Unit, which supported up to 24 terminals in clustered configurations.[17] These consoles facilitated essential tasks such as initiating system startups, responding to interruptions, and issuing control commands, with the 1052 model featuring keys like Request to signal commands and lights such as Attention to indicate pending system requests.[18] Key control instructions accessible via the operator console enabled direct manipulation of system state. The Load Program Status Word (LPSW) instruction, a privileged operation, loaded a new Program Status Word (PSW) from a specified doubleword location in main storage, updating the CPU's instruction address, condition code, and program mode while masking interruptions until completion; during initial loading, it fetched the PSW from location 0.[10] During interruptions, the current PSW and related status (e.g., Channel Status Word at location 64 for I/O, old PSW at 48 for machine-check) are automatically stored at fixed low main storage locations, allowing operators to diagnose and recover from errors via console display and alteration switches.[10] Additionally, the Set Clock (SCK) instruction loads the interval timer from a fullword at the specified operand address in main storage, which decrements at the power-line frequency (50 or 60 Hz) to provide timing for interruptions; operators can set it through software for synchronization purposes.[10] The Initial Program Load (IPL) process was a core operator facility for bootstrapping the system, initiated by setting the Load Unit switches on the control panel to select an input device such as a card reader, tape drive, or disk unit, followed by pressing the Load key.[10][16] This triggered the reading of the first 24 bytes (six words) from the device into main storage locations 0-23: locations 0-7 for the initial PSW, 8-15 for the first channel command word (CCW), and 16-23 for the second CCW, after which the CPU executed from the PSW address to load the operating system nucleus.[10][18] The IPL also reset the system, cleared storage and registers, and established the prefix value, with success indicated by the Wait light extinguishing and a READY message on the console.[16] System maintenance and safety were supported by reset mechanisms and emergency controls on the operator console. The System Reset key, when pressed after stopping the CPU, reset the processor, channels, and online I/O devices, terminating pending operations, clearing interruption requests, and potentially correcting parity errors in the PSW and registers while placing the CPU in a stopped state.[10][16] For immediate halting in critical situations, the Emergency Pull switch provided a latching power-off function, disconnecting all power beyond the entry terminals across connected units and requiring customer engineering intervention to restore, ensuring safe shutdown without partial operation.[10][16] These features, combined with display and store switches for examining storage locations, enabled operators to perform diagnostics and restarts efficiently from the console.[10]Interruption Mechanisms
Interruption Classes
The IBM System/360 architecture defines five primary classes of interruptions to manage asynchronous events and exceptional conditions, enabling the CPU to transition to appropriate handler routines while preserving the prior execution state. These classes are machine-check, program, supervisor-call, external, and input/output (I/O), each designed to address distinct types of system events with a structured response mechanism. This classification ensures orderly processing by assigning a fixed priority order, where interruptions of higher priority preempt those of lower priority, preventing conflicts in concurrent event handling.[10] The priority sequence is rigidly defined as machine-check (highest), followed by program and supervisor-call (mutually exclusive at the same level), external, and I/O (lowest). This ordering guarantees that critical hardware faults, such as those detected in the machine-check class, are addressed before less urgent events like I/O completions. For instance, if multiple interruptions are pending, the system resolves them in this descending priority, allowing only one to be serviced at a time until cleared. Masking capabilities further refine this by permitting selective enablement or disablement of classes via bits in the Program Status Word (PSW), such as bit 13 for machine-check interruptions or the interruption mask bits 0-7 in the PSW (bits 0-6 for I/O, bit 7 for external), providing software control over interruption responsiveness without altering hardware priorities.[10][10][10] Upon occurrence, all interruption classes follow a uniform handling procedure to maintain system integrity: the current PSW, which encapsulates the instruction address and condition code, is stored as the "old PSW" at a class-specific fixed location in low storage (e.g., locations 48 for machine-check old PSW), and a "new PSW" is fetched from another designated low-storage address (e.g., location 112 for machine-check new PSW) to initiate the interruption routine. This vectoring mechanism uses predefined memory slots—32 for supervisor-call old PSW and 96 for new PSW, 40 and 104 for program, 24 and 88 for external, and 56 and 120 for I/O—ensuring rapid, deterministic dispatch without reliance on variable addressing. The old PSW preserves the interrupted program's context for potential resumption, while the new PSW sets the handler's execution environment, including key and interruption masks, typically in supervisor state for privileged operations.[10][10][10]Program and Supervisor Interruptions
In the IBM System/360 architecture, program interruptions arise from exceptional conditions encountered during the execution of instructions, such as arithmetic overflows, invalid operands, or access violations, which halt normal program flow to allow error detection and handling by the supervisor.[19] These interruptions are distinct from hardware-induced events and are triggered solely by software-related anomalies, with the system storing diagnostic information in the old Program Status Word (PSW) for subsequent analysis.[19] Supervisor call interruptions, on the other hand, are deliberately invoked by the SVC instruction to request operating system services, enabling a controlled transition from problem-state execution to supervisor routines without implying an error.[19] Program interruptions encompass several categories, primarily related to arithmetic operations, data validity, and access controls, each assigned a unique code in the low-order bits of the old PSW (bits 16-31).[19] The architecture defines eight primary types with codes 1 through 8, plus codes 10 through 15 for decimal and floating-point specifics; handling varies by type, with options for suppression (instruction aborted early), termination (partial execution with unpredictable results), or completion (full execution, possibly truncated).[19] For instance, fixed-point overflow (code 8) occurs when an arithmetic result exceeds the register capacity; the result is always truncated with condition code 3, and it can be masked via PSW bit 36 (set to 0) to suppress the interruption after completion.[19] Decimal overflow (code 10) similarly signals an excessively large result in decimal operations, maskable by PSW bit 37, emphasizing the system's design to balance precision with performance in business-oriented computations.[19] Protection exceptions (code 4) detect storage access violations, such as key mismatches, ensuring data integrity in multiprogrammed environments.[19] The following table enumerates the core program interruption types (codes 1-8), their causes, and handling behaviors, drawn from the system's foundational specifications:| Code (Decimal) | Binary Representation | Type | Cause Example | Handling Mode | Maskable? (PSW Bit) |
|---|---|---|---|---|---|
| 1 | 00000000 00000001 | Operation Exception | Unassigned or invalid opcode | Suppressed | No |
| 2 | 00000000 00000010 | Privileged-Operation Exception | Execution of privileged instruction in problem state | Suppressed | No |
| 3 | 00000000 00000011 | Execute Exception | Nested EXECUTE instruction | Suppressed | No |
| 4 | 00000000 00000100 | Protection Exception | Storage protection key mismatch or invalid access | Suppressed/Terminated | No |
| 5 | 00000000 00000101 | Addressing Exception | Computed address outside storage bounds | Terminated/Suppressed | No |
| 6 | 00000000 00000110 | Specification Exception | Invalid operand specification (e.g., misaligned fields) | Suppressed | No |
| 7 | 00000000 00000111 | Data Exception | Invalid data format (e.g., decimal sign error) | Terminated | No |
| 8 | 00000000 00001000 | Fixed-Point Overflow | Arithmetic result exceeds register capacity | Completed (truncated result always; interrupt if bit=1) | Yes (36) |
External and Machine Check Interruptions
External interruptions in the IBM System/360 architecture provide a mechanism for the central processing unit (CPU) to respond to signals from external sources, such as the timer, interrupt key on the operator's console, or external signals from devices.[10] These interruptions occur only after the completion of the current instruction and when the system mask bit (bit 7 of the program status word, or PSW) is set to one.[10] Upon occurrence, the current PSW is stored as the external old PSW at absolute storage location 24, and a new PSW is fetched from location 88 to initiate the interruption handler.[10] The interruption code, placed in bits 16-31 of the old PSW (with bits 16-23 zero and bits 24-31 indicating the source, such as bit 24 for the timer or bit 25 for the interrupt key), identifies the specific source.[10] External interruptions hold the third highest priority among interruption classes, following machine-check and program interruptions.[10] Machine-check interruptions address hardware malfunctions within the system, including parity errors in main storage or registers, storage alteration due to unauthorized or erroneous changes, and system damage from faults like low power supply or equipment failures.[10] These interruptions, which have the highest priority, terminate the execution of the current instruction immediately upon detection and initiate a diagnostic scan of the CPU state, storing relevant information starting at absolute storage location 128.[10] The current PSW is saved as the machine-check old PSW at location 48, often with an interruption code of zero, while a new PSW is fetched from location 112 to enter the handler routine.[10] Machine checks are divided into subclasses, primarily system damage—indicating severe hardware integrity compromises—and storage alteration, which involves detectable errors in data or instructions without broader system failure.[10] In the base System/360 architecture, these interruptions provide diagnostic data but are generally non-recoverable, often resulting in system halt or requiring manual intervention.[10] Masking for external interruptions is controlled solely by the system mask bit in the PSW; if set to zero, any pending external signals are ignored until the mask is enabled.[10] For machine-check interruptions, the machine-check mask bit (bit 13 of the PSW) determines response: when zero, the malfunction is suppressed, allowing the instruction to complete with potentially unpredictable results; when one, the interruption proceeds.[10] Recovery options are limited in the base design—external interruptions can be cleared via system reset, but machine checks typically demand initial program load (IPL) or operator action to restore functionality, as the architecture prioritizes containment of side effects over automatic repair.[10] The timer, an optional feature for external interruptions, briefly references interval timing but is detailed in multi-system and timing options.[10]Input/Output Architecture
Channel Subsystem Overview
The channel subsystem in the IBM System/360 architecture provides a decoupled mechanism for input/output (I/O) operations, allowing the central processing unit (CPU) to initiate data transfers while independent hardware components manage the execution autonomously. Channels function as specialized processors dedicated to I/O tasks, connecting main storage and the CPU to control units and peripheral devices. This design enables overlapping of I/O and computational activities, improving system efficiency by relieving the CPU from direct involvement in data movement, buffering, parity checking, and status reporting.[10] System/360 channels are classified into three primary types, each optimized for different device characteristics and throughput requirements. Byte multiplexer channels support multiple low-speed devices, such as card readers or printers, by interleaving single-byte transfers in multiplex mode, allowing simultaneous operations across devices. Block multiplexer channels extend this capability for medium-speed devices by transferring data in larger blocks, supporting both multiplex mode for interleaving and burst mode for uninterrupted high-volume transfers. Selector channels, in contrast, dedicate the full channel bandwidth to a single high-speed device, such as tape drives or disks, operating exclusively in burst mode to maximize transfer rates without interruption. Channel priority is assigned by address, with lower-numbered channels (e.g., channel 1) receiving precedence in contention scenarios.[10][14] Data transfers within the channel subsystem employ chaining mechanisms to sequence operations efficiently without repeated CPU intervention. Command chaining links multiple commands into a single I/O sequence, where the channel fetches subsequent channel command words (CCWs) upon device-end signals, enabling complex operations like file reads across commands. Data chaining, meanwhile, allows contiguous data movement across non-adjacent main storage areas by chaining CCWs that specify transfer counts and addresses, streamlining large data handling. These modes are controlled by flags in the CCWs, such as the chain command (CC) and chain data (CD) bits, which dictate whether the channel continues processing after completing a current word.[10] Subchannels serve as logical pathways within a channel, each managing the address, status, and control for an independent I/O operation to a specific device. In selector channels, a single subchannel handles the dedicated path, while multiplexer channels (byte or block) support up to 256 subchannels, subdividing the shared data path to accommodate multiple concurrent device interactions. This structure allows the channel to maintain operation-specific information, such as byte counts and residual status, enabling parallel processing without interference.[10][14] Basic channel operations begin with CPU initiation via privileged I/O instructions, such as START I/O, which loads the channel address word (CAW) to locate the initial CCW in main storage. The channel then assumes control, autonomously executing the CCW sequence—specifying commands like read, write, or sense—while transferring data between devices and storage. Upon completion or error, the channel signals the CPU through an interruption, storing status in the channel status word (CSW) for retrieval. This autonomous execution ensures minimal CPU overhead, with channels handling synchronization, error detection, and device signaling independently.[10]Status and Control Words
In the IBM System/360 input/output architecture, the Channel Address Word (CAW) serves as a key control structure that initiates channel programs by specifying the starting point and protection parameters for I/O operations.[10] The CAW is a 4-byte (32-bit) word located in main storage at absolute address 72 (decimal), fetched by the channel upon execution of a START I/O instruction.[10] It consists of a 4-bit protection key in bits 0-3, which determines access rights for the associated channel program; bits 4-7 must be zeros; and bits 8-31 provide the 24-bit address of the first Channel Command Word (CCW), which must be doubleword-aligned (bits 29-31 set to zero).[10] This structure ensures that I/O operations are protected and directed to the correct sequence of commands in main storage.[10] The Channel Command Word (CCW) is the primary data structure that defines individual steps within a channel program, enabling the channel to execute commands autonomously from the CPU.[10] Each CCW is an 8-byte (64-bit) doubleword, with bits 0-7 specifying an 8-bit command code that indicates the operation, such as read, write, control, or sense; bits 8-31 holding a 24-bit data address pointing to the first byte of main storage involved in the transfer; and bits 48-63 containing a 16-bit byte count (ranging from 1 to 65,535) that specifies the number of bytes to process.[10] Control flags in bits 32-39 manage chaining and modifications: bit 32 (chain data) links successive data transfers without suspending the channel; bit 33 (chain command) chains to the next CCW; bit 34 (suppress length indication) prevents program interruption for length errors; bit 35 (skip) suppresses data storage during reads or senses; and bit 36 (program-controlled interruption) requests an interruption after the CCW completes.[10] Bits 37-39 are reserved (must be zero except during transfer-in-channel operations), while bits 40-47 are ignored and have no effect.[10] CCWs are typically linked in chains to form complete I/O sequences, fetched sequentially by the channel from main storage.[10] Upon completion or termination of an I/O operation, the Channel Status Word (CSW) is stored in main storage at absolute address 64 (decimal) to report the outcome, facilitating program analysis and error handling.[10] The CSW is also an 8-byte (64-bit) doubleword, mirroring the CAW's protection key in bits 0-3 and reserving bits 4-7 as zeros; bits 8-31 contain the address of the CCW that caused the status (the last one fetched or the current one if suspended).[10] The status field in bits 32-47 provides device and channel conditions: bit 32 (attention) signals an external device event; bit 33 (status modifier) qualifies other status bits for specific device behaviors; bit 34 (control unit end) indicates control unit availability; bit 35 (busy) denotes unavailability of the device or control unit; bit 36 (channel end) marks completion of data transfer; bit 37 (device end) confirms device operation finish; bit 38 (unit check) reports programming or equipment errors; and bit 39 (unit exception) flags unusual conditions like invalid data.[10] Additional bits 40-47 indicate errors such as program-controlled interruption (40), incorrect length (41), program check (42), protection check (43), channel data check (44), channel control check (45), interface control check (46), and chaining check (47).[10] Finally, bits 48-63 hold the residual count, representing the bytes not transferred from the last CCW's count.[10] Unit status, which captures device-specific conditions, is embedded within the CSW's status bits 32-47 and can be further detailed through sense operations.[10] Key flags include attention, unit check, device end, and unit exception, which alert the program to events like required intervention or data anomalies, with meanings varying by device type as defined in individual I/O device manuals.[10] For deeper diagnostics, a sense command (CCW code 0xE4) transfers up to 32 bytes of sense data from the device to main storage, including bits for command reject, intervention required, bus-out check, equipment check, data check, and overrun, providing granular error information without CPU involvement during the transfer.[10] This mechanism ensures reliable reporting of peripheral status, supporting robust error recovery in the System/360 environment.[10]| Field | Bits | Description |
|---|---|---|
| Protection Key | 0-3 | Storage protection key for the operation. |
| Reserved | 4-7 | Must be zeros. |
| Command Address | 8-31 | Address of the terminating CCW. |
| Attention | 32 | Device attention signal. |
| Status Modifier | 33 | Modifies status interpretation. |
| Control Unit End | 34 | Control unit ready. |
| Busy | 35 | Device/control unit unavailable. |
| Channel End | 36 | Channel transfer complete. |
| Device End | 37 | Device operation complete. |
| Unit Check | 38 | Unit error detected. |
| Unit Exception | 39 | Exceptional unit condition. |
| Program-Controlled Interrupt | 40 | PCI pending. |
| Incorrect Length | 41 | Length discrepancy. |
| Program Check | 42 | Program violation. |
| Protection Check | 43 | Access protection error. |
| Channel Data Check | 44 | Channel data error. |
| Channel Control Check | 45 | Channel control error. |
| Interface Control Check | 46 | Interface error. |
| Chaining Check | 47 | Chaining sequence error. |
| Residual Count | 48-63 | Untransferred bytes. |
I/O Command Processing
In the IBM System/360 architecture, I/O command processing occurs within the channel subsystem, where a sequence of Channel Command Words (CCWs) directs the transfer of data and control information between main storage and I/O devices. Upon initiation of an I/O operation, the channel fetches the Channel Address Word (CAW) from a fixed location in main storage (address 72 decimal), which provides the starting address of the first CCW in the channel program. Each CCW, referenced briefly as a structure containing command codes, data addresses, byte counts, and control flags, is fetched and executed sequentially by the channel, enabling autonomous operation without continuous CPU involvement.[10] Chaining mechanisms allow for efficient handling of complex I/O sequences. Command chaining, indicated by the chain-command (CC) flag in a CCW, links multiple CCWs into a continuous program, prompting the channel to fetch and execute the next CCW immediately upon receiving a device-end signal from the current operation, without generating an interruption unless suppressed by certain error conditions. Data chaining, controlled by the chain-data (CD) flag, facilitates transfers that span non-contiguous areas of main storage; when the byte count of the current CCW is exhausted, the channel proceeds to the next CCW's data address to continue the transfer seamlessly. These chaining features support multi-command operations, such as reading or writing variable-length records, while maintaining data integrity through ascending-order transfers from specified storage locations.[10] Status reporting ensures the CPU is notified of operation progress and completion through specific signals generated by the channel and device. The channel end (CE) signal marks the conclusion of all data or control transfers associated with a CCW or chain, indicating that the channel is no longer required for the current operation and triggering an I/O-class interruption unless chaining is active. The device end (DE) signal, issued by the I/O device, confirms the completion of device-specific actions (such as seek or rewind) and device readiness for subsequent operations; it typically accompanies or follows CE and also triggers an interruption for the final CCW in a chain. Both signals contribute to the Channel Status Word (CSW) stored at main storage location 64 decimal, which captures status bytes for CPU inspection upon interruption.[10] Error handling during command processing provides mechanisms for detecting and responding to anomalies without necessarily halting the entire operation. A program-controlled interruption (PCI) is generated when conditions such as incorrect length—where the transferred data volume does not match the CCW byte count—are detected, provided the PCI flag is set in the CCW; this alerts the program via an interruption without terminating the chain unless further errors occur. The suppress-length-indication (SLI) flag can override PCI for length discrepancies, allowing operations to proceed while deferring detailed error analysis. Unit check or unit exception conditions, often device-specific, may suppress chaining and require intervention, with status details preserved in the CSW for recovery.[10] Sense commands play a crucial role in diagnosing issues by retrieving detailed device status information. Issued via a dedicated CCW with a sense command code, this operation transfers up to a fixed number of bytes (typically 32 or fewer, model-dependent) of device status—such as intervention required, bus-out check, or equipment malfunction—directly to a specified location in main storage. The sense data, formatted with the first six bits indicating primary error categories (e.g., command reject or data check), is cleared only by the subsequent non-sense command, enabling the program to analyze and respond to faults before resuming normal processing. This mechanism integrates into the chaining sequence, often following a unit check to gather diagnostics without additional interruptions.[10] The overall sequence of I/O command processing culminates in termination when no further chaining is indicated and both CE and DE signals have been issued for the final CCW, resulting in an I/O interruption that presents the CSW to the CPU for status evaluation and program continuation. Throughout the process, the channel operates independently, handling fetches, transfers, and signal exchanges to minimize CPU overhead, with condition codes (e.g., 0 for normal completion or 1 for starting a new command) providing interim feedback on operation states. This structured flow supports reliable, high-throughput I/O in multiprogramming environments.[10]I/O Instruction Set
The I/O instruction set in the IBM System/360 architecture comprises a small group of privileged CPU instructions designed specifically to manage input/output operations between the processor and peripheral devices via the channel subsystem. These instructions enable the initiation, termination, testing, and resetting of I/O activities without direct intervention in data transfer, which is handled asynchronously by the channels. All such instructions require the CPU to be in supervisor state and can result in program interruptions for conditions like privileged operation exceptions, addressing exceptions, or protection exceptions.[10] The instructions operate using a two-byte format (SI or RX type), where the operand address is calculated as the sum of the contents of base register B1 (bits 8-15 of the instruction) and the displacement D1 (bits 16-31), typically specifying a device or channel address in bits 24-31 for subchannel identification and bits 21-23 for channel selection. Condition codes provide immediate feedback on execution status: 0 for success (e.g., operation initiated or resource available), 1 for cases where a Channel Status Word (CSW) is stored at main storage location 64 due to interruptions or errors, 2 for busy or working states, and 3 for not operational or halted conditions. The CSW, when stored, contains flags for channel status, device status, count, and location to facilitate error handling and interruption processing.[10] Start I/O (SIO), with opcode 0x9C, initiates an I/O operation for a specified device by fetching the Channel Address Word (CAW) from main storage location 72 and using it to locate the first Channel Command Word (CCW), which defines the operation type (e.g., read, write, control, or sense), data addresses, and flags like chaining or data chaining. Upon successful execution (condition code 0), the channel becomes busy, the device is selected, and the program continues without waiting for completion; immediate operations (e.g., sense or control-no-data) may signal channel-end during initiation. If rejected due to unavailability, the instruction sets condition code 2 (busy) or 3 (not operational), and no data transfer occurs; programming errors like invalid CCW addresses may trigger condition code 1 with CSW storage. SIO clears certain pending interruption conditions depending on the model and error type encountered during initiation.[10] Test I/O (TIO), opcode 0x9D, examines the status of a specified device and its associated subchannel without modifying any ongoing I/O activity. It sets condition code 0 if the device and subchannel are available and idle, condition code 1 if interruption conditions are pending (storing a CSW at location 64 with relevant status bits), condition code 2 if the channel or subchannel is busy or working on an operation, and condition code 3 if not operational or halted. The instruction may clear selected pending interruptions, such as device-end or attention, but status responses vary by device type; for example, a status modifier bit in the CSW indicates non-executable conditions with zeroed fields. TIO is useful for polling device readiness prior to issuing other I/O commands.[10] Halt I/O (HIO), opcode 0x9E, terminates an active I/O operation on the specified device by signaling the channel to stop data transfer and disconnect the device. In burst mode (selector channels), it halts immediately; in multiplex mode, it completes the current byte and then terminates. Successful halting sets condition code 0 (operation terminated) or 2 (burst terminated), with a CSW stored at location 64 containing the final status, count, and location; if no operation is active or the device/channel is unavailable, condition code 1 or 3 is set without altering the state. HIO turns off the chain-command flag if command chaining is active and can generate up to four interruption conditions on selector channels, freeing the channel for higher-priority operations; it has no effect on completed or rejected operations. Test Channel (TCH), opcode 0x9F, assesses the status of a specified channel independently of any device or subchannel, without storing a CSW or affecting ongoing operations. It sets condition code 0 if the channel is available and idle, condition code 1 if an interruption is pending, condition code 2 if the channel is busy or in burst mode, and condition code 3 if not operational. This instruction is particularly valuable for determining channel readiness before initiating new I/O, as it ignores device-specific states; the count field in any related CSW for pending interruptions is unpredictable.[10] Clear I/O (CIO), opcode 0x9B, resets the specified subchannel and associated device, terminating any ongoing I/O operation and clearing all status and control information to an initial state. Upon success (condition code 0), the subchannel becomes available for new operations; if an operation is in progress, condition code 1 is set with CSW storage at location 64, or condition code 2 if not operational. CIO performs a malfunction reset on the device where applicable, effectively reinitializing the I/O path without regard to prior command chains; device-dependent behaviors may influence the exact reset scope, but it ensures the channel facilities are freed.[10]| Instruction | Opcode | Format | Primary Function | Key Condition Codes |
|---|---|---|---|---|
| Start I/O (SIO) | 9C | RR/SI/RX | Initiate channel program | 0: Started; 1: CSW stored; 2: Busy; 3: Not operational |
| Test I/O (TIO) | 9D | RR/SI/RX | Check device/subchannel status | 0: Available; 1: CSW stored; 2: Busy; 3: Not operational |
| Halt I/O (HIO) | 9E | RR/SI/RX | Terminate active I/O | 0: Halted; 1: CSW stored; 2: Burst terminated; 3: Not operational |
| Test Channel (TCH) | 9F | RR/SI/RX | Check channel status | 0: Available; 1: Pending interruption; 2: Busy; 3: Not operational |
| Clear I/O (CIO) | 9B | RR/SI/RX | Reset subchannel/device | 0: Cleared; 1: CSW stored (busy); 2: Not operational |
