OSDN Git Service

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