mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2025-02-18 00:30:43 +00:00
verilog: fixed silice <ccast> case
This commit is contained in:
parent
6a21b467cf
commit
bb818c34f8
@ -1018,6 +1018,10 @@ export class HDLModuleWASM implements HDLModuleRunner {
|
|||||||
return this.bmod.i64.extend_u(val);
|
return this.bmod.i64.extend_u(val);
|
||||||
} else if (tsrc.left > 31 && tdst.left <= 31) { // 64 -> 32
|
} else if (tsrc.left > 31 && tdst.left <= 31) { // 64 -> 32
|
||||||
return this.bmod.i32.wrap(val);
|
return this.bmod.i32.wrap(val);
|
||||||
|
} else if (tsrc.left < 31 && tdst.left == 31 && tsrc.signed) { // sign extend via shift (silice case)
|
||||||
|
let inst = this.i3264(tdst);
|
||||||
|
var shift = inst.const(31 - tsrc.left, 0);
|
||||||
|
return inst.shr_s(inst.shl(val, shift), shift);
|
||||||
}
|
}
|
||||||
throw new HDLError([tsrc, tdst], `cannot cast ${tsrc.left}/${tsrc.signed} to ${tdst.left}/${tdst.signed}`);
|
throw new HDLError([tsrc, tdst], `cannot cast ${tsrc.left}/${tsrc.signed} to ${tdst.left}/${tdst.signed}`);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user