An IP routing lookup scheme and system for a multi-gigabit switching router which
can reach 3 memory accesses in the worst case using memory size less than 512 KB
is disclosed. The invention can compress a routing table with 40,000 routing entries
into a forwarding table of 450-470 Kbytes. According to the present invention,
a segmentation table storage device stores a next hop or a pointer for looking
up a next hop for an incoming packet having prefix length less than or equal to
16 bits. The Next Hop Array storage device is for storing the next hops for a packet
having prefix length larger than 16 bits and offset length less than or equal to
3 bits. A Compressed Next Hop Array storage device is encoded and decoded according
to a Code Word Array storage device. The Compressed Next Hop Array storage device
stores next hops for the incoming packet having prefix length larger than 16 bits
and offset length larger than 3 bits. Thus, in the worst case, an output port for
a route prefix can be found in 3 memory accesses.