OK,
The secret seems to be as follows :
1) Use Eclipse to edit the Makefile - that way you will get the right copy.
2) create a directory lib and put the library libaplc.a into it, then
set : ALT_LIBRARY_DIRS := lib
3) set : ALT_LIBRARY_NAMES := aplc
4) set : ALT_LDDEPS :=
D:\home\jbww\Design\Altera\Eclipse_v12\NiosProjects\aplc_matrix\lib\libaplc.a I have had to simplify the I/O for the moment, but I can now translate Apl to c using aplc., and have it compile and run on the DE1 board :
The same partially gutted library source compiles OK on the Altera NiosII.
Here is a simple set of matrix operations in a function "matrix":
Source in AplX:
matrix
'A:'
A ← ⍳ 5
A
' '
'B:'
B ← ⍳ 9
B
' '
'C: inner product:'
C ← A ∘.× B
C
' '
'T: transpose:'
T ← ⍉ C
T
' '
'O: outer product (matrix multiply):'
O ← C +.× T
O
' '
'S: solve matrix:'
S ← C ⌹ A
S
NiosII simple floating point soft processor, on a Terassic DE1 development board :
A:
1 2 3 4 5
B:
1 2 3 4 5 6 7 8 9
C: inner product:
1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
4 8 12 16 20 24 28 32 36
5 10 15 20 25 30 35 40 45
T: transpose:
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
6 12 18 24 30
7 14 21 28 35
8 16 24 32 40
9 18 27 36 45
O: outer product (matrix multiply):
285 570 855 1140 1425
570 1140 1710 2280 2850
855 1710 2565 3420 4275
1140 2280 3420 4560 5700
1425 2850 4275 5700 7125
S: solve matrix:
1 2 3 4 5 6 7 8 9
cheers,
Beau Webber