Implementing tries in RAM Addr. Content =0, =1, rule 1 2,3,0 2 0,4,a 3 5,6,d 4 7,c,0 5 e,0,0 6 8,9,0 7 10,0,0 8 f,g,0 9 h,i,0 10 b,0,0 a => to port X b => to port Y c => to port X ... Each node stored in one word, containing at most 3 ptrs: left: next rule if bit is 0 centre: next rule if bit is 1 right: rule if this is last matched bit (Only need right pointer if other 2 aren’t leaves. e.g. not needed for nodes 8 and 9.) Start search at node 1, continue until either: match leaf node, e.g. 011 matches c can’t progress past a node, then use previous best match, e.g. 0101 matches a en route to blockage at node 7. (rule=0=>no rule) 1 1 2 a 3 d 4 5 6 7 c e 8 9 10 f g h i b 9751C4* 23/11/2018 Tim Moors
e.g. Multi-bit variable-stride trie Prefix Next-hop * 35 10* 7 01* 21 110* 9 1011* 1 0001* 68 01011* 51 00110* 3 10001* 6 100001* 33 10000000* 54 1000000000* 12 1000000011* 14 128.252.153.160 1000 0000 1111 1100 1001 1001 1010 0000 3 35 0000 35 step 1 step 2 step 3 step 4 68 35 0010 35 35 0100 21 51 21 35 35 0110 35 35 1000 35 7 7 6 7 54 54 12 14 1010 33 1 1100 9 35 14 35 1110 35 35 Slide by V. Sivaraman based on example from D. Taylor et al: 'Scalable IP lookup for programmable routers', Proc. Infocom, pp. 562-71, 2002 9751DE* 23/11/2018 Tim Moors