I've only just learnt that 'midstate' is deprecated, which this code requires. Perhaps I can work towards adding that feature (later, when I work out what this code is doing!).
Just to be clear, using the midstate in mining is not deprecated, receiving the midstate from getwork is.
You need code running on a host computer that interfaces with your device anyway. This code can just generate the midstate itself. For an example, check out cgminer.c:calc_midstate().
In fact, once you have your bitstream, the easiest thing to do would be to make a driver for cgminer that interfaces with your device. Check out driver-ztex.c and driver-modminer.c in cgminer for for examples.