arm-education / arm-education/Graphical-Micro-Architecture-Simulator

MOVZ & MOVK

Open
#5 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
142
Forks
34
PR merge metrics
No merged PRs in 30d

Description

717 registerFile[destReg] = immediate << quadrantShift;
726 registerFile[destReg] = registerFile[destReg] | (immediate << quadrantShift);

These two lines of code have immediate as int types. This causes issues with the results of MOVK and MOVZ. Some of the observed issues:

MOVZ X1, 0x8000, LSL #16 will result in X1 having a value of 0xffffffff80000000, this is a sign extended result where sign extension should not happen.

MOVZ X1, 0x8000, LSL #32 will result in X1 having a value of 0x8000.

MOVZ X1, 0x8000, LSL #48 will result in X1 having a value of 0xffffffff80000000, this is wrong in sign and distance.

I can not suggest a fix as I do not have a Java build environment handy.

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the MOVZ and MOVK handling around lines 717 and 726, focusing on how immediate values are used with registerFile and quadrantShift. Reproduce the listed MOVZ cases and verify that the resulting values have the correct sign and shift distance without unintended sign extension.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.