14 #ifndef CPPRISC16_CPPRISC16_CPPIS1_HPP_ 15 #define CPPRISC16_CPPRISC16_CPPIS1_HPP_ 32 #define is1_add_bo(result, a, b, label) { \ 33 assert(a < cpprisc16::nb_registers); \ 34 assert(b < cpprisc16::nb_registers); \ 36 if (is1_add(result, a, b)) { goto label; } \ 46 #define is1_bg(a, b, label) { \ 47 assert(a < cpprisc16::nb_registers); \ 48 assert(b < cpprisc16::nb_registers); \ 50 ++cpprisc16::nb_executed; \ 51 if (cpprisc16::registers[a] > cpprisc16::registers[b]) { goto label; } \ 61 #define is1_bl(a, b, label) { \ 62 assert(a < cpprisc16::nb_registers); \ 63 assert(b < cpprisc16::nb_registers); \ 65 ++cpprisc16::nb_executed; \ 66 if (cpprisc16::registers[a] < cpprisc16::registers[b]) { goto label; } \ 84 #define is1_sha_bo(result, a, b, label) { \ 85 assert(a < cpprisc16::nb_registers); \ 86 assert(b < cpprisc16::nb_registers); \ 88 if (is1_sha(result, a, b)) { goto label; } \ 104 #define is1_shl_bo(result, a, b, label) { \ 105 assert(a < cpprisc16::nb_registers); \ 106 assert(b < cpprisc16::nb_registers); \ 108 if (is1_shl(result, a, b)) { goto label; } \ 119 #define is1_sub_bo(result, a, b, label) { \ 120 assert(a < cpprisc16::nb_registers); \ 121 assert(b < cpprisc16::nb_registers); \ 123 if (is1_sub(result, a, b)) { goto label; } \ 143 is1_add(
unsigned int result,
unsigned int a,
unsigned int b);
152 is1_nor(
unsigned int result,
unsigned int a,
unsigned int b);
169 is1_sha(
unsigned int result,
unsigned int a,
unsigned int b);
206 is1_shl(
unsigned int result,
unsigned int a,
unsigned int b);
219 is1_sub(
unsigned int result,
unsigned int a,
unsigned int b);
228 is1_xor(
unsigned int result,
unsigned int a,
unsigned int b);
233 #endif // CPPRISC16_CPPRISC16_CPPIS1_HPP_ bool is1_add(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] + R[b].
void is1_nor(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] NOR R[b] (== ~(a | b))
void is1_xor(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] XOR R[b] (== ~(a ^ b))
bool is1_sub(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] - R[b].
std::uint16_t immed_t
Type for immediate value.
Instructions set of RiSC16: 8 instructions i_* and 4 pseudo-instructions p_*.
bool is1_shl(unsigned int result, unsigned int a, unsigned int b)
(SHift Logic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])
bool is1_sha(unsigned int result, unsigned int a, unsigned int b)
(SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])
void is1_shifti(unsigned int result, unsigned int a, immed_t immed7)
(Shift Immediate) R[result] <– (R[a] << immed5) or (R[a] >> -immed5)