Skip to content

max_num_lanes causes Synopsys Design Compiler to segfault

max_num_lanes function in fpnew_pkg.sv causes the latest version of Synopsys dcnxt_shell (Design Compiler / DC / DC Next) to crash. After inlining min_fp_width function into max_num_lanes crash goes away. I suggest the inlined version is used until Synopsys fixes the issue on their side.

The original function

// Returns the maximum number of lanes in the FPU according to width, format config and vectors
function automatic int unsigned max_num_lanes(int unsigned width, fmt_logic_t cfg, logic vec);
  return vec ? width / min_fp_width(cfg) : 1; // if no vectors, only one lane
endfunction

Inlined version

// Returns the maximum number of lanes in the FPU according to width, format config and vectors
function automatic int unsigned max_num_lanes(int unsigned width, fmt_logic_t cfg, logic vec);
  if (vec) begin
    automatic int unsigned res = max_fp_width(cfg);
    for (int unsigned i = 0; i < NUM_FP_FORMATS; i++) begin
      if (cfg[i]) begin
        automatic int unsigned format_width = FP_ENCODINGS[i].exp_bits + FP_ENCODINGS[i].man_bits + 1;
        res = unsigned'(minimum(res, format_width));
      end
    end
    return width / res;
  end else begin
    return 1; // if no vectors, only one lane
  end
endfunction