OSDN Git Service

raz
[fast-forth/master.git] / MSP430-FORTH / TSTWORDS.4th
1 \ -----------------------------
2 \ MSP-EXP430FR5969_TSTWORDS.4th
3 \ -----------------------------
4
5 ECHO
6 PWR_HERE
7
8 \ -----------------------------------------------------------------------
9 \ test some assembler words and show how to mix FORTH/ASSEMBLER routines
10 \ -----------------------------------------------------------------------
11 LOAD" \misc\TestASM.4th"
12
13 \ -------------------------------------
14 \ here we returned in the TestWords.4th
15 \ -------------------------------------
16
17 \ ----------
18 \ LOOP tests
19 \ ----------
20 : LOOP_TEST 8 0 DO I . LOOP 
21 ;
22
23 LOOP_TEST   \ you should see 0 1 2 3 4 5 6 7 -->
24
25
26 : LOOP_TEST1    \   n <LOOP_TEST1> ---
27
28     BEGIN   DUP U. 1 -
29     ?DUP
30     0= UNTIL 
31 ;
32
33
34 : FIND_NOTHING      \ FIND_NOTHING      --
35     25000 0
36     DO
37     LOOP            \ 14 cycles by loop
38     ABORT" 25000 x nothing = nothing..." 
39 ;
40
41
42
43  : FIND_TEST            \ FIND_TEST <word>     --
44     BL WORD             \ -- c-addr
45         50000 0 
46         DO              \ -- c-addr 
47             DUP   
48             FIND DROP DROP
49         LOOP
50      FIND
51      0=  IF ABORT" <-- not found !"
52          ELSE ABORT" <-- found !"
53          THEN 
54   ;
55       
56 \ seeking $ word, FIND jumps all words on their first character so time of word loop is 20 cycles
57 \ see FIND in the source file for more information
58   
59 \ FIND_TEST <lastword> result @ 8MHz, monothread : 1,2s  
60
61 \ FIND_TEST $ results @ 8MHz, monothread, 201 words in vocabulary FORTH :
62 \ 27 seconds with only FORTH vocabulary in CONTEXT
63 \ 540 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
64 \ 2.6866 us / word, 21,49 cycles / word (for 20 cycles calculated (see FIND in source file)
65
66
67 \ FIND_TEST $ results @ 8MHz, 2 threads, 201 words in vocabulary FORTH :
68 \ 13 second with only FORTH vocabulary in CONTEXT
69 \ 260 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
70 \ 1,293 us / word, 10,34 cycles / word
71
72 \ FIND_TEST $ results @ 8MHz, 4 threads, 201 words in vocabulary FORTH :
73 \ 8 second with only FORTH vocabulary in CONTEXT
74 \ 160 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
75 \ 0,796 us / word, 6,37 cycles / word 
76
77 \ FIND_TEST $ results @ 8MHz, 8 threads, 201 words in vocabulary FORTH :
78 \ 4.66 second with only FORTH vocabulary in CONTEXT
79 \ 93 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
80 \ 0,4463 us / word, 3,7 cycles / word  
81
82 \ FIND_TEST $ results @ 8MHz, 16 threads, 201 words in vocabulary FORTH :
83 \ 2,8 second with only FORTH vocabulary in CONTEXT
84 \ 56 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
85 \ 0,278 us / word, 2,22 cycles / word  
86
87
88 \ --------
89 \ KEY test
90 \ --------
91 : KEY_TEST
92     ."  type a key : "
93     KEY EMIT    \ wait for a KEY, then emit it
94 ;
95 \ KEY_TEST