A risc-v update.

I managed to get AmForth RISC-V running on the CH32V307 [1] made by
WCH [2] using a "CH32V307V-EVT-R1 CH32V307 Evaluation Board RISC-V MCU" [3].

It still is experimental and still has the issue that upon reset all
words from the ram-wordlist are erased [5]. There are no words written
for the CH32V307's peripherals besides the USART. The unscientific
benchmark of the time taken to load tester-amforth.frt via
amforth-shell.py [4] comes in at about 1.2 seconds, beaten only by
running AmForth RISC-V under qemu [6] at 0.67 seconds. Early days but
I like both the CH32V307 and the dev board.

Best wishes,
Tristan

[1] https://www.wch-ic.com/products/CH32V307.html
[2] https://www.wch-ic.com/about_us.html
[3] https://www.aliexpress.us/item/3256805636827823.html
[4] https://tjnw.co.uk/amforth-rv/20231104/20231104.html
[5] https://amforth.sourceforge.net/TG/RISC-V.html#risc-v
[6] https://tjnw.co.uk/amforth-rv/20231222/20231222.html

A quick interactive session below

AmForth-RV 7.0 RV32IMAFC WCH C32V307
Fri 19 Jan 2024 16:46:34 GMT
words
forth-wordlist environment riscv-wordlist dog cat @cycle type0 hifive-turnkey rev-info build-info mtimecmp mtime led.init -led +led qspidiv serial-emit? serial-emit serial-key? serial-key pll sysclock dump r. 8x. 2x. x. .8hex .4hex .2hex ?ascii bee bong ram-wordlist wordlist Udefer! Udefer@ dp >in 0> get-current >body wlscope variable to ; : ] reveal recurse ?abort postpone +loop newest loop latest header endloop do (create) defer! defer@ create constant :noname char ['] [compile] [char] \ abort" abort ' turnkey immediate leave >l l> lp lp0 repeat again else if while until then begin ahead words sliteral s, ." s" itype type count ver init-ram ?do map-stack interpret recognize cfg-recognizer forth-recognizer split rectype-split rec-split rec-num rectype-dnum rectype-num rectype-xt rec-find rectype-null set-base bases number >number digit? toupper within ud* m+ name>flags name>string search-wordlist current show-wordlist traverse-wordlist nfa2cfa nfa>lfa find-xt cfg-order c, , compile literal 2literal /string parse parse-name cskip cscan ?stack source-tib source throw catch handler .ready .ok .input .error ?crlf bs accept refill-tib refill .s ud.r ud. u. d. d.r . sign #> #s # <# hold hld allot here pad hex decimal ( [ spaces space bl cr ms warm REGITC REGABI REGNUM value? variable? condbranch? exit? codeword? colon? PFA.DOUSER PFA.DODATA XT.DONEXT XT.DOCONDBRANCH PFA.VALUE PFA.DEFER XT.EXIT XT.VARIABLE XT.COLON cell false true -1 4 2 1 0 bounds pause emit? emit key? key quit state base dabs a-- a++ a> >a cell- ashift nr> n>r compare (DOLITERAL) (DOCONDBRANCH) (DOBRANCH) 1ms up! up@ (DODOES) (DOUSER) (DODEFER) (DOVALUE) (DODATA) (DOVARIABLE) aligned j i unloop (DOPLUSLOOP) (DOLOOP) (DODO) nop execute cold #tib tib cells cell+ 2/ 2* 2- 2+ 1- 1+ - + d0= d0< ud/mod um/mod s>d 2dup d- d+ dnegate d2/ d2* 2r> 2>r 2r@ 2over 2drop 2nip 2swap umax umin max min = <> u> u< u<= u>= > < <= >= 0< 0<> 0= c! c@ +! fill move lshift rshift invert not xor or and rdrop rdepth depth /mod u/mod mod / m* um* * abs negate ! @ sp0 sp sp! sp@ rp rp! rp@ r@ r> >r pick -rot tuck ?dup rot over nip dup swap drop exit ok
: cat 1+ ;
 ok
100 cat . cr
101
 ok
: ant 5 begin 1- dup . dup 0= until drop ;
 ok
ant
4 3 2 1 0  ok
here 10 dump

-------- 00--------- 04--------- 08--------- 0C---------
200022D0 40 69 00 00 40 CD 82 9B 03 66 47 31 34 36 33 35 @i..@....fG14635 200022E0 2E 06 4D C4 DC 47 EE 30 AB 43 DD 3A FB 97 56 69 ..M..G.0.C.:..Vi 200022F0 38 0F F8 6F 32 30 30 30 32 32 33 33 0A 21 94 66 8..o20002266.!.f 20002300 F2 73 EA CB C5 49 77 34 8E 88 FE 9C F9 57 2C 11 .s...Iw4.....W,. 20002310 18 4A EC DB 16 94 A6 D2 02 0E A5 F4 91 16 1E 12 .J.............. 20002320 55 57 38 23 18 73 E1 E2 15 1A E0 05 28 75 A6 CF UW8#.s......(u.. 20002330 B5 28 BC E1 7E BE 76 44 20 E2 CB 04 53 8B 81 44 .(..~.vD ...S..D 20002340 82 F3 68 49 8B 5D 15 C8 10 4F 55 B0 20 8B F1 06 ..hI.]...OU. ... 20002350 FE 59 48 17 64 F4 02 8F 14 B8 F2 0C 98 83 62 6C .YH.d.........bl 20002360 45 ED 46 DE DB 1B FE 44 3A E9 A0 96 FC 24 59 38 E.F....D:....$Y8
 ok




_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to