summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile27
-rw-r--r--cgopts.s6
-rw-r--r--test.icl69
3 files changed, 93 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 7071797..7232feb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,23 @@
-EXE:=test acker copyfile e fsieve hamming invperm lqueen mulmat nfib pascal reverse revtwice rfib sieve squeen str_arit stwice tak twice war_seq
+EXE:=test acker array copyfile e fac fsieve hamming invperm length lqueen mulmat nfib pascal reverse revtwice rfib sieve squeen str_arit stwice tak twice war_seq
OBJ:=$(addsuffix .o,$(EXE))
ASM:=$(addsuffix .s,$(EXE))
DEPS_O:=_system.o cgopts.o
-SECONDARY:=_system.s
+SECONDARY:=_system.s $(addsuffix .abc,$(EXE))
CC:=gcc
CLM:=clm
CG:=/home/pi/cg/cg
AS:=as
-ASFLAGS:=-g -march=armv8-a+crc -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --gstabs
-CFLAGS:=-g -march=armv8-a+crc -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard -mtune=cortex-a53 -Wall
+ASFLAGS:=-march=armv7-a --gstabs
+CFLAGS:=-march=armv7-a -Wall -Wl,-Map=lastmap.map
RTS:=/home/pi/rts/_startup.o
+arm:
+ $(eval CG:=/home/pi/clean/exe/cg.old)
+ $(eval RTS=/home/pi/rts/_startup.arm.o)
+
all: all_exe all_asm all_obj
all_exe: $(EXE)
@@ -22,9 +26,18 @@ all_asm: $(ASM)
all_obj: $(OBJ)
-$(OBJ): %.o: %.s
+%.o: %.s
$(AS) -o $@ $< $(ASFLAGS)
+ffi: %: %.o $(DEPS_O) ffi_c.o
+ $(CC) -o $@\
+ $(RTS)\
+ $(DEPS_O)\
+ $<\
+ ffi_c.o\
+ -lc -lm\
+ $(CFLAGS)
+
$(EXE): %: %.o $(DEPS_O)
$(CC) -o $@\
$(RTS)\
@@ -33,8 +46,8 @@ $(EXE): %: %.o $(DEPS_O)
-lc -lm\
$(CFLAGS)
-$(DEPS_O): %.o: %.s
- $(CC) -c -o $@ $< $(CFLAGS)
+#$(DEPS_O): %.o: %.s
+# $(CC) -c -o $@ $< $(CFLAGS)
%.s: %.abc
$(CG) $(basename $@) -s $@
diff --git a/cgopts.s b/cgopts.s
index ce0c8e6..92853a7 100644
--- a/cgopts.s
+++ b/cgopts.s
@@ -8,5 +8,11 @@
heap_size: .word 0x00200000 @ 2M
ab_stack_size: .word 0x00080000 @ 500k
flags: .word 0x00000008 @ (from clm.c)
+
+@ Wrong values, as I used since September...
+@heap_size_multiple: .word 0x00019000 @ 20 << 8 (from clm.c)
+@initial_heap_size: .word 0x00001400 @ 100 << 10 (100k, from clm.c)
+
+@ Correct values, as found in clm
heap_size_multiple: .word 0x00001400 @ 20 << 8 (from clm.c)
initial_heap_size: .word 0x00019000 @ 100 << 10 (100k, from clm.c)
diff --git a/test.icl b/test.icl
index 92f7a54..28f09af 100644
--- a/test.icl
+++ b/test.icl
@@ -1,8 +1,73 @@
module test
+//import StdEnv
+from StdOverloaded import class % (..)
+from StdString import instance % {#Char}
+
(+) infixl 6 :: !Int !Int -> Int
-(+) a b = code inline {
+(+) _ _ = code inline {
addI
}
-Start = 10 + 20
+(<) infix 4 :: !Int !Int -> Bool
+(<) _ _ = code inline {
+ ltI
+}
+
+toString :: !Int -> String
+toString _ = code inline {
+ .d 0 1 i
+ jsr ItoAC
+ .o 1 0
+}
+
+toReal :: !Int -> Real
+toReal _ = code inline {
+ ItoR
+}
+
+(/) infixl 7 :: !Real !Real -> Real
+(/) _ _ = code inline {
+ divR
+}
+
+fromto :: !Int !Int -> [Int]
+fromto f t = if (f < t) [f:fromto (f+1) t] []
+
+append :: ![a] ![a] -> [a]
+append [] ys = ys
+append [x:xs] ys = [x:append xs ys]
+
+map :: (a -> b) [a] -> [b]
+map _ [] = []
+map f [x:xs] = [f x:map f xs]
+
+plus a b = a + b
+
+app f a b = f a b
+
+:: Rec = { x :: Int, y :: String, z :: Real }
+toRec x = { x = x, y = toString x, z = toReal (x + x) / 3.0 }
+
+hd [x:_] = x
+last [x] = x
+last [_:xs] = last xs
+length [] = 0
+length [x:xs] = 1 + length xs
+
+div :: !Int !Int -> Int
+div _ _ = code {
+ divI
+}
+
+test :: !Int !Int -> Bool
+test a b = div (a + b) a < b
+
+Start = (length xs, hd xs, last xs)
+where xs = [toString i % (0,1) \\ i <- fromto 1 200]
+
+//Start = (length xs, hd xs)
+//where xs = fromto 1 100 //append (map toRec (fromto 1 100)) (map toRec (fromto 500 1000))
+//Start = [1..100] ++ [500..1000]
+//Start = app plus 1 2
+//Start = map toReal (fromto 1 100)