public static void Cache(ulong key_in, ulong value_in) { // FIXME could delete node (move it to front of queue) // if it already exists in the queue. // That would avoid "bubbles" of unnecessary // nodes forming in the queue. ulong idx = NaughtyQ.Enlist(value_in); HashCAM.Write(key_in, idx); // FIXME relay "is_full" }
public static Data Lookup(ulong key_in) { Data res = new Data(); ulong idx = 0; idx = HashCAM.Read(key_in); res.matched = HashCAM.matched; res.result = 0; if (HashCAM.matched) { NaughtyQ.BackOfQ(idx); res.result = NaughtyQ.Read(idx); } return res; }
static void Main() { for (ulong i = 0; i < 20; i++) { Kiwi.Pause(); NaughtyQ.Enlist(i); Kiwi.Pause(); } NaughtyQ.BackOfQ(5); NaughtyQ.BackOfQ(10); NaughtyQ.BackOfQ(5); NaughtyQ.BackOfQ(5); for (ulong i = 0; i < 20; i++) { NaughtyQ.Read(i); Kiwi.Pause(); } }