Some good information here on Mazda Engines:
Lots of good stuff there, here's a quote:
Mazda makes 5 'boinger' [piston] engine families. They are:
# 'J' 90 degree v6 (as in the 3.0L 929 and MPV)
# 'K' 60 degree V6 (1.8 MX3, 2.0, 2.3 Millenia, 93+ 2.5 MX6/Probe)
# 'B' 4 cylinder (323, Protege, Miata)
# 'F' 4 cylinder (B2000/B2200, 78-92 F/FE/F2/F2T 626/MX6, 93+ FS 626/MX6)
# 'G' 4 cylinder (B2600, MPV)
The DOHC 'J' is generally too wide for the Miata engine bay. Mazdaspeed M2 had done a swap of this engine back in 92 as an engineering exercise and is the only one known to exist. The SOHC fits but why, it's only 165 hp and not really matched to the Miata.
The 'K' engines are not designed for RWD and not only do the manifolds and plumbing not line up correctly for RWD but it will have oil starvation problems if used as such. MCA tried a swap of it back in 93 but was stillborn. The Susuki variant of the engine as used in the Vitara has real possibilities though! This swap has been talked about at length in the Miatapower list list and 'ask Bob' at Miata.net.
The 'F' engines are the 'big blocks' of the 4 cylinders. They are long stroke motors and are generally not designed for high revs. All were cast iron SOHC with the exception of the FS and FE3. The FE3 has been used here in the states in the Kia Sportage and has real possibilities for a Miata swap. I'm going to be installing a 2.3 version in a Miata this winter. I have written about it in the Miatapower list.
Any swap would require a tranny swap (or integrated bellhousing swap) too since none of the other engine families use the same bellhousing bolt pattern. I am using the B2200 truck tranny (w/Miata gears and a Miata PPF tailshaft housing) for my swap.