[<<][meta][>>][..]
Sat Jul 6 12:15:02 EDT 2013

State machines

I spent a couple of hours writing a ISO7816 protocol parser for a
logic analyzer (LA).  Bit stream accessible to a C program.

I used the Saleae Logic which has an SDK available.


It boils down to RS232 + some byte-level parsing.

Interesting as it brings up that tension between switch-style explicit
state machine programming and thread-style or linear temporal
programming.  Basically, writing switch-style state machines is error
prone.  In this particular case I found it also hard to use a
self-contained test-driven approach.  Instead I used a live target to
produce the LA data.

Some ideas:

- I wrote some C macros to do thread-style programming[2].  It would
  be good to give that a try for the protocol parsing lib.

- Look at MyHDL[3][4].  Basic idea is to use Python shallow coroutines
  to define state machines.

[1] http://community.saleae.com/DeviceSdk
[2] https://github.com/zwizwa/shaco
[3] http://www.myhdl.org/doku.php
[4] https://speakerdeck.com/jandecaluwe/myhdl-designing-digital-hardware-with-python-pycontw-2013





[Reply][About]
[<<][meta][>>][..]