cpprisc16  January 4, 2019
cppis2.hpp File Reference

Additional Instructions Set 2 IS[2]: 8 new instructions is2_* and 1 instruction modified is2_add. More...

`#include "cpprisc16.hpp"`
Include dependency graph for cppis2.hpp:

Go to the source code of this file.

cpprisc16

## Macros

(Add Branch if Overflow) R[result] <– R[a] + R[b] and if overflow then jump to label. More...

#define is2_bl(a, b, label)
(Branch if Lower) If R[a] < R[b] then jump to label. More...

#define is2_sha_bo(result, a, b, label)
(SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...

#define is2_shl_bo(result, a, b, label)
(SHift Logic if Overflow) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...

#define is2_sub_bo(result, a, b, label)
(Sub Branch if Overflow) R[result] <– R[a] - R[b] and if overflow then jump to label. More...

## Functions

bool cpprisc16::is2_add (unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] + R[b]. More...

void cpprisc16::is2_mul (unsigned int result, unsigned int a, unsigned int b)
R[result - 1]:R[result] <– R[a]*R[b]. More...

void cpprisc16::is2_nor (unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] NOR R[b] (== ~(a | b)) More...

bool cpprisc16::is2_sha (unsigned int result, unsigned int a, unsigned int b)
(SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...

void cpprisc16::is2_shifti (unsigned int result, unsigned int a, immed_t immed7)
(Shift Immediate) R[result] <– (R[a] << immed5) or (R[a] >> -immed5) More...

bool cpprisc16::is2_shl (unsigned int result, unsigned int a, unsigned int b)
(SHift Logic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...

bool cpprisc16::is2_sub (unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] - R[b]. More...

void cpprisc16::is2_xor (unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] XOR R[b] (== ~(a ^ b)) More...

## Detailed Description

Additional Instructions Set 2 IS[2]: 8 new instructions is2_* and 1 instruction modified is2_add.

(March 15, 2017) Piece of cpprisc16. https://bitbucket.org/OPiMedia/cpprisc16

GPLv3 — Copyright (C) 2017 Olivier Pirson http://www.opimedia.be/

Definition in file cppis2.hpp.

## Macro Definition Documentation

 #define is2_add_bo ( result, a, b, label )
Value:
{ \
assert(a < cpprisc16::nb_registers); \
assert(b < cpprisc16::nb_registers); \
\
if (is2_add(result, a, b)) { goto label; } \
}
const unsigned int nb_registers
Number of registers: 8 word16_t items.
Definition: cpprisc16.cpp:28
bool is2_add(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] + R[b].
Definition: cppis2.cpp:24

Count for 1 instruction.

Definition at line 31 of file cppis2.hpp.

## ◆ is2_bl

 #define is2_bl ( a, b, label )
Value:
{ \
assert(a < cpprisc16::nb_registers); \
assert(b < cpprisc16::nb_registers); \
\
if (cpprisc16::registers[a] < cpprisc16::registers[b]) { goto label; } \
}
word16_t registers[8]
Registers.
Definition: cpprisc16.cpp:43
const unsigned int nb_registers
Number of registers: 8 word16_t items.
Definition: cpprisc16.cpp:28
uint64_t nb_executed
Number of instructions executed.
Definition: cpprisc16.cpp:41

Count for 1 instruction.

Definition at line 45 of file cppis2.hpp.

## ◆ is2_sha_bo

 #define is2_sha_bo ( result, a, b, label )
Value:
{ \
assert(a < cpprisc16::nb_registers); \
assert(b < cpprisc16::nb_registers); \
\
if (is2_sha(result, a, b)) { goto label; } \
}
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])
Definition: cppis2.cpp:63
const unsigned int nb_registers
Number of registers: 8 word16_t items.
Definition: cpprisc16.cpp:28

(SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])

If R[b] >= 0 then shift to the left, else shift to the right with duplication of the sign bit.

Count for 1 instruction.

Returns
true iff overflow

Definition at line 68 of file cppis2.hpp.

## ◆ is2_shl_bo

 #define is2_shl_bo ( result, a, b, label )
Value:
{ \
assert(a < cpprisc16::nb_registers); \
assert(b < cpprisc16::nb_registers); \
\
if (is2_shl(result, a, b)) { goto label; } \
}
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])
Definition: cppis2.cpp:73
const unsigned int nb_registers
Number of registers: 8 word16_t items.
Definition: cpprisc16.cpp:28

(SHift Logic if Overflow) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b])

If R[b] >= 0 then shift to the left, else shift to the right.

Count for 1 instruction.

Definition at line 88 of file cppis2.hpp.

## ◆ is2_sub_bo

 #define is2_sub_bo ( result, a, b, label )
Value:
{ \
assert(a < cpprisc16::nb_registers); \
assert(b < cpprisc16::nb_registers); \
\
if (is2_sub(result, a, b)) { goto label; } \
}
const unsigned int nb_registers
Number of registers: 8 word16_t items.
Definition: cpprisc16.cpp:28
bool is2_sub(unsigned int result, unsigned int a, unsigned int b)
R[result] <– R[a] - R[b].
Definition: cppis2.cpp:93

(Sub Branch if Overflow) R[result] <– R[a] - R[b] and if overflow then jump to label.

Count for 1 instruction.

Definition at line 103 of file cppis2.hpp.