Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added length method to bank template #307

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 9 additions & 0 deletions lib/1.4/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,15 @@ template bank is (object, shown_desc) {
return (src, num);
}

shared independent method length() -> (uint64) {
local (const register *regs, int num_mapped_regs) = _sorted_regs();
if (num_mapped_regs > 0) {
local const register last_reg = regs[num_mapped_regs - 1];
return last_reg.offset + last_reg._size();
}
return 0;
}

// Register dispatcher. Given the offset and size of an access, return a
// list of registers that the access covers, and a bitmask showing 0xff for
// all bytes of the access that were not mapped to a register. The register
Expand Down