Code: Alles auswählen
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ spinsim -?
SpinSim Version 0.27
usage: spinsim [options] file
The options are as follows:
-l List executed instructions
-p Use PASM Spin interpreter
-# Execute # instructions
-P Profile Spin opcode usage
-m# Set the hub memory size to # K-bytes
-c Enable cycle-accurate mode for pasm cogs
-b# Enable the serial port and set the baudrate to #
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ cat hurz.spin
obj
ser : "conio"
pub main | n
ser.start(31, 30, 0, 115200)
n:=10
repeat while n--
ser.str(string("Spinsim!",13))
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ bstc-0.15.3 -b -Oa -L /usr/lib/spinsim hurz.spin
Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Linux at 08:17:46 on 2009/07/20
Loading Object hurz
Loading Object conio
Program size is 220 longs
Compiled 71 Lines of Code in 0.012 Seconds
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ time spinsim hurz.binary
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
real 0m0.012s
user 0m0.000s
sys 0m0.008s
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ time spinsim -p hurz.binary
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
Spinsim!
real 0m0.059s
user 0m0.052s
sys 0m0.008s
Bonus-Häppchen:
Code: Alles auswählen
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ cat a.spin
pub main | n
n:=10
n:=n+5
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ bstc-0.15.3 -b -Oa -L /usr/lib/spinsim a.spin
Brads Spin Tool Compiler v0.15.3 - Copyright 2008,2009 All rights reserved
Compiled for i386 Linux at 08:17:46 on 2009/07/20
Loading Object a
Program size is 32 longs
Compiled 3 Lines of Code in 0.003 Seconds
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ spinsim -l a.binary
Cog 0: 0034 00000000 - 0018 38 0a ldbi 10
Cog 0: 0038 0000000a - 001a 65 stllc $4
Cog 0: 0034 0000000a - 001b 64 ldllc $4
Cog 0: 0038 0000000a - 001c 38 05 ldbi 5
Cog 0: 003c 00000005 - 001e ec add
Cog 0: 0038 0000000f - 001f 65 stllc $4
Cog 0: 0034 0000000f - 0020 32 ret
Cog 0: 0024 00000032 - fff9 3f 89 ldreg $1e9
Cog 0: 0028 00000000 - fffb 21 cogstop
(yeti@destiny:1)~/Desktop/wrk/tmp/spinsim$ spinsim -l -p a.binary | wc -l
426
