Acceleration (Part 2)
Since the bottle-neck appeared to be the SPI bus, I decided to have a go at reducing the number of bytes needed to do various things by extending the instruction set.
The instruction set now looks like this:
All other commands are currently ignored (NOP).
The 0x4X commands did appear to make it go much faster.
I had almost decided to remove the interrupt code from the PicoBlaze processor, but then I had an idea - use the interrupt to pause the CPU while the write buffer was full. This would allow me to remove the code that waited for the FIFO to be empty, and have the processor just wait until the FIFO had gone below full before resuming.
In order to prevent the FIFO from being written while the interrupt was being processed, I added the "almost-full" flag to the FIFO, and used that as a trigger for the IRQ.
This worked very well (although didn't overly speed things up).
I'd written a program to convert a 2bpp bitmap into a series of hline instructions - however, it was not optimised for the instructions being used.
I gave it some intelligence as to how the SPI stream is generated, and recalculated it.
This had two effects:
I don't have the memory for a full font, but I can display 7-segment like digits, which would be useful for some of the less important information (such as the engine temperature, boost pressure and the like). Since I've got some spare space in the PicoBlaze, I put in a generic 7-segment display command.
This uses the current colour, but if a segment is turned off, then it uses a darker version (only primary colours are really supported for this):
The really good thing about this is that the address is automatically adjusted to the next location, so in order to send a sequence of bytes, you only need to send the digits themselves.
|© Copyright 1997-2019|
Tribbeck.com / Jason Tribbeck
All trademarks are the property of their respective owners.