1# The Am9511A
2
3The Am9511A Arithmetic Processing Unit (APU) is a monolithic MOS/LSI device that provides high performance fixed and floating point arithmetic and a variety of floating point trigonometric and mathematical operations. It may be used to enhance the computational capability of a wide variety of processor-oriented systems.
4
5- Fixed point 16 and 32 bit operations
6- Floating point 32 bit operations
7- Binary data formats
8- Add, Subtract, Multiply and Divide
9- Trigonometric and inverse trigonometric functions
10- Square roots, logarithms, exponentation
11- Float to fixed and fixed to float conversions
12- Stack-oriented operand storage
13- DMA or programmed I/O data transfers
14- End signal simplifies concurrent processing
15- Synchronous/Asynchronous operations
16- General purpose 8-bit data bus interface
17- 100% MIL-STD-883 reliability assurance testing
18
19All transfers, including operand, result, status and command information, take place over an 8-bit bidirectional data bus. Operands are pushed onto an internal stack and a command is issued to perform operations on the data in the stack. Results are then available to be retrieved from the internal stack, or additional commands may be entered.
20
21__Am9511a, Intel 8008, Intel 8080: floating point UCRL-51940__
22```
23 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
24+-+-------------+-----------------------------------------------+
25|S|  Two's exp. |                 positive mantissa             |
26+-+-------------+-----------------------------------------------+
27```
28
29The format for floating-point values in the Am9511A is given above. The mantissa is expressed as a 24-bit (fractional) value; the exponent is expressed as an unbiased two's complement 7-bit value having a range of -64 to +63. The most significant bit is the sign of the mantissa (0 = positive, 1 = negative), for a total of 32 bits. The binary point is assumed to be to the left of the most significant mantissa bit (bit 23). All floating-point data values must be normalized. Bit 23 must be equal to 1, except for the value zero, which is represented by all zeros.
30
31The Am9511 is a binary arithmetic processor and requires that floating point data be represented by a normalised fractional mantissa value between .5 and 1 multiplied by 2 raised to an appropriate power.
32
33## Driver concept
34
35The Am9511A works similarly to a HP Reverse Polish Notation (RPN) calculator, with a 16 or 32 bit wide operand stack. Operands must be pushed onto the stack before a command can then act upon the (or these) operands. The depth of the stack depends on whether 16 bit fixed or 32 bit fixed (or floating) numbers are being used.
36
37The driver implements two FIFO buffers, which are managed by an interrupt attached (on the yaz180) to the INT0.
38
39The command buffer is 255 commands deep, which allows for complex calculations to be programmed, and then the result will be calculated with no further action from the controlling program. Operand loading (pushing) or unloading (popping) commands are included in the command buffer sequence, allowing operands to be loaded at the correct time within a calculation.
40
41The operand pointer buffer is 85 operand pointers deep. As an operand can be either 16 bits or 32 bits (fixed or floating) in width. Using a pointer buffer allows for the operand buffer managment to be simplified (accelerated). The pointer buffer consists of one byte for the required BBR, combined with two bytes for the operand address.
42
43Four special commands (non-Am9511A intrinsic) are provided to permit operands to be loaded (or pushed) onto the Am9511A internal stack and, at the end of the calculation sequence, also to allow results to be unloaded (or popped) from the Am9511A stack to a location provided in the operand pointer buffer.
44
45A calculation sequence can continue after an operand (result) has been unloaded, and this may be necessary if the Am9511A stack is not deep enough to maintain an intermediate result. Clearly using the relevant Am9511A XCH(SDF) command to rearrange the Am9511A stack will be substantially faster than popping and pushing an intermediate result using the operand pointer buffer.
46
47## Driver usage
48
49Example code for a simple two operand calculation,
50for the hypotenuse of Pythagoras Triangle.
51```asm
52
53                            ;EXAMPLE CODE - INITIALISATION
54
55                            ;SCRPG = MSB OPERAND ADDRESS
56                            ;OP1   = LSB OF OPERAND 1
57                            ;OP2   = LSB OF OPERAND 2
58                            ;RSULT = LSB OF RESULT
59
60    CALL asm_am9511a_reset  ;INITIALISE (RESET) THE APU
61                            ;ONLY IF DESIRED TO FLUSH BUFFERS
62
63                            ;EXAMPLE CODE - TWO OPERAND INPUT LOADING
64
65    LD D, SCRPG             ;SET D REGISTER TO RAM SCRATCH PAGE
66    LD E, OP1               ;POINTER TO OPERAND 1
67    LD B, 0                 ;USE CURRENT BANK
68    LD C, __IO_APU_OP_ENT32 ;LOAD A 32 BIT DOUBLE WORD
69    CALL asm_am9511a_opp    ;POINTER TO SOURCE IN OPERAND BUFFER
70
71    LD D, SCRPG             ;SET D REGISTER TO RAM SCRATCH PAGE
72    LD E, OP2               ;POINTER TO OPERAND 2
73    LD B, 0                 ;USE CURRENT BANK
74    LD C, __IO_APU_OP_ENT32 ;LOAD A 32 BIT DOUBLE WORD
75    CALL asm_am9511a_opp    ;POINTER TO SOURCE IN OPERAND BUFFER
76
77                            ;EXAMPLE CODE - COMMAND LOADING
78
79    LD C, __IO_APU_OP_FLTD  ;COMMAND for FLTD (float double)
80    CALL asm_am9511a_cmd    ;ENTER a COMMAND
81
82    LD C, __IO_APU_OP_PTOF  ;COMMAND for PTOF (push float)
83    CALL asm_am9511a_cmd    ;ENTER a COMMAND
84
85    LD C, __IO_APU_OP_FMUL  ;COMMAND for FMUL (floating multiply)
86    CALL asm_am9511a_cmd    ;ENTER a COMMAND
87
88    LD C, __IO_APU_OP_XCHF  ;COMMAND for XCHF (swap float)
89    CALL asm_am9511a_cmd    ;ENTER a COMMAND
90
91    LD C, __IO_APU_OP_FLTD  ;COMMAND for FLTD (float double)
92    CALL asm_am9511a_cmd    ;ENTER a COMMAND
93
94    LD C, __IO_APU_OP_PTOF  ;COMMAND for PTOF (push floating)
95    CALL asm_am9511a_cmd    ;ENTER a COMMAND
96
97    LD C, __IO_APU_OP_FMUL  ;COMMAND for FMUL (floating multiply)
98    CALL asm_am9511a_cmd    ;ENTER a COMMAND
99
100    LD C, __IO_APU_OP_FADD  ;COMMAND for FADD (floating add)
101    CALL asm_am9511a_cmd    ;ENTER a COMMAND
102
103    LD C, __IO_APU_OP_SQRT  ;COMMAND for SQRT (floating square root)
104    CALL asm_am9511a_cmd    ;ENTER a COMMAND
105
106    LD C, __IO_APU_OP_FIXD  ;COMMAND for FIXD (fix double)
107    CALL asm_am9511a_cmd    ;ENTER a COMMAND
108
109    LD D, SCRPG             ;SET D REGISTER TO RAM SCRATCH PAGE
110    LD E, RSULT             ;(D)E POINTER NOW RSULT
111    LD B, 0                 ;USE CURRENT BANK
112    LD C, __IO_APU_OP_REM32 ;UNLOAD A 32 BIT OPERAND
113    CALL asm_am9511a_opp    ;POINTER TO DESTINATION IN OPERAND BUFFER
114
115                            ;EXAMPLE CODE - PROCESSING
116
117    CALL asm_am9511a_isr    ;KICK OFF APU PROCESS, WHICH THEN INTERRUPTS AS IT NEEDS
118
119    CALL asm_am9511a_chk_idle  ;CHECK, because it could be doing a last command
120
121                            ;CALCULATION RESULT IS NOW STORED AT SCRPG-RSULT
122```
123