VOGONS


First post, by Lazo

User metadata
Rank Newbie
Rank
Newbie

Hi,

I am studying ISA bus internals and reading classic ISA System Architecture, 3rd Edition book. There, in the section which describes data bus steering logic of 80286, this description is given:

"... in addition to chip-selecting its respective device it also asserts ISA signal M16# (Memory size 16) or IO16# (I/O size 16). This tells the bus control logic that the microprocessor is communicating with 16-bit device (as opposed to an 8-bit device). Not that the bus control logic samples either the M16# or IO16# signal depending on whether the bus cycle is referencing a memory or I/O location. Sampling the appropriate signal is important because both the M16# and IO16# signal may be asserted at the same time, since the generation of M16# is not qualified by whether the access is to a memory location or not."

I would like to ask experts here to clarify the highlighted statement. This statement confused me as I do not understand:

- how and under what circumstances it is possible that M16# and IO16# signals are asserted at the same time when bus cycle can explicitly assert (or decoder identify) that bus cycle is memory R/W or IO R/W.
- If M16# "is not qualified by whether the access is to memory location or not" then the question is why ISA designers included separate IO16 and M16 signals to distinguish IO from memory access if all they needed to communicate is that ISA device is 16-bit or 8-bit.
- Is there a legitimate use case where 16-bit ISA device would support 16-bit memory access but only 8-bit I/O access? Or that 16-bit ISA device will dynamically (or based on memory ranges/banks) enable 16-bit memory access on some block of addresses but 8-bit on another block of addresses? Such scenarios would obviously explain why there are M16# and IO16# signals and not just 16# signal.

Reply 1 of 4, by jmarsh

User metadata
Rank Oldbie
Rank
Oldbie
Lazo wrote on 2024-08-01, 12:55:

- If M16# "is not qualified by whether the access is to memory location or not" then the question is why ISA designers included separate IO16 and M16 signals to distinguish IO from memory access if all they needed to communicate is that ISA device is 16-bit or 8-bit.

I'm going to guess the answer is related to how DMA works. Pretty much whenever you find something about the ISA bus that looks strange, the answer is "because DMA".

Reply 2 of 4, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie

When this came up before, the answer is that M16# needs to be generated so early by the device that it should be decoded from bits 17 to 23 of the address and nothing else. So it's generated before the device even knows whether it's memory or I/O.

Reply 3 of 4, by vstrakh

User metadata
Rank Member
Rank
Member

The address lines on the ISA bus are shared between memory and I/O accesses.
The slave device is supposed to signal its datapath width when the address decoder on the device recognizes the address belongs to the device, it's just the address, not the access yet.
Now remember that the I/O space is limited to 16 lines, and it's crippled further on PC by the partial I/O port address decoding (down to 10 lines), the device's I/O address decoder _will_ alias with any other device's memory space, regardless if it's this card or some other. The bus does not know yet what kind of access CPU will be doing, but it already must report the supported width, hence the need in two width indicators, one for each address space supported by the slave device.

Reply 4 of 4, by mkarcher

User metadata
Rank l33t
Rank
l33t

The replies in this thread are correct, except for the suspicion that this is related to DMA. The AEN shenanigans for I/O address decoding are due to the way DMA is implemented, and there might be other oddities, too. The distinction between IO16 and MEM16 is not, though.

When looking at ISA, you should be aware that there are some fundamental differences to more modern bus systems in that the ISA protocol works mostly without referring to the bus clock signal. On more modern buses, you have some address lines and some cycle type lines (e.g. M/IO, D/C, R/W on the 386/486 FSB and thus on VL), which all get valid approximately at the same time, which is like 10 to 20ns before the "start signal" for the cycle. The start signal is the rising edge of the CLK line if /ADS (on PCI: /FRAME) is held low. This allows a decoder to fully decode the cycle (or at least start doing it), including whether it is memory or I/O, whether it is read or write and (of course) the address itself before that start signal. On the other hand, on ISA there is no "this is the start of a cycle" signal, and cards do not need to take a look at the bus clock at all. Instead, 8-bit ISA has four individual start signals, one for "I/O read", one for "I/O write", one for "Memory read (inside the first MB)" and finally one for "Memory write (inside the first MB)". 16-bit ISA adds two more start signals for "Memory write (anywhere inside the 16MB space)" and a similar read signal. A device has no idea what direction and address space is being used before that start signal is asserted. Especially for 0WS memory cycles to work, mainboards require MEM16 to be valid so early in the cycle that it is difficult to be implemented (if possible at all) as response to a memory read or write start signal. So to allow the IO16 signal to be valid earlier, it should only decoded from the address lines without waiting for /IOW or /IOR.