20 lines
758 B
Plaintext
20 lines
758 B
Plaintext
// When substracting from an unsigned value, the result cannot auto-cast to the same unsigned type (e.g. "value of UI<32> - 1" gives a SI<33>, cannot be cast to UI<32>)
|
|
|
|
InstructionSet Zbb {
|
|
architectural_state {
|
|
unsigned int XLEN=32;
|
|
const register unsigned<32> XLEN_R = 32;
|
|
register unsigned<XLEN> X[32] [[is_main_reg]];
|
|
}
|
|
instructions {
|
|
TEST {
|
|
encoding: 12'b011000000000 :: rs1[4:0] :: 3'b001 :: rd[4:0] :: 7'b0010011;
|
|
assembly: "{name(rd)}, {name(rs1)}";
|
|
behavior: {
|
|
unsigned int test = XLEN_R - 1;
|
|
//unsigned int test = (unsigned int)(XLEN_R - 1);
|
|
X[rd] = test;
|
|
}
|
|
}
|
|
}
|
|
} |