Will the ecm affect my smog test?

I think my ecm is bad in my 96 Honda civic ex 5speed. Can I change the ecm? Do I need to find the exact matching ecm or can I use a different year ecm? Will it affect my smog test. I don't wanna buy a brand new one so I'm thinking of buying a used one from people parting cars or a parts shop. It's hard to find exact match that's why I want to know if it matters also I gotta smog test pretty soon.

With a faulty or incorrect model of ECM you'll fail the test. First, get it tested by a repair shop. If it's faulty, replace it with a known good used one obtained from a trustworthy salvage yard or internet vendor. Any parts store can tell you which model years you can use. So can the parts dept of a Honda dealership.

If your car is running odds are better than excellent the ecm is just fine. Can you describe the symptoms of the problem you are having?