Multiple-access codes are generated using an asymptotically optimal
decoding algorithm, such as the Viterbi algorithm. A trellis may be
constructed using a number of desired users, at least one code length,
and a number of code-chip parameters. A fitness function is derived from
a mathematical relationship between the multiple-access codes, and may
include some measure of correlation of the codes. The multiple-access
codes correspond to paths having optimal path metrics derived from the
fitness function. Multiple iterations through the trellis may be
performed to refine a selection of multiple-access codes.