Skip to content

How negative value in a registers are handled? #3

Open
@vivekvpandya

Description

@vivekvpandya

Could @bit-hack please explain how negative values in registers are handled?
For example say ADDI r5, r0, 100 and say r0 has value -100 (in 2's complement)
will following give correct answer ?

82    case 0: // ADDI    Aidan Dodds, 20/09/20 16:10 • tidy and fix SRAI bug                                                                                                                                      
  1     rv->X[rd] = (int32_t)(rv->X[rs1]) + imm;                                                                                                                                                                  
  2     break;          

because X stores unsigned integer AFAIU then above seems not handled correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions