120 likes | 187 Views
Supporting Tcl in Hardware. Scott Thibault Green Mountain Computing Systems. Embedded Systems Vision. VB alternative. XML based language. TCL program code. Persistent storage. Targets Palm OS, Pocket PC, Linux … Used commercially. X-Acute Development Platform.
E N D
Supporting Tcl in Hardware Scott Thibault Green Mountain Computing Systems
VB alternative. XML based language. TCL program code. Persistent storage. Targets Palm OS, Pocket PC, Linux … Used commercially. X-Acute Development Platform
Hardware bytecode/ instruction set. Bytecode processor. Core TCL commands in runtime library. TCP/IP/PPP stack in runtime library. Tcl on Board! Platform
Why TCL? • High-level scripting language. • No pointers. • Automatic memory management. • Straight forward network support. • Powerful string processing. • Easy to learn. • Cross-platform support.
Limited performance. Limited memory (under 1MB). Why Hardware?
Implementation Issues • Object representation (dual-port objects). • Dynamic typing. • List implementation. • Memory management. loadScalar1 3 pushInt pushImm1 1 sub assignScalarInt1 -3
OS (trap handlers, etc.) Interrupt handlers. Device drivers. • Buffers. • Efficient arrays. • Efficient records. Systems Programming All-TCL Platform
Protocol Stack Example proc ppp_dispatch {} { global ppp_buffer, ppp_end, ppp_lcp_open, ppp_reject_id, ppp_receiving, ppp_reject set proto [sread_word_big $ppp_buffer 2] if {$proto == 49185} { ppp_handle_lcp } elseif {$proto == 32801} { ppp_handle_ipcp } elseif {$proto == 33} { set ip_packet [ip_process 4 [expr $ppp_end - 6] $ppp_buffer] } elseif {$ppp_lcp_open} { sshift ppp_buffer 4 6 [expr $ppp_end - 4] set ppp_end [expr $ppp_end + 6] swrite_word_big ppp_buffer 2 -16351 swrite ppp_buffer 4 8 swrite ppp_buffer 5 $ppp_reject_id incr ppp_reject swrite_word_big ppp_buffer 6 [expr $ppp_end - 4] swrite_word_big ppp_buffer 8 $proto ppp_transmit $ppp_end 1 } set ppp_end 0 set ppp_receiving 0 if {$proto == 33} {ppp_ip_send $ip_packet} }
Prototype Implementation • FPGA implementation. • 32k logic gates. • 5 MHz (up to 36MHz). • 3.5 cycles/instruction. • 128k address space. • 16 bit bus. • 48 bit objects.
Example Web Server • Embedded HTTP server. • Hypothetical climate-control device. • PPP over 9600 baud RS232 connection. • 5.25 seconds/request (4.71 seconds I/O). • ROM image 32k bytes.
Conclusions • TCL beneficial to embedded systems programming. • Demonstrated TCL in system code. • Hardware implementation feasible. • Small memory footprint.