22 is1_add(
unsigned int result,
unsigned int a,
unsigned int b) {
27 assert(
sizeof(
unsigned int) >
sizeof(
word16_t));
29 const std::uint32_t sum = (
static_cast<std::uint32_t
>(
registers[a])
30 + static_cast<std::uint32_t>(
registers[b]));
37 return (sum >> 16) != 0;
42 is1_nor(
unsigned int result,
unsigned int a,
unsigned int b) {
55 is1_sha(
unsigned int result,
unsigned int a,
unsigned int b) {
62 const bool left = (
static_cast<std::int16_t
>(
registers[b]) >= 0);
71 : static_cast<std::uint16_t>(
registers[a] << (16 - nb))) != 0;
76 :
static_cast<std::int16_t
>(
registers[a]) >> nb);
83 const bool overflow = (
registers[a] != 0);
93 is1_shl(
unsigned int result,
unsigned int a,
unsigned int b) {
100 const bool left = (
static_cast<std::int16_t
>(
registers[b]) >= 0);
109 : static_cast<std::uint16_t>(
registers[a] << (16 - nb))) != 0;
121 const bool overflow = (
registers[a] != 0);
134 assert(immed7 <= 0x7F);
139 const bool arithmetic = immed7 & 0x20;
140 const bool right = immed7 & 0x10;
143 immed7 = -(immed7 | 0xFFF0);
154 ?
static_cast<std::int16_t
>(
registers[a]) >> immed7
170 is1_sub(
unsigned int result,
unsigned int a,
unsigned int b) {
178 registers[result] = diff;
188 is1_xor(
unsigned int result,
unsigned int a,
unsigned int b) {
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))
Additional Instructions Set 1 IS[1]: 8 new instructions is1_* and 1 instruction modified is1_add...
void is1_xor(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] XOR R[b] (== ~(a ^ b))
std::uint16_t word16_t
Type for register and memory items.
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.
word16_t registers[8]
Registers.
const unsigned int nb_registers
Number of registers: 8 word16_t items.
uint64_t nb_executed
Number of instructions executed.
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)