After five years of litigation, Samsung agreed to settle its many legal differences with Rambus Inc. for $900 million because of a looming antitrust trial in San Francisco, observers say.

Rambus, a tiny Los Altos, Calif., chip designer, was seeking $13 billion in damages from chipmakers Samsung, Micron Technology Inc. and Hynix Semiconductor Inc. for unfairly squashing its memory-chip business in a case that was set for trial this month. Rambus had a strong hand going into the trial against Samsung. But observers say that Samsung may reap some benefit by settling before Micron or Hynix. That’s because the settlement — which includes a $200 million cash payment and a quarterly payment of about $25 million for the next five years — calls for Samsung to take a $200 million stake in Rambus. Any other settlements will undoubtedly push the volatile Rambus stock higher, and make Samsung’s stake worth more.