cpprisc16  March 16, 2017
 All Namespaces Files Functions Variables Typedefs Macros
Namespaces | Macros | Functions
cppis1.hpp File Reference

Additional Instructions Set 1 IS[1]: 8 new instructions is1_* and 1 instruction modified is1_add. More...

#include "cpprisc16.hpp"
Include dependency graph for cppis1.hpp:

Go to the source code of this file.

Namespaces

 cpprisc16
 

Macros

#define is1_add_bo(result, a, b, label)
 (Add Branch if Overflow) R[result] <– R[a] + R[b] and if overflow then jump to label. More...
 
#define is1_bg(a, b, label)
 (Branch if Greater) If R[a] > R[b] then jump to label. More...
 
#define is1_bl(a, b, label)
 (Branch if Lower) If R[a] < R[b] then jump to label. More...
 
#define is1_sha_bo(result, a, b, label)
 (SHift Arithmetic) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...
 
#define is1_shl_bo(result, a, b, label)
 (SHift Logic if Overflow) R[result] <– (R[a] << R[b]) or (R[a] >> -R[b]) More...
 
#define is1_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::is1_add (unsigned int result, unsigned int a, unsigned int b)
 R[result] <– R[a] + R[b]. More...
 
void cpprisc16::is1_nor (unsigned int result, unsigned int a, unsigned int b)
 R[result] <– R[a] NOR R[b] (== ~(a | b)) More...
 
bool cpprisc16::is1_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::is1_shifti (unsigned int result, unsigned int a, immed_t immed7)
 (Shift Immediate) R[result] <– (R[a] << immed5) or (R[a] >> -immed5) More...
 
bool cpprisc16::is1_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::is1_sub (unsigned int result, unsigned int a, unsigned int b)
 R[result] <– R[a] - R[b]. More...
 
void cpprisc16::is1_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 1 IS[1]: 8 new instructions is1_* and 1 instruction modified is1_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 cppis1.hpp.

Macro Definition Documentation

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

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

Count for 1 instruction.

Definition at line 32 of file cppis1.hpp.

#define is1_bg (   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

(Branch if Greater) If R[a] > R[b] then jump to label.

Count for 1 instruction.

Definition at line 46 of file cppis1.hpp.

#define is1_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

(Branch if Lower) If R[a] < R[b] then jump to label.

Count for 1 instruction.

Definition at line 61 of file cppis1.hpp.

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

(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.

And if overflow then jump to label.

Count for 1 instruction.

Returns
true iff overflow

Definition at line 84 of file cppis1.hpp.

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

(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.

And if overflow then jump to label.

Count for 1 instruction.

Definition at line 104 of file cppis1.hpp.

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

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

Count for 1 instruction.

Definition at line 119 of file cppis1.hpp.