| // Copyright lowRISC contributors. |
| // Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| // SPDX-License-Identifier: Apache-2.0 |
| def make_blocked_sv_literal(hexstr, randwidth): |
| """Chop a hex string into blocks of <= 64 digits""" |
| # Convert hexstr to an actual number |
| assert 0 <= num < (1 << randwidth) |
| width = min(256, bits_left) |
| acc.append("{nbits}'h{word:0{num_nibbles}X}" |
| num_nibbles=(width + 3) // 4)) |
| package top_${top["name"]}_rnd_cnst_pkg; |
| % for m in top["module"]: |
| % for p in filter(lambda p: p.get("randtype") in ["data", "perm"], m["param_list"]): |
| //////////////////////////////////////////// |
| //////////////////////////////////////////// |
| parameter ${p["type"]} ${p["name_top"]} = { |
| % for block in make_blocked_sv_literal(p["default"], p["randwidth"]): |
| ${block}${"" if loop.last else ","} |
| endpackage : top_${top["name"]}_rnd_cnst_pkg |