|
5 | 5 | load( |
6 | 6 | "@lowrisc_opentitan//rules/opentitan:transform.bzl", |
7 | 7 | "convert_to_vmem", |
| 8 | + "scramble_flash", |
8 | 9 | _obj_transform = "obj_transform", |
9 | 10 | ) |
10 | 11 | load("@lowrisc_opentitan//rules:rv.bzl", "rv_rule") |
@@ -79,3 +80,38 @@ vmem_file = rv_rule( |
79 | 80 | ), |
80 | 81 | }, |
81 | 82 | ) |
| 83 | + |
| 84 | +def _scramble_flash_vmem_impl(ctx): |
| 85 | + outputs = [scramble_flash(ctx, suffix = "src.vmem")] |
| 86 | + return [ |
| 87 | + DefaultInfo( |
| 88 | + files = depset(outputs), |
| 89 | + data_runfiles = ctx.runfiles(files = outputs), |
| 90 | + ), |
| 91 | + ] |
| 92 | + |
| 93 | +scramble_flash_vmem = rv_rule( |
| 94 | + implementation = _scramble_flash_vmem_impl, |
| 95 | + attrs = { |
| 96 | + "src": attr.label(allow_single_file = True), |
| 97 | + "otp": attr.label(allow_single_file = True), |
| 98 | + "otp_mmap": attr.label( |
| 99 | + allow_single_file = True, |
| 100 | + default = "//hw/ip/otp_ctrl/data:otp_ctrl_mmap.hjson", |
| 101 | + doc = "OTP memory map configuration HJSON file.", |
| 102 | + ), |
| 103 | + "otp_seed": attr.label( |
| 104 | + default = "//hw/ip/otp_ctrl/data:otp_seed", |
| 105 | + doc = "Configuration override seed used to randomize OTP netlist constants.", |
| 106 | + ), |
| 107 | + "otp_data_perm": attr.label( |
| 108 | + default = "//hw/ip/otp_ctrl/data:data_perm", |
| 109 | + doc = "Option to indicate OTP VMEM file bit layout.", |
| 110 | + ), |
| 111 | + "_tool": attr.label( |
| 112 | + default = "@//util/design:gen-flash-img", |
| 113 | + executable = True, |
| 114 | + cfg = "exec", |
| 115 | + ), |
| 116 | + }, |
| 117 | +) |
0 commit comments