Skip to content

[General]: Library pages and the language manual declare different signatures for Signed, Sign_Extend, Align_Down and others #107

Open

Description

@shuklaayush

Problem

The language manual (ISA_LRM, "Standard library") and the SDM library pages declare
these functions differently:

function language manual SDM library page
Signed Std::Integer::Signed(implicit size : {1..}, …) -> {-2**(size-1) .. 2**(size-1)-1} Std::Bits::Signed(implicit size : {0..}, …) -> Integer
Unsigned Std::Integer::Unsigned(implicit size : {0..}, …) -> {0 .. 2**size-1} Std::Bits::Unsigned(implicit size : {0..}, …) -> Integer
Sign_Extend implicit size : {1..}, new_size : {size..} implicit source_size : {0..}, target_size : {..}
Zero_Extend new_size : {size..} (ISA_LRM) result width {0..}, any nonnegative width
Align_Down alignment : {1..} right : Integer
Align_Up alignment : {1..} right : Integer
Is_Power_Of_Two x : {1..} a : Integer
Abs -> {0..} -> Integer
>> / Shift_Right x >> y is x / 2**y, and / rejects negative x (ISA_LRM) Std::Integer::Shift_Right(-5, 1) == -3

Some differences change which calls are admitted (Signed, Sign_Extend, Zero_Extend,
Align_Down, Align_Up, Is_Power_Of_Two, >>); others change only the namespace or the
precision of the result type (Unsigned, Abs).

Proposed fix

  • Reconcile the manual and the library pages on qualified names and parameter domains,
    distinguishing result-type refinements from changes to accepted inputs.
  • For >>, match the library page's examples (Shift_Right(-5, 1) == -3):
    Shift right == Std::Integer::Floor_Divide(x, 2**y). Requires y >= 0.

AI disclosure

Assisted-by: Claude

Claude assisted with source analysis, the proposed correction and drafting this report.
Reviewed with assistance from Codex.

Pinned source: definitions.xml.gz at revision 35eface1b7ee003a1cda95005ec5fd83de658a64.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions