Skip to content

Commit

Permalink
[bazel] Build non-scrambled VMEM images
Browse files Browse the repository at this point in the history
The englishbreakfast verilator model does not understand ROM scrambling,
so we also create a non-scrambled VMEM file.

Signed-off-by: Chris Frantz <[email protected]>
  • Loading branch information
cfrantz committed Oct 4, 2023
1 parent e686650 commit ba0a8ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rules/opentitan/cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,12 @@ def _opentitan_binary(ctx):
# the DefaultInfo provider.
if "logs" in provides:
default_info.extend(provides["logs"])

# FIXME(cfrantz): Special case: The englishbreakfast verilator model
# requires a non-scrambled ROM image.
if provides.get("rom32"):
default_info.append(provides["rom32"])

groups.update(_as_group_info(exec_env.exec_env, signed))
groups.update(_as_group_info(exec_env.exec_env, provides))

Expand Down
11 changes: 11 additions & 0 deletions rules/opentitan/sim_verilator.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def _transform(ctx, exec_env, name, elf, binary, signed_bin, disassembly, mapfil
rom_scramble_config = exec_env.rom_scramble_config,
rom_scramble_tool = ctx.executable.rom_scramble_tool,
)

# The englishbreakfast verilator model does not understand ROM
# scrambling, so we also create a non-scrambled VMEM file.
rom32 = convert_to_vmem(
ctx,
name = name,
src = binary,
word_size = 32,
)
default = rom
vmem = rom
elif ctx.attr.kind == "flash":
Expand All @@ -58,6 +67,7 @@ def _transform(ctx, exec_env, name, elf, binary, signed_bin, disassembly, mapfil
)
default = vmem
rom = None
rom32 = None
else:
fail("Not implemented: kind ==", ctx.attr.kind)

Expand All @@ -70,6 +80,7 @@ def _transform(ctx, exec_env, name, elf, binary, signed_bin, disassembly, mapfil
"disassembly": disassembly,
"mapfile": mapfile,
"vmem": vmem,
"rom32": rom32,
}

def _test_dispatch(ctx, exec_env, provider):
Expand Down

0 comments on commit ba0a8ad

Please sign in to comment.