modules/swcore: bugfix to allocator preventing from using twice the same page when memory gets full
The problem occured in swc_page_alloc_ram_bug.vhd when there were no more free pages (out_nomem_d1='1') and input block was requesting allocation and setting usecnt (alloc FSM in S_PCKSTART_SET_AND_REQ). The operation was _done_ because there is always one free page read in advance, prepared to be allocated to a requesting input block and set usecnt does not depend on out_nomem_d1. However, reading of the next free page from the memory was done only on alloc_req, only if there were still some free pages (q_read_p0 <= alloc_req & !out_nomem_d1). That means allocator was holding address of the page just allocated to one of the input blocks, and was giving the same address to the next one requesting allocation (if in the meantime out_nomem_d1 went to '0'). To fix that I've added one register keeping information if the page read from the memory was already given to any requestor. If it was then I do _read_ of the new page imediately after there are some new pages (out_nomem_d1 = '0') so that it is ready when next time somebody asks.
Please register or sign in to comment