Skip to content

✨ Support for the upper bits of multiplication binary operation '*>' #244

Open
@TooMuchDakka

Description

@TooMuchDakka

What's the problem this feature will solve?

The evaluation (currently only preliminary support in the parser) and synthesis of the upper bits of multiplication binary operation '*>' is not fully supported (see the BinaryExpression rule and the additional description in section 2 of the SyReC EBNF.

Describe the solution you'd like

One would at first need to specify how the operation should be evaluated, the x86 assembly MUL instruction might serve as a reference where two 32 bit unsigned integers are multiplied and the lower and upper bits of the multiplication result being stored in two separate registers (with the register storing the upper bits of the multiplication potentially being equal to the result of the SyReC operation). However, variables in a SyReC module might not be 32 bit unsigned integers.

// Potential implementation for constant operands of expression
std::uint32_t upperBitMultiplication(const unsigned lOperand, const unsigned rOperand, const unsigned bitwidth) {
 const std::uint64_t multiplicationResult = static_cast<uint64_t>(lOperand) * static_cast<uint64_t>(rOperand);
 // TODO: Truncate to expected bitwidth with maximum storable value being equal to (2^b - 1)
 return static_cast<std::uint32_t>(multiplicationResult >> 32);
} 

After having defined how the operation is evaluated one would need to define how it is synthesized. The synthesis of the multiplication operation might serve as a reference for the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Anything related to C++ codefeatureNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions