5.7 engine on 2002 Chevrolet Silverado 2500 HD

i bought a 2002 silverado 2500 hd and the engine was knocking....i have a 2006 ls1 5.7 and i want to know can i swap the to engines and everything match up and fit ?

possibly call your local engine machine shop and ask them to cross them over in their book