Skip to content

Commit ddf7b40

Browse files
committed
sys:aarch64, fixed missing operand in addr(p), fixed udec in mov*
1 parent 3b17afa commit ddf7b40

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

sys/aarch64/aarch64.vadl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,19 @@ instruction set architecture AArch64Base = {
154154

155155
// assembly W register names or zero
156156
function WSize (idx: Index) -> String = // do not rename
157-
if idx = 31 then "wzr" else "w" + decimal( idx )
157+
if idx = 31 then "wzr" else "w" + udec( idx )
158158

159159
// assembly X register names or zero
160160
function XSize (idx: Index) -> String = // do not rename
161-
if idx = 31 then "xzr" else "x" + decimal( idx )
161+
if idx = 31 then "xzr" else "x" + udec( idx )
162162

163163
// assembly W register names or sp
164164
function WSizeSP (idx: Index) -> String = // do not rename
165-
if idx = 31 then "wsp" else "w" + decimal( idx )
165+
if idx = 31 then "wsp" else "w" + udec( idx )
166166

167167
// assembly X register names or sp
168168
function XSizeSP (idx: Index) -> String = // do not rename
169-
if idx = 31 then "sp" else "x" + decimal( idx )
169+
if idx = 31 then "sp" else "x" + udec( idx )
170170

171171
function Imm7decimal (imm: Bits7) -> String =
172172
if imm = 0 then "" else (", #", decimal( imm ))
@@ -308,14 +308,14 @@ instruction set architecture AArch64Base = {
308308
$AddSubExtInstrBase ($i; SXTW; $size; $f; X(rm)(31..0) as SIntX; SXTW; imm3 = 0; (WSize(rm), ", sxtw"))
309309
$AddSubExtInstrBase ($i; SXTX; $size; $f; X(rm)(63..0) as SIntX; SXTX; imm3 = 0; ($size(rm), ", sxtx"))
310310

311-
$AddSubExtInstrBase ($i; UXSB; $size; $f; X(rm)( 7..0) as UIntX << imm3; UXTB; none; (WSize(rm), ", uxtb #", decimal(imm3)))
312-
$AddSubExtInstrBase ($i; UXSH; $size; $f; X(rm)(15..0) as UIntX << imm3; UXTH; none; (WSize(rm), ", uxth #", decimal(imm3)))
313-
$AddSubExtInstrBase ($i; UXSW; $size; $f; X(rm)(31..0) as UIntX << imm3; UXTW; none; (WSize(rm), ", uxtw #", decimal(imm3)))
314-
$AddSubExtInstrBase ($i; UXSX; $size; $f; X(rm)(63..0) as UIntX << imm3; UXTX; none; ($size(rm), ", uxtx #", decimal(imm3)))
315-
$AddSubExtInstrBase ($i; SXSB; $size; $f; X(rm)( 7..0) as SIntX << imm3; SXTB; none; (WSize(rm), ", sxtb #", decimal(imm3)))
316-
$AddSubExtInstrBase ($i; SXSH; $size; $f; X(rm)(15..0) as SIntX << imm3; SXTH; none; (WSize(rm), ", sxth #", decimal(imm3)))
317-
$AddSubExtInstrBase ($i; SXSW; $size; $f; X(rm)(31..0) as SIntX << imm3; SXTW; none; (WSize(rm), ", sxtw #", decimal(imm3)))
318-
$AddSubExtInstrBase ($i; SXSX; $size; $f; X(rm)(63..0) as SIntX << imm3; SXTX; none; ($size(rm), ", sxtx #", decimal(imm3)))
311+
$AddSubExtInstrBase ($i; UXSB; $size; $f; X(rm)( 7..0) as UIntX << imm3; UXTB; none; (WSize(rm), ", uxtb #", udec(imm3)))
312+
$AddSubExtInstrBase ($i; UXSH; $size; $f; X(rm)(15..0) as UIntX << imm3; UXTH; none; (WSize(rm), ", uxth #", udec(imm3)))
313+
$AddSubExtInstrBase ($i; UXSW; $size; $f; X(rm)(31..0) as UIntX << imm3; UXTW; none; (WSize(rm), ", uxtw #", udec(imm3)))
314+
$AddSubExtInstrBase ($i; UXSX; $size; $f; X(rm)(63..0) as UIntX << imm3; UXTX; none; ($size(rm), ", uxtx #", udec(imm3)))
315+
$AddSubExtInstrBase ($i; SXSB; $size; $f; X(rm)( 7..0) as SIntX << imm3; SXTB; none; (WSize(rm), ", sxtb #", udec(imm3)))
316+
$AddSubExtInstrBase ($i; SXSH; $size; $f; X(rm)(15..0) as SIntX << imm3; SXTH; none; (WSize(rm), ", sxth #", udec(imm3)))
317+
$AddSubExtInstrBase ($i; SXSW; $size; $f; X(rm)(31..0) as SIntX << imm3; SXTW; none; (WSize(rm), ", sxtw #", udec(imm3)))
318+
$AddSubExtInstrBase ($i; SXSX; $size; $f; X(rm)(63..0) as SIntX << imm3; SXTX; none; ($size(rm), ", sxtx #", udec(imm3)))
319319
}
320320

321321

@@ -340,16 +340,16 @@ instruction set architecture AArch64Base = {
340340
}
341341
encoding $i.id = { op = $i.opcode, sf = SF::$size, ff = FF::$f.ff, sh = $sh }
342342
assembly $i.id = ( $i.mnemo, $f.mext, ' ', AsId($size, match: Str ($f.ff = OffFlags => "SP" ; _ => ""))(rd),
343-
', ', AsId($size, "SP")(rn), ', ', "#", decimal($immEx), $asm )
343+
', ', AsId($size, "SP")(rn), ', ', "#", udec($immEx), $asm )
344344
}
345345

346346
model ExtInstrStr (i: InstrWithFunct, ext: Str): InstrWithFunct = {
347347
(AsId ($i.id, $ext); $i.mnemo; $i.opcode; $i.funct)
348348
}
349349

350350
model AddSubImmInstr (i: InstrWithFunct, size: Id, f: Flags): IsaDefs = {
351-
$AddSubImmInstrShft ($ExtInstrStr ($i; "I" ); $size; $f; imm12X; 0 ; "") // decimal(imm12)
352-
$AddSubImmInstrShft ($ExtInstrStr ($i; "I12"); $size; $f; imm12S; 1 ; "") // (decimal(imm12), ", lsl #12")
351+
$AddSubImmInstrShft ($ExtInstrStr ($i; "I" ); $size; $f; imm12X; 0 ; "") // udec(imm12)
352+
$AddSubImmInstrShft ($ExtInstrStr ($i; "I12"); $size; $f; imm12S; 1 ; "") // (udec(imm12), ", lsl #12")
353353
}
354354

355355

@@ -379,9 +379,9 @@ instruction set architecture AArch64Base = {
379379

380380
model AddSubSftInstr (i: InstrWithFunct, size: Id, f: Flags): IsaDefs = {
381381
$AddSubSftInstrBase ($i; $size; $f; $WXReg(rm; $size); imm6 = 0, shift = ShiftType::LSL; "") // TODO pseudo instruction
382-
$AddSubSftInstrBase ($ExtInstrStr ($i; "LSL"); $size; $f; $WXReg(rm; $size) as Bits << imm6; shift = ShiftType::LSL; (", lsl #", decimal(imm6)))
383-
$AddSubSftInstrBase ($ExtInstrStr ($i; "LSR"); $size; $f; $WXReg(rm; $size) as UInt >> imm6; shift = ShiftType::LSR; (", lsr #", decimal(imm6)))
384-
$AddSubSftInstrBase ($ExtInstrStr ($i; "ASR"); $size; $f; $WXReg(rm; $size) as SInt >> imm6; shift = ShiftType::ASR; (", asr #", decimal(imm6)))
382+
$AddSubSftInstrBase ($ExtInstrStr ($i; "LSL"); $size; $f; $WXReg(rm; $size) as Bits << imm6; shift = ShiftType::LSL; (", lsl #", udec(imm6)))
383+
$AddSubSftInstrBase ($ExtInstrStr ($i; "LSR"); $size; $f; $WXReg(rm; $size) as UInt >> imm6; shift = ShiftType::LSR; (", lsr #", udec(imm6)))
384+
$AddSubSftInstrBase ($ExtInstrStr ($i; "ASR"); $size; $f; $WXReg(rm; $size) as SInt >> imm6; shift = ShiftType::ASR; (", asr #", udec(imm6)))
385385
}
386386

387387

@@ -433,7 +433,7 @@ instruction set architecture AArch64Base = {
433433
instruction $i.id: RelAddressFormat =
434434
X(rd) := $ex
435435
encoding $i.id = { op = $i.opcode }
436-
assembly $i.id = ($i.mnemo, ' ', decimal(imm21))
436+
assembly $i.id = ($i.mnemo, XSize(rd), ', ', ' ', sdec(imm21))
437437
}
438438

439439
model AddressRelInstr (i: InstrNoFunct): IsaDefs = {
@@ -739,7 +739,7 @@ instruction set architecture AArch64Base = {
739739
instruction AsId ($i.id, $pos): MovFormat =
740740
X(rd) := $posex
741741
encoding AsId ($i.id, $pos) = { sf = SF::$size, op = $i.opcode, pos = Position::$pos }
742-
assembly AsId ($i.id, $pos) = ($i.mnemo, ' ', $size(rd), ', #', decimal(imm16),
742+
assembly AsId ($i.id, $pos) = ($i.mnemo, ' ', $size(rd), ', #', udec(imm16),
743743
match: Str ($pos = Pos00 => ""; $pos = Pos16 => ", LSL #16"; $pos = Pos32 => ", LSL #32"; _ => ", LSL #48"))
744744
}
745745

0 commit comments

Comments
 (0)