14 #ifndef CPPRISC16_CPPRISC16_CPPIS2_HPP_ 15 #define CPPRISC16_CPPRISC16_CPPIS2_HPP_ 31 #define is2_add_bo(result, a, b, label) { \ 32 assert(a < cpprisc16::nb_registers); \ 33 assert(b < cpprisc16::nb_registers); \ 35 if (is2_add(result, a, b)) { goto label; } \ 45 #define is2_bl(a, b, label) { \ 46 assert(a < cpprisc16::nb_registers); \ 47 assert(b < cpprisc16::nb_registers); \ 49 ++cpprisc16::nb_executed; \ 50 if (cpprisc16::registers[a] < cpprisc16::registers[b]) { goto label; } \ 68 #define is2_sha_bo(result, a, b, label) { \ 69 assert(a < cpprisc16::nb_registers); \ 70 assert(b < cpprisc16::nb_registers); \ 72 if (is2_sha(result, a, b)) { goto label; } \ 88 #define is2_shl_bo(result, a, b, label) { \ 89 assert(a < cpprisc16::nb_registers); \ 90 assert(b < cpprisc16::nb_registers); \ 92 if (is2_shl(result, a, b)) { goto label; } \ 103 #define is2_sub_bo(result, a, b, label) { \ 104 assert(a < cpprisc16::nb_registers); \ 105 assert(b < cpprisc16::nb_registers); \ 107 if (is2_sub(result, a, b)) { goto label; } \ 127 is2_add(
unsigned int result,
unsigned int a,
unsigned int b);
140 is2_mul(
unsigned int result,
unsigned int a,
unsigned int b);
149 is2_nor(
unsigned int result,
unsigned int a,
unsigned int b);
166 is2_sha(
unsigned int result,
unsigned int a,
unsigned int b);
203 is2_shl(
unsigned int result,
unsigned int a,
unsigned int b);
216 is2_sub(
unsigned int result,
unsigned int a,
unsigned int b);
225 is2_xor(
unsigned int result,
unsigned int a,
unsigned int b);
230 #endif // CPPRISC16_CPPRISC16_CPPIS2_HPP_ void is2_xor(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] XOR R[b] (== ~(a ^ b))
bool is2_shl(unsigned int result, unsigned int a, unsigned int b)
(SHift Logic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])
void is2_shifti(unsigned int result, unsigned int a, immed_t immed7)
(Shift Immediate) R[result] <– (R[a] << immed5) or (R[a] >> -immed5)
bool is2_sha(unsigned int result, unsigned int a, unsigned int b)
(SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])
std::uint16_t immed_t
Type for immediate value.
void is2_mul(unsigned int result, unsigned int a, unsigned int b)
R[result - 1]:R[result] <– R[a]*R[b].
Instructions set of RiSC16: 8 instructions i_* and 4 pseudo-instructions p_*.
bool is2_add(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] + R[b].
bool is2_sub(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] - R[b].
void is2_nor(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] NOR R[b] (== ~(a | b))