Skip to content

There's no explicit way to convert between signed <-> unsigned values #292

Closed
@nmigen-issue-migration

Description

@nmigen-issue-migration

Issue by Maykeye
Friday Jan 03, 2020 at 07:19 GMT
Originally opened as m-labs/nmigen#292


I have an unsigned signal. I want to compare it as signed for a change and now there are no good explicit way to do it.

  • I can make new Signal(signed(old.width)) and equate it to the old one, but in order to do so, I must place all such signals in the beginning of elaborate: if I create a copy somewhere in the middle like with m.If(en): comb+= make_signed_copy(n)<10, generator will not be able to generate wire[31:0] signed_n = n, instead it will create register because if if-branch is not executed, signed_n is not being written

  • There's implicit conversion: I can use -(-n), and rely on optimizers down the road, but it feels hacky.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions