Systemverilog 2d Dynamic Programming