Thanks for coming to Just Answer to ask a question.
What year model vehicles are the engines from and which transmission is in question?
If its the Mazda M5OD trans then yes the motor should bolt up to it.
I hope you found my answer helpful, in the case you did please click on the GREEN ACCEPT button shown on your screen. This is necessary so I get paid and receive credit for my work. Your question will not close after an accept, and you will still have the opportunity to follow-up if needed. Leaving a bonus and positive feedback is not required, but doing so is certainly appreciated!
If you have additional comments to add, then please do so, Take note in many cases I am not informed or aware of your skills or knowledge or what has been done in the past unless you tell me. I am providing my best answer based on what you have written, and sometimes there is a misunderstanding which a reply can resolve. Be courteous in understanding I did not build the vehicle or have any relations in its design or any control over past repairs, so please don't hold me accountable for the failure you have experienced.
If you reply and I have not gotten back with you then please understand I may be helping others or off to work or bed, I will get back with you as soon as I can.