OSDN Git Service

c5f41f37b61e332c4526e64058623e9bc235cf07
[fast-forth/master.git] / MSP430_FORTH / TSTWORDS.4th
1 \ -----------------------------
2 \ MSP-EXP430FR5969_TSTWORDS.4th
3 \ -----------------------------
4
5 PWR_HERE
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
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
33 : LOOP_MAX      \ FIND_NOTHING      --
34     0 0
35     DO
36     LOOP            \ 14 cycles by loop
37     ABORT" 65536 LOOP " 
38 ;
39
40
41
42  : FIND_TEST            \ FIND_TEST <word>     --
43     BL WORD             \ -- c-addr
44         50000 0 
45         DO              \ -- c-addr 
46             DUP   
47             FIND DROP DROP
48         LOOP
49      FIND
50      0=  IF ABORT" <-- not found !"
51          ELSE ABORT" <-- found !"
52          THEN 
53   ;
54       
55 \ seeking $ word, FIND jumps all words on their first character so time of word loop is 20 cycles
56 \ see FIND in the source file for more information
57   
58 \ FIND_TEST <lastword> result @ 8MHz, monothread : 1,2s  
59
60 \ FIND_TEST $ results @ 8MHz, monothread, 201 words in vocabulary FORTH :
61 \ 27 seconds with only FORTH vocabulary in CONTEXT
62 \ 540 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
63 \ 2.6866 us / word, 21,49 cycles / word (for 20 cycles calculated (see FIND in source file)
64
65
66 \ FIND_TEST $ results @ 8MHz, 2 threads, 201 words in vocabulary FORTH :
67 \ 13 second with only FORTH vocabulary in CONTEXT
68 \ 260 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
69 \ 1,293 us / word, 10,34 cycles / word
70
71 \ FIND_TEST $ results @ 8MHz, 4 threads, 201 words in vocabulary FORTH :
72 \ 8 second with only FORTH vocabulary in CONTEXT
73 \ 160 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
74 \ 0,796 us / word, 6,37 cycles / word 
75
76 \ FIND_TEST $ results @ 8MHz, 8 threads, 201 words in vocabulary FORTH :
77 \ 4.66 second with only FORTH vocabulary in CONTEXT
78 \ 93 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
79 \ 0,4463 us / word, 3,7 cycles / word  
80
81 \ FIND_TEST $ results @ 8MHz, 16 threads, 201 words in vocabulary FORTH :
82 \ 2,8 second with only FORTH vocabulary in CONTEXT
83 \ 56 us for one search ( which gives the delay for QNUMBER in INTERPRET routine)
84 \ 0,278 us / word, 2,22 cycles / word  
85
86
87 \ --------
88 \ KEY test
89 \ --------
90 : KEY_TEST
91     ECHO
92     ."  type a key : "
93     KEY EMIT    \ wait for a KEY, then emit it
94 ;
95 \ KEY_TEST