uM-FPU Floating Point
Coprocessor
V2 Datasheet
Introduction
The uM-FPU is a 32-bit floating point coprocessor that can be easily interfaced with microcontrollers to provide
support for 32-bit IEEE 754 floating point operations and long integer operations. The uM-FPU is easy to
connect using either an I2C or SPI compatible interface.
uM-FPU Features
8-pin integrated circuit.
I2C compatible interface up to 400 kHz
SPI compatible interface up to 4 Mhz
32 byte instruction buffer
Sixteen 32-bit general purpose registers for storing floating point or long integer values
Five 32-bit temporary registers with support for nested calculations (i.e. parentheses)
Floating Point Operations
Set, Add, Subtract, Multiply, Divide
Sqrt, Log, Log10, Exp, Exp10, Power, Root
Sin, Cos, Tan, Asin, Acos, Atan, Atan2
Floor, Ceil, Round, Min, Max, Fraction
Negate, Abs, Inverse
Convert Radians to Degrees, Convert Degrees to Radians
Read, Compare, Status
Long Integer Operations
Set, Add, Subtract, Multiply, Divide, Unsigned Divide
Increment, Decrement, Negate, Abs
And, Or, Xor, Not, Shift
Read 8-bit, 16-bit, and 32-bit
Compare, Unsigned Compare, Status
Conversion Functions
Convert 8-bit and 16-bit integers to floating point
Convert 8-bit and 16-bit integers to long integer
Convert long integer to floating point
Convert floating point to long integer
Convert floating point to formatted ASCII
Convert long integer to formatted ASCII
Convert ASCII to floating point
Convert ASCII to long integer
User Defined Functions can be stored in Flash memory
Conditional execution
Table lookup
Nth order polynomials
Micromega Corporation
1
Revised 2005-06-21
Pin Description and Connecting the uM-FPU
Pin Diagram and Pin Description
CS
SOUT
SCLK/SCL
VSS
1
8
2 uM -FPU 7
V2
3
6
TSTIN
TSTOUT
4
SIN/SDA
5
Pin
1
2
VDD
3
4
5
6
7
8
Name
CS
SOUT
Type
Input
Output
SCLK
SCL
VSS
SIN
SDA
TSTOUT
TSTIN
VDD
Input
Power
Input
In/Out
Output
Input
Power
Description
Chip Select
SPI Output
Busy/Ready
SPI Clock
I2C Clock
Ground
SPI Input
I2C Data
Test Output
Test Input
Supply Voltage
Connecting the uM-FPU to the I2C compatible interface
If the CS pin is a logic high at reset (e.g. tied to +5V), the uM-FPU will be configured as an I2C slave device. Using
an I2C interface allows the uM-FPU to share the I2C bus with other peripheral chips. The connection diagram is
shown below.
2
I C Connection
Microcontroller Pins
SDA
Note: SDA and SCL must
have pull-up resistors as
required by the I2C bus.
+5V
1 CS
2 SOUT
3
SCL
+5V
uM-FPU
SCL
4 VSS
VDD
TS TIN
TS TOUT
SDA
8
7
6
5
I2C Slave Address
The slave address is 7 bits long, followed by an 8th bit which specifies whether the master wishes to write to the
slave (0), or read from the slave(1). The default slave address for the uM-FPU is 1100100x (binary).
expressed as a 7-bit value, the default slave address is 100 (decimal), or 0x64 (hex).
expressed as a left justified 8-bit value the default slave address is 200 (decimal) or 0xC8 (hex).
The slave address can be changed using the built-in serial debug monitor and stored in nonvolatile flash memory.
I2C Bus Speed
The uM-FPU can handle I2C data speeds up to 400 kHz.
Micromega Corporation
2
uM-FPU V2 Datasheet
Resetting and Executing Instructions
I2C Data Transfers
The following diagrams show the write and read data transfers. A write transfer consists of a slave address, followed
by a register address, followed by 0 to n data bytes. A read transfer is normally preceded by a write transfer to select
the register to read from.
I2C Write Data Transfer
Slave
Register
Address
Address
Data
Data
S 1100100 0 A aaaaaaaa A dddddddd A dddddddd A P
0 to n data bytes
S - Start Condition
A - ACK/NAK
P - Stop Condition
I2C Read Data Transfer
Slave
Address
Data
Data
S 1100100 1 A dddddddd A dddddddd N P
S - Start Condition
A - ACK
N - NAK
P - Stop Condition
1 to n data bytes
I2C Registers
Register Address
0
1
Write
Data
Reset
Item
I2C transfer speed
Read Delay – normal operation
Read Delay – debug enabled
Read
Data / Status
Buffer Space
Min
Max
Unit
50
100
400
90
180
kHz
usec
usec
I2C Reset Operation
The uM-FPU should be reset at the beginning of every program to ensure that the microcontroller and the uM-FPU
are synchronized. The uM-FPU is reset by writing a zero byte to I2C register address 1. A delay of 8 milliseconds is
recommended after the reset operation to ensure that the Reset is complete and the uM-FPU is ready to receive
commands.. All uM-FPU registers are reset to the special value NaN (Not a Number), which is equal to hexadecimal
value 0x7FC00000.
I2C Reading and Writing Data
uM-FPU instructions and data are written to I2 C register 0. Reading I2 C register 0 will return the next data byte, if
data is waiting to be transferred. If no data is waiting to be transferred the Busy/Ready status is returned. A read
operation is normally preceded by a write operation to select the I2C register to read from.
Micromega Corporation
3
uM-FPU V2 Datasheet
Resetting and Executing Instructions
I2C Busy/Ready Status
The Busy/Ready status must always be checked to confirm that the uM-FPU is Ready prior to any read operation.
The Busy status is asserted as soon as a valid opcode is received. The Ready status is asserted when both the
instruction buffer and trace buffer are empty. If the uM-FPU is Ready, a zero byte is returned. If the uM-FPU is
Busy, either executing instructions, or because the debug monitor is active, a 0x80 byte is returned. If more than 32
bytes of data are sent between read operations, the Ready status must also be checked at least once every 32 bytes to
ensure that the instruction buffer does not overflow.
I2C Buffer Space
Reading I2C register 1 will return the number of bytes of free space in the instruction buffer. This can be used by
more advanced interface routines to ensure that the instruction buffer remains fully utilized. It is only used to
determine if there is space to write data to the uM-FPU. The Busy/Ready status must still be used to confirm the
Ready status prior to any read operation.
Read Delay
There is a minimum delay required from the end of a read instruction opcode until the first data byte is ready to be
read. If debug tracing is active, this delay is longer (see table). With many microcontrollers the call overhead for the
interface routines is long enough that no additional delay is required. On faster microcontrollers a suitable delay
must be inserted after a read instruction to ensure that data is valid before the first byte is read. A 180 microsecond
read delay will handle all circumstances (including the debug mode).
Connecting the uM-FPU using the SPI compatible interface
If the CS pin is a logic low at reset (e.g. tied to GND), the uM-FPU will be configured as a SPI slave device. The
uM-FPU can be connected using either a 2-wire or 3-wire SPI interface depending on the capabilities of the
microcontroller. The 3-wire SPI connection uses separate data input and data output pins on the microcontroller.
The 2-wire SPI connection uses a single bidirectional pin for both data input and data output. If a 2-wire SPI
interface is used, the SOUT and SIN pins should not be connected directly together, they must be connected
through a 1K resistor. The microcontroller data pin is connected to the SIN pin. The connection diagrams are
shown below.
2-wire SPI Connection
Microcontroller Pins
DATA
1K
1
2
3
4
CLK
Micromega Corporation
4
+5V
uM-FPU
8
CS
VDD
7
SOUT
TS TIN
6
SCLK TS TOUT
5
VSS
SIN
uM-FPU V2 Datasheet
Resetting and Executing Instructions
3-wire SPI Connection
Microcontroller Pins
DATA OUT
+5V
uM-FPU
1
2
3
CS
VDD
SOUT
TS TIN
SCLK TS TOUT
4 VSS
SIN
DATA IN
CLK
8
7
6
5
SPI Reset Operation
The uM-FPU should be reset at the beginning of every program to ensure that the microcontroller and the uM-FPU
are synchronized. To cause a Reset, the SIN line must be Low while the SCLK line is held High for a minimum of
500 microseconds. The reset operation will not occur until the SCLK line returns Low. A delay of 8 milliseconds is
recommended after the Reset to ensure that the Reset is complete and the uM-FPU is ready to receive commands.
All uM-FPU registers are reset to the special value NaN (Not a Number), which is equal to hexadecimal value
7FC00000.
Reset Timing Diagram
Reset
Reset Delay
SCLK
SIN
Item
Reset - SCLK Output High
Reset - SIN Output Low
Reset Delay
Min
500
100
3
Typical
8
Max
Unit
usec
usec
msec
SPI Reading and Writing Data
The uM-FPU is configured as a Serial Peripheral Interconnect (SPI) slave device. Data is transmitted and received
with the most significant bit (MSB) first using SPI mode 0, summarized as follows:
SCLK is active High (idle state is Low)
Data latched on leading edge of SCLK
Data changes on trailing edge of SCLK
Data is transmitted most significant bit first
The maximum SCLK frequency is 4 MHz, but there must be minimum data period between bytes. The minimum
data period is measured from the rising edge of the first bit of one date byte to the rising edge of the first bit of the
next data byte. The minimum data period must elapse before the Busy/Ready status is checked.
Read Delay
There is a minimum delay required from the end of a read instruction opcode until the first data byte is ready to be
read. If debug tracing is active, this delay is longer (see table). With many microcontrollers the call overhead for the
interface routines is long enough that no additional delay is required. On faster microcontrollers a suitable delay
must be inserted after a read instruction to ensure that data is valid before the first byte is read. A 180 microsecond
Micromega Corporation
5
uM-FPU V2 Datasheet
Resetting and Executing Instructions
read delay will handle all circumstances (including the debug mode).
SPI Instruction Timing Diagram
(Opcode)
Minimum
Data Period
SCLK
SIN
SOUT
Ready
Busy
Ready
Instruction Timing Diagram
(Opcode followed by an additional argument)
Minimum
Data Period
Minimum
Data Period
Minimum
Data Period
SCLK
SIN
SOUT
Ready
Busy
Ready
SPI Instruction Timing Diagram
(Opcode followed by return value)
Read Setup
Delay
Read Byte
Delay
Minimum
Data Period
SCLK
SIN
SOUT
Ready
Micromega Corporation
Busy
6
Ready
uM-FPU V2 Datasheet
Resetting and Executing Instructions
Item
Min
SCLK Frequency
SCLK Output Low (per bit)
SCLK Output High (per bit)
Minimum Data Period – normal operation
Minimum Data Period – debug trace enabled
Read Setup Delay – normal operation
Read Setup Delay – debug trace enabled
Read Byte Delay – normal operation
Read Byte Delay – debug trace enabled
0.125
0.125
10
15
90
180
10
15
Max
Unit
4
MHz
usec
usec
usec
usec
usec
usec
usec
usec
60
SPI Busy/Ready Status
The busy/ready status must always be checked to confirm the Ready status prior to any read operation.
The Busy status is asserted as soon as a valid opcode is received. The Ready status is asserted when both the
instruction buffer and trace buffer are empty. If the uM-FPU is Ready the SOUT pin is held Low. If the uM-FPU is
Busy, either executing instructions, or because the debug monitor is active, the SOUT pin is held High. The
minimum data period must have elapsed since the last byte was transmitted before the SOUT status is checked. If
more than 32 bytes of data are sent between read operations, the Ready status must also be checked at least once
every 32 bytes to ensure that the instruction buffer does not overflow.
Micromega Corporation
7
uM-FPU V2 Datasheet
Debug Monitor
Using the TSTIN and TSTOUT Pins
The TSTIN and TSTOUT pins can be configured as an activity monitor or as a serial interface for the built-in debug
monitor. The mode of operation is selected by the logic value of the TSTIN pin whenever the
uM-FPU is reset. If the serial interface is not being used, the TSTIN pin should be tied to GND.
Activity Monitor
If the TSTIN pin is Low when the uM-FPU is reset, the TSTOUT pin is configured to generate an activity
monitor signal. In this mode TSTOUT will be High when the uM-FPU is Busy, and will be Low when it is Ready.
TSTOUT can be connected to an LED to provide a visual activity indicator, used as an input to an oscilloscope or
logic analyzer during testing, or left unconnected.
Activity Indicator
Serial Interface for Debug Monitor
If the TSTIN pin is High when the uM-FPU is reset, the TSTIN pin is configured as a serial input and the
TSTOUT pin is configured as a serial output. The uM-FPU has a built-in debug monitor that is accessed
through the TSTIN and TSTOUT serial connection. This enables the uM-FPU to be easily connected to a
PC for debugging. The serial connection is configured as 57,600 baud, 8 bits, no parity, and one stop bit.
There is no flow control. Note: The idle state of an RS-232 connection will assert a high level on the TSTIN pin, so
provided the uM-FPU is connected to an active idle RS-232 port when the uM-FPU is reset,
TSTIN and TSTOUT will be properly configured as a serial interface.
Serial Interface Connection
Micromega Corporation
8
uM-FPU V2 Datasheet
Debug Monitor
Debug Monitor
The built-in debug monitor provides support for displaying the contents of uM-FPU registers, tracing the execution
of uM-FPU instructions, setting breakpoints for debugging, and programming user functions. Whenever the uMFPU is reset and the serial interface is enabled the following message is displayed:
{RESET}
Commands are specified by typing an uppercase or lowercase character followed by a return key. The command is
not processed (or echoed) until the return key is pressed. Once the return key is pressed, the command prompt and
command are displayed, and the command is executed. If the command is not recognized, a question mark is
displayed. Special commands are prefixed with a dollar sign. These commands are used to program the user
functions and to check the contents of the uM-FPU. They are not generally used when debugging a running
application. The $M and $P will reset the uM-FPU on completion. The commands are listed below:
B
G
R
T
V
/
$C
$D
$M
$P
Break
Go
Register
Trace
Version
Comment
Checksum
Display
Mode
Program
stop execution after next opcode
continue execution
display registers
toggle trace mode on/off
display version information
add comment to debug trace
display checksum value
display user function memory
set mode parameters
program user function memory
Break – stop execution after next opcode
The Break command is used to interrupt operation of the uM-FPU. The break will not occur until after the next
opcode that is not a SELECTA or SELECTB is executed by the uM-FPU. The debug monitor displays the hex value
of the last opcode executed and any additional data. Entering another Break command, or simply pressing the return
key, will single step to the next opcode. Entering the Go command
will continue execution.
>B
53
{BREAK}
(i.e. SET R3)
>
F6:0028
{BREAK}
>
(i.e. LOADWORD $0028)
80
{BREAK}
(i.e. FMUL R0)
>
02 51
{BREAK}
(i.e. SELECT R2; SET R1)
Go – continue execution
The Go command is used to continue normal execution after a Break command.
>G
Micromega Corporation
9
uM-FPU V2 Datasheet
Debug Monitor
Registers – display registers
The Register command displays the current contents of all uM-FPU registers.
>R
{A=R2, B=R0
R0:41200000 R1:3F16791A R2:3F16791A R3:40490FDB
R4:41200000 R5:41A00000 R6:7FC00000 R7:7FC00000
R8:7FC00000 R9:7FC00000 R10:7FC00000 R11:7FC00000
R12:7FC00000 R13:7FC00000 R14:7FC00000 R15:7FC00000
T1:7FC00000 T2:7FC00000 T3:7FC00000 T4:7FC00000
T5:7FC00000}
Trace – toggle trace mode on/off
The Trace command toggles the trace mode. The current state of the trace mode is displayed. When trace mode is
on, each opcode that is executed by the uM-FPU is displayed.
>T
{TRACE ON}
01 FA:55 F8" 1.00000" 53 F6:0002 80 95 E6 02 51 F6:000A 80 EA
F2 50 42:0000000A 01 FA:55 F8" 0.95106" 53 F6:0004 80 95 E6 02
51 F6:000A 80 EA F2 50 42:00000008 01 FA:55 F8" 0.80902" 53 F6:
0006 80 95 E6 02 51 F6:000A 80 EA F2 50 42:00000006 01 FA:55 F8
" 0.58779" 53 F6:0008 80 95 E6 02 51 F6:000A 80 EA F2 50 42:000
00003 01 FA:55 F8" 0.30902" 53 F6:000A 80 95 E6 02 51 F6:000A 8
0 EA F2 50 42:00000000 01 FA:55 F8" 0.00000" 53 F6:000C 80 95 E
6 02 51 F6:000A 80 EA F2 50 42:FFFFFFFD 01 FA:55 F8"-0.30902" 5
3 F6:000E 80 95 E6 02 51 F6:000A 80 EA F2 50 42:FFFFFFFA 01 FA:
55 F8"-0.58778" 53 F6:0010 80 95 E6 02 51 F6:000A 80 EA F2 50 4
2:FFFFFFF8 01 FA:55 F8"-0.80902" 53 F6:0012 80 95 E6 02 51 F6:0
00A 80 EA F2 50 42:FFFFFFF6 01 FA:55 F8"-0.95106" 53 F6:0014 80
95 E6 02 51 F6:000A 80 EA F2 50 42:FFFFFFF6 01 FA:55 F8"-1.000
00" 53 F6:0016 80 95 E6 02 51 F6:000A 80 EA F2 50 42:FFFFFFF6 0
1 FA:55 F8"-0.95106" 53 F6:0018 80 95 E6 02 51 F6:000A 80 EA F2
50 42:FFFFFFF8
>T
{TRACE OFF}
Version – display version information
The Version command displays the version string for the uM-FPU chip and the selected interface. If the selected
interface is I2C the I2C address is also shown.
>V
uM-FPU V2.0 I2C C8
Comment – add comment to debug trace
The comment command is used to insert short comment strings (up to six characters) in the debug session. This can
be useful to provide some notations to refer to when analyzing debug results.
>/test1
Checksum – display checksum value
The Checksum command displays a checksum for the uM-FPU chip, excluding the stored function area. This can be
used to confirm that the chip is valid.
>$C:000EC52B
Micromega Corporation
10
uM-FPU V2 Datasheet
Debug Monitor
Display – display user function memory
The Display command displays the contents of the user function memory in Intel Hex format. This can be used to
confirm the contents of the user function memory.
>$D
:103C0000200C230725413648483F588B7B107F1041
:103C10008310874498079A0F9E64B70FBB080000CE
:103C200000000000000000000000000000000000FF
:103C300000000000000000000000000000000000FF
:103C400000000000000000000000000000000000FF
:103C500000000000000000000000000000000000FF
:103C600000000000000000000000000000000000FF
:103C700000000000000000000000000000000000FF
:103C800005FEF05006FEF05007FEF050073041F0CB
.
.
.
:103F100000000000000000000000000000000000FF
:103F200000000000000000000000000000000000FF
:103F300000000000000000000000000000000000FF
Mode – set mode parameters
The Mode command is used to set the four interface mode parameter bytes that are stored in Flash memory. The
factory setting of the parameter bytes is all zeros. The parameter bytes are read at reset to determine the mode of
operation. The mode command displays the current parameter values and the user is prompted to enter new values.
(The values are entered as hexadecimal values.) The new values are programmed into Flash memory and the uMFPU is Reset.
>$M
00000000
:00CA0000
Two hexadecimal digits represent each parameter byte. The mode parameter bytes are interpreted as follows:
Byte 0:
BIT 7 6 5 4 3 2 1 0
B - T - - P MM
Bit 7
Bit 5
Bit 2
Bits 1:0
Break on Reset (if debug mode is enabled)
Trace on Reset (if debug mode is enabled)
PIC mode enabled (see PICMODE instruction)
Mode
00 – CS pin determines interface mode (default)
01 – I2C mode selected (CS pin ignored)
10 – SPI mode selected (CS pin ignored)
11 – SPI mode selected (CS pin is active as chip select for data transfers)
Byte 1:
I2C Address (if zero, the default address (0xC8) is used.
The 7-bit address is entered as a left justified 8-bit value. The last bit is ignored.
Byte 2:
reserved
Byte 3:
reserved
Micromega Corporation
11
uM-FPU V2 Datasheet
Debug Monitor
Program – program user function memory
The Program command is used to program the user function memory. Once in program mode, the uM-FPU looks for
valid Intel Hex format records. The records must have an address between 0x0000 and 0x03C0, start on a 64-byte
boundary, and have a length of 1 to 64 bytes. The data is not echoed, but an acknowledge character is sent after each
record. The acknowledge characters are as follows:
+
The record was programmed successfully.
F
A format error occurred.
A
An address error occurred.
C
A checksum error occurred.
P
A programming error occurred.
The uM-FPU IDE program (or another PC based application program) would normally be used to send the required
data for the program command. (See documentation for the uM-FPU IDE application program.) To exit the program
mode, an escape character
is sent. The program command will reset the uM-FPU on exit.
>$P
{*** PROGRAM MODE ***}
+++
{RESET}
Debug Opcodes
There are several opcodes that are designed to work in conjunction with the debug monitor. If the serial debug
monitor interface was not selected by the TSTIN pin at the last Reset, these commands are NOPs. The opcodes are
as follows:
BREAK
When this opcode is encountered a Break occurs and the debug monitor is entered. Execution will only resume when
a Go command is issued to the debug monitor.
TRACEOFF
Turns the debug trace mode off.
TRACEON
Turns the debug trace mode on. All opcodes will be traced on the debug terminal until the trace mode is turned off
by a TRACEOFF opcode or is turned off using the debug monitor.
TRACESTR
Displays a trace string to the debug monitor output. This can be useful for keeping track of a debug session. Trace
strings are always output; they are not affected by the trace mode.
Micromega Corporation
12
uM-FPU V2 Datasheet
Stored Functions
Stored Functions
There are 1024 bytes of flash memory reserved on the uM-FPU for storing user functions and the mode paramaters.
Up to 64 user functions can be defined and saved by the user. Stored user functions have the advantage of
conserving space on the microcontroller and greatly reducing the communications overhead between the
microcontroller and the uM-FPU. In addition, certain instructions (e.g. IF_XXX, TABLE, POLY) are only valid in
user defined functions. Opcodes FE00 through FE3F are used to execute the stored user functions 0 through 63. The
Busy condition remains set while all of the opcodes in the stored function execute.
User function memory is divided into two sections: the header section and the data section. The header section is
located at program address 0x0000 and consists of 64 pairs of bytes that specify the offset to the data section and the
length of the stored function. The offset is specified as the address divided by 4, therefore all stored functions must
start on an even 4-byte boundary.
The data section contains the opcodes and data for the instructions that make up the user defined function. User
functions are programmed using the serial debug monitor. The uM-FPU IDE application supports the definition of
user functions. (Refer to uM-FPU IDE documentation.)
Micromega Corporation
13
uM-FPU V2 Datasheet
Absolute Maximum Ratings
Absolute Maximum Ratings
Parameter
Storage Temperature
Ambient Temperature with Power Applied
Supply Voltage on VDD relative to VSS
DC Input Voltage VSS
Maximum Current into any I/O Pin
Recommended VDD Operating Range
Supply Current
Minimum
-55
-40
-0.5
-0.5
-25
4.75
-
Typical
7
Maximum
+100
+70
+6.0
VDD+0.5
+50
5.25
-
Units
° Celsius
° Celsius
V
V
mA
V
mA
Further Information
Check the Micromega website at www.micromegacorp.com
Micromega Corporation
14
uM-FPU V2 Datasheet
Appendix A – Instruction Summary
Appendix A
uM-FPU V2 Instruction Summary
Opcode Name
Data
Type
Opcode
SELECTA
0x
SELECTB
1x
Arguments
B Reg Description
Select A register
x
FWRITEA
Float
2x
yyyy zzzz
FWRITEB
Float
3x
yyyy zzzz
FREAD
FSET/LSET
FADD
FSUB
FMUL
FDIV
LADD
LSUB
LMUL
Float
Either
Float
Float
Float
Float
Long
Long
Long
4x
5x
6x
7x
8x
9x
Ax
Bx
Cx
LDIV
Long
Dx
SQRT
LOG
LOG10
EXP
EXP10
SIN
COS
TAN
FLOOR
CEIL
ROUND
NEGATE
ABS
INVERSE
Float
Float
Float
Float
Float
Float
Float
Float
Float
Float
Float
Float
Float
Float
E0
E1
E2
E3
E4
E5
E6
E7
E8
E9
EA
EB
EC
ED
DEGREES
Float
EE
RADIANS
Float
EF
SYNC
Returns
x
yyyy zzzz
x
x
x
x
x
x
x
x
F0
5C
FLOAT
Long
F1
0
FIX
Float
F2
0
FCOMPARE
Float
F3
LOADBYTE
Float
F4
bb
0
LOADUBYTE
Float
F5
bb
0
LOADWORD
Float
F6
wwww
0
LOADUWORD
Float
F7
wwww
0
Micromega Corporation
ss
15
Select B register
Select A register, Write floating point
value to A register
Select B register, Write floating point
value to B register
Read register
Select B register, A = B
Select B register, A = A + B
Select B register, A = A - B
Select B register, A = A * B
Select B register, A = A / B
Select B register, A = A + B
Select B register, A = A -B
Select B register, A = A * B
Select B register, A = A / B
Remainder stored in register 0
A = sqrt(A)
A = ln(A)
A = log(A)
A = e ** A
A = 10 ** A
A = sin(A) radians
A = cos(A) radians
A = tan(A) radians
A = nearest integer = A
A = nearest integer to A
A = -A
A = |A|
A=1/A
Convert radians to degrees
A = A / (PI / 180)
Convert degrees to radians
A = A * (PI / 180)
Synchronization
Copy A to register 0
Convert long to float
Copy A to register 0
Convert float to long
Compare A and B
(floating point)
Write signed byte to register 0
Convert to float
Write unsigned byte to register 0
Convert to float
Write signed word to register 0
Convert to float
Write unsigned word to register 0
Convert to float
uM-FPU V2 Datasheet
Appendix A – Instruction Summary
READSTR
F8
aa … 00
ATOF
Float
F9
aa … 00
FTOA
Float
FA
ff
ATOL
Long
FB
aa … 00
LTOA
Long
FC
ff
FSTATUS
Float
FD
XOP
FE
NOP
FF
FE0n
FE1n
FE2n
FE3n
FUNCTION
0
ss
0
IF_FSTATUSA
Float
FE80
ss
IF_FSTATUSB
Float
FE81
ss
IF_FCOMPARE
Float
FE82
ss
IF_LSTATUSA
Long
FE83
ss
IF_LSTATUSB
Long
FE84
ss
IF_LCOMPARE
Long
FE85
ss
IF_LUCOMPARE
Long
FE86
ss
IF_LTST
Long
FE87
ss
TABLE
Either
FE88
POLY
Float
FE89
READBYTE
READWORD
READLONG
READFLOAT
LINCA
LINCB
LDECA
LDECB
LAND
LOR
LXOR
LNOT
LTST
LSHIFT
LWRITEA
LWRITEB
LREAD
Long
Long
Long
Float
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
FE90
FE91
FE92
FE93
FE94
FE95
FE96
FE97
FE98
FE99
FE9A
FE9B
FE9C
FE9D
FEAx
FEBx
FECx
LUDIV
Long
FEDx
POWER
ROOT
Float
Float
FEE0
FEE1
Micromega Corporation
0
bb
wwww
yyyy zzzz
yyyy zzzz
ss
yyyy zzzz
yyyy zzzz
x
yyyy zzzz
x
16
Read zero terminated string from
string buffer
Convert ASCII to float
Store in register 0
Convert float to ASCII
Store in string buffer
Convert ASCII to long
Store in register 0
Convert long to ASCII
Store in string buffer
Get floating point status of A
Extended opcode prefix (extended
opcodes are listed below)
No Operation
User defined functions 0-15
User defined functions 16-31
User defined functions 32-47
User defined functions 48-63
Execute user function code if
FSTATUSA conditions match
Execute user function code if
FSTATUSB conditions match
Execute user function code if
FCOMPARE conditions match
Execute user function code if
LSTATUSA conditions match
Execute user function code if
LSTATUSB conditions match
Execute user function code if
LCOMPARE conditions match
Execute user function code if
LUCOMPARE conditions match
Execute user function code if
LTST conditions match
Table Lookup (user function)
Calculate nth degree polynomial
(user function)
Get lower 8 bits of register A
Get lower 16 bits of register A
Get long integer value of register A
Get floating point value of register A
A=A+1
B=B+1
A=A-1
B=B-1
A = A AND B
A = A OR B
A = A XOR B
A = NOT A
Get the status of A AND B
A = A shifted by B bit positions
Write register and select A
Write register and select B
Read register
Select B register, A = A / B (unsigned)
Remainder stored in register 0
A = A raised to the power of B
A = the Bth root of A
uM-FPU V2 Datasheet
Appendix A – Instruction Summary
MIN
MAX
Float
Float
FEE2
FEE3
FRACTION
Float
FEE4
ASIN
ACOS
ATAN
ATAN2
Float
Float
Float
Float
FEE5
FEE6
FEE7
FEE8
LCOMPARE
Long
FEE9
ss
LUCOMPARE
Long
FEEA
ss
LSTATUS
LNEGATE
LABS
LEFT
RIGHT
LOADZERO
LOADONE
LOADE
LOADPI
Long
Long
Long
ss
Float
Float
Float
Float
FEEB
FEEC
FEED
FEEE
FEEF
FEF0
FEF1
FEF2
FEF3
LONGBYTE
Long
FEF4
bb
0
LONGUBYTE
Long
FEF5
bb
0
LONGWORD
Long
FEF6
wwww
0
LONGUWORD
Long
FEF7
wwww
0
IEEEMODE
PICMODE
CHECKSUM
BREAK
TRACEOFF
TRACEON
TRACESTR
VERSION
FEF8
FEF9
FEFA
FEFB
FEFC
FEFD
FEFE
FEFF
0
0
0
0
0
0
0
aa … 00
A = minimum of A and B
A = maximum of A and B
Load Register 0 with the fractional
part of A
A = asin(A) radians
A = acos(A) radians
A = atan(A) radians
A = atan(A/B)
Compare A and B
(signed long integer)
Compare A and B
(unsigned long integer)
Get long status of A
A = -A
A = |A|
Left parenthesis
Right parenthesis
Load Register 0 with Zero
Load Register 0 with 1.0
Load Register 0 with e
Load Register 0with pi
Write signed byte to register 0
Convert to long
Write unsigned byte to register 0
Convert to long
Write signed word to register 0
Convert to long
Write unsigned word to register 0
Convert to long
Set IEEE mode (default)
Set PIC mode
Calculate checksum for uM-FPU code
Debug breakpoint
Turn debug trace off
Turn debug trace on
Send debug string to trace buffer
Copy version string to string buffer
Notes:
Data Type
Opcode
Arguments
Returns
B Reg
x
n
yyyy
zzzz
ss
bb
wwww
aa … 00
Micromega Corporation
data type required by opcode
hexadecimal opcode value
additional data required by opcode
data returned by opcode
value of B register after opcode executes
register number (0-15)
function number (0-63)
most significant 16 bits of 32-bit value
least significant 16 bits of 32-bit value
status byte
8-bit value
16-bit value
zero terminated ASCII string
17
uM-FPU V2 Datasheet