Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions sw/device/lib/base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ This subtree provides headers and libraries known collectively as `libbase`, whi

In general, a library exposing general utilities for working close to the hardware should live in this subtree: for example, a library providing `memcpy` and related symbols.
A library for talking to a particular peripheral, like a UART port, is a non-example.

## Policy regarding 64-bit division

`libbase` does not provide the `__divdi3` and `__udivdi3` (signed/unsigned 64-bit division) symbols.
The rationale is that users of the library may have different needs when it comes to the trade-off between the size and speed of the implementation.
Instead, `libbase` provides `udiv64_slow` which is a relatively slow but compact unsigned 64-bit division.
1 change: 1 addition & 0 deletions sw/device/silicon_creator/rom/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ opentitan_binary(
],
)

# 64-bit division is forbidden in the ROM (or needs to use udiv64_slow)
check_elf_symbols_test(
name = "mask_rom_symbol_check",
forbidden = [
Expand Down
15 changes: 15 additions & 0 deletions sw/device/silicon_creator/rom_ext/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
)
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("//rules:signing.bzl", "signature_test")
load("//rules:symbols.bzl", "check_elf_symbols_test")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -358,6 +359,20 @@ ROM_EXT_FEATURES = [
for slot in SLOTS
]

# 64-bit division is forbidden in the ROM_EXT (or needs to use udiv64_slow)
[
check_elf_symbols_test(
name = "rom_ext_{}_slot_{}_symbol_check".format(variation_name, slot),
forbidden = [
"__udivdi3",
"__divdi3",
],
target = ":rom_ext_{}_slot_{}".format(variation_name, slot),
)
for variation_name, variation_deps in ROM_EXT_VARIATIONS.items()
for slot in SLOTS
]

[
opentitan_binary(
name = "rom_ext_{}".format(name),
Expand Down
Loading