here is a basic outline of engine swap rules for california:
-donor engine has to be same year or newer as chassis it's going into
-donor engine must have ALL original smog equipment for that model year (exhaust manifold, cat, o2 sensors, EGR, vaccuum lines, etc)
-donor engine must use the engine computer from that model year
-donor engine must be a USDM engine. ie. legally you cannot swap a B18c2 into a civic.
you have to take the car to a dmv referee who will examine your car and verify if it's smog compliant, then issue you a DMV referee sticker that will all you to get your car smogged legally