This is a limitation of the ASIC we can't work around right? We can't tell when the internal counters wrap, only guess based on clock rate and how the work is divided up. BKK and I discussed this a few pages back, I added this to my fpgas to improve the amount of effective mining time. In the end I guess it is better to underestimate the time and not hash some of the space than to waste time by wrapping?
That should be right. Since any hash test is as good as another the fastest work change over should be "the time needed to push new data" and that would only occur if you truncated current work as close to the end as possible (since that gives you the least changes over long term).
How about an Abort cmd, 'A' which replies with amount of partial hashes done (which would be based off timer tick counts since the ASIC can't tell me anything). So if new work is prefixed with A, eg. AW002 then the queue is cleared, partial count returned, and new work immediately pushed. If useful multiple work tasks could be sent at once to fill the queue. I could just check the length and process them in sequence. I'll leave that for later refinement.
This is really useful on pools like Slush's where you only get paid for you contribution to the current block. My fpgas do very well in the super short blocks (sub 1 min) because of LP support, we need this for sure, not in rev 1 perhaps.
I'll definitely have this in first version but I'm probably going to change how I do it. It won't be AW as that doesn't follow the protocol really. It would be just A with new work so it acts like W with queue clearing. To stop work without new work you would just use E Enable to disable work.
Another change: I'm going to use a single byte binary address instead of 3 digits. I thought maybe it would ease debugging but letter codes with binary after will be just as easy, and why increase data xfer for that. The
pair then make a 16 bit unique identifier for each work sent out. Which is easier both in the PIC and in the driver to track.
------ other news ------
I'm looking through the bflsc.c code now and have started preparing a cmd line test utility based on usbutils to allow me to poke the PIC and test outside of cgminer.
I also submitted a request to Microchip for one of their free USB PIDs (product ids) as the alternative is randomly choosing some VID/PID to hijack.