| 
    Avr8bit-emulator
    
   An emulator for the Atmel AVR 8-bit microcontroller 
   | 
 
Arithmetic and logic operations. More...


Go to the source code of this file.
Functions | |
| void | add (uint8_t d, uint8_t r, struct CORE *core) | 
| Add without carry.   | |
| void | adc (uint8_t d, uint8_t r, struct CORE *core) | 
| Add with carry.   | |
| void | adiw (uint8_t d, uint8_t K, struct CORE *core) | 
| Add immediate to word.   | |
| void | sub (uint8_t d, uint8_t r, struct CORE *core) | 
| Subtract.   | |
| void | subi (uint8_t d, uint8_t K, struct CORE *core) | 
| Subtract immediate.   | |
| void | sbc (uint8_t d, uint8_t r, struct CORE *core) | 
| Subtract with carry.   | |
| void | sbci (uint8_t d, uint8_t K, struct CORE *core) | 
| Subtract immediate with carry.   | |
| void | sbiw (uint8_t d, uint8_t K, struct CORE *core) | 
| Subtract immediate from word.   | |
| void | and (uint8_t d, uint8_t r, struct CORE *core) | 
| Logical AND.   | |
| void | andi (uint8_t d, uint8_t K, struct CORE *core) | 
| Logical AND with immediate.   | |
| void | or (uint8_t d, uint8_t r, struct CORE *core) | 
| Logical OR.   | |
| void | ori (uint8_t d, uint8_t K, struct CORE *core) | 
| Logical OR with immediate.   | |
| void | eor (uint8_t d, uint8_t r, struct CORE *core) | 
| Perform bitwise exclusive OR between two registers.   | |
| void | com (uint8_t d, struct CORE *core) | 
| Perform one's complement on a register.   | |
| void | neg (uint8_t d, struct CORE *core) | 
| Perform two's complement (negation) on a register.   | |
| void | sbr (uint8_t d, uint8_t K, struct CORE *core) | 
| Set bits in a register.   | |
| void | cbr (uint8_t d, uint8_t K, struct CORE *core) | 
| Clear bits in a register.   | |
| void | inc (uint8_t d, struct CORE *core) | 
| Increment the value of a register.   | |
| void | dec (uint8_t d, struct CORE *core) | 
| Decrement the value of a register.   | |
| void | tst (uint8_t d, struct CORE *core) | 
| Test for zero or minus after AND operation.   | |
| void | clr (uint8_t d, struct CORE *core) | 
| Clear a register (set to zero).   | |
| void | ser (uint8_t d, struct CORE *core) | 
| Set all bits in a register.   | |
| void | mul (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies two unsigned 8-bit integers and stores the result in the CORE structure.   | |
| void | muls (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies two signed 8-bit integers and stores the result in the CORE structure.   | |
| void | mulsu (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies a signed 8-bit integer with an unsigned 8-bit integer and stores the result in the CORE structure.   | |
| void | fmul (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies two unsigned 8-bit integers with fractional representation and stores the result in the CORE structure.   | |
| void | fmuls (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies two signed 8-bit integers with fractional representation and stores the result in the CORE structure.   | |
| void | fmulsu (uint8_t d, uint8_t r, struct CORE *core) | 
| Multiplies a signed 8-bit integer with an unsigned 8-bit integer with fractional representation and stores the result in the CORE structure.   | |
Arithmetic and logic operations.
Contains all atomic arithmetic and logic operations
Definition in file arithm_logic.h.
| void adc | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Add with carry.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 19 of file arithm_logic.c.
References SREG::C, CORE::gp, inc_pc(), GP::R, CORE::sreg, and update_sreg_arithm().
| void add | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Add without carry.
| d | Destination register index | 
| r | Source register index | 
| core | Pointer to the CORE structure | 
Definition at line 3 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_arithm().
| void adiw | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Add immediate to word.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 35 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and udpate_sreg_arithm_16bit().
| void and | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Logical AND.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 133 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_logic().
| void andi | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Logical AND with immediate.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 147 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_logic().
| void cbr | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Clear bits in a register.
| d | Destination register. | 
| K | Constant value to clear bits. | 
| core | Pointer to the CORE structure. | 
Definition at line 238 of file arithm_logic.c.
| void clr | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Clear a register (set to zero).
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 278 of file arithm_logic.c.
| void com | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Perform one's complement on a register.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 203 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, update_sreg_C(), and update_sreg_logic().
| void dec | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Decrement the value of a register.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 258 of file arithm_logic.c.
| void eor | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Perform bitwise exclusive OR between two registers.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 189 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_logic().
| void fmul | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies two unsigned 8-bit integers with fractional representation and stores the result in the CORE structure.
| d | First operand. | 
| r | Second operand. | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 334 of file arithm_logic.c.
| void fmuls | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies two signed 8-bit integers with fractional representation and stores the result in the CORE structure.
| d | First operand. | 
| r | Second operand. | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 346 of file arithm_logic.c.
| void fmulsu | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies a signed 8-bit integer with an unsigned 8-bit integer with fractional representation and stores the result in the CORE structure.
| d | First operand (signed). | 
| r | Second operand (unsigned). | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 358 of file arithm_logic.c.
| void inc | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Increment the value of a register.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 248 of file arithm_logic.c.
| void mul | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies two unsigned 8-bit integers and stores the result in the CORE structure.
| d | First operand. | 
| r | Second operand. | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 298 of file arithm_logic.c.
| void muls | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies two signed 8-bit integers and stores the result in the CORE structure.
| d | First operand. | 
| r | Second operand. | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 310 of file arithm_logic.c.
| void mulsu | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Multiplies a signed 8-bit integer with an unsigned 8-bit integer and stores the result in the CORE structure.
| d | First operand (signed). | 
| r | Second operand (unsigned). | 
| core | Pointer to the CORE structure where the result will be stored. | 
Definition at line 322 of file arithm_logic.c.
| void neg | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Perform two's complement (negation) on a register.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 218 of file arithm_logic.c.
| void or | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Logical OR.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 161 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_logic().
| void ori | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Logical OR with immediate.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 175 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_logic().
| void sbc | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Subtract with carry.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 84 of file arithm_logic.c.
References SREG::C, CORE::gp, inc_pc(), GP::R, CORE::sreg, and update_sreg_arithm().
| void sbci | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Subtract immediate with carry.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 100 of file arithm_logic.c.
References SREG::C, CORE::gp, inc_pc(), GP::R, CORE::sreg, and update_sreg_arithm().
| void sbiw | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Subtract immediate from word.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 116 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and udpate_sreg_arithm_16bit().
| void sbr | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Set bits in a register.
| d | Destination register. | 
| K | Constant value to set bits. | 
| core | Pointer to the CORE structure. | 
Definition at line 228 of file arithm_logic.c.
| void ser | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Set all bits in a register.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 288 of file arithm_logic.c.
| void sub | ( | uint8_t | d, | 
| uint8_t | r, | ||
| struct CORE * | core | ||
| ) | 
Subtract.
| d | Destination register. | 
| r | Source register. | 
| core | Pointer to the CORE structure. | 
Definition at line 52 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_arithm().
| void subi | ( | uint8_t | d, | 
| uint8_t | K, | ||
| struct CORE * | core | ||
| ) | 
Subtract immediate.
| d | Destination register. | 
| K | Immediate value. | 
| core | Pointer to the CORE structure. | 
Definition at line 68 of file arithm_logic.c.
References CORE::gp, inc_pc(), GP::R, and update_sreg_arithm().
| void tst | ( | uint8_t | d, | 
| struct CORE * | core | ||
| ) | 
Test for zero or minus after AND operation.
| d | Destination register. | 
| core | Pointer to the CORE structure. | 
Definition at line 268 of file arithm_logic.c.