HX512K Writing Speed World Record - [CODE INCLUDED]
Jasper_M
Posts: 222
UPDATE: I noticed that I got errors when writing with this. (about 1 error in a hundred 256 byte writes). So I changed it to use not the DIRA to control whether strobe is output or not, but setting the counter's output pin.
Ok, I wrote code that writes a 256-byte (64-long) buffer in Cog RAM into HX512K SRAM card at 15MHz, ie. 15 million bytes per second. That means that a scanline could be written into memory in a HSYNC + OVERSCAN.
So how it works?
-Uses the video generator in VGA mode (ie. outputs raw bytes) on the data bus, of course the card is set to auto-increment
-Generates clock strobe with CTRA - the same counter that's used for the video generator.
Sadly enough reading nearly this fast isn't possible (at least it isn't this practical)...
The code is of course in ASM. The demo program supplied writes the RAM 100 times using 5 different cogs (believe me - it may matter on which cog the program runs - I could get this run at 20Mhz on some cogs but not on others), verifies the results using the SPIN driver (NOT SUPPLIED, YOU HAVE TO COPY IT FROM THE CD) and displays the memory read and time taken for the whole operation (in clock ticks).
Mike Green's comboKeyboard.spin driver is included with the code. (as it is used by my console code)
Post Edited (Jasper_M) : 6/13/2007 4:52:38 PM GMT
Ok, I wrote code that writes a 256-byte (64-long) buffer in Cog RAM into HX512K SRAM card at 15MHz, ie. 15 million bytes per second. That means that a scanline could be written into memory in a HSYNC + OVERSCAN.
So how it works?
-Uses the video generator in VGA mode (ie. outputs raw bytes) on the data bus, of course the card is set to auto-increment
-Generates clock strobe with CTRA - the same counter that's used for the video generator.
Sadly enough reading nearly this fast isn't possible (at least it isn't this practical)...
The code is of course in ASM. The demo program supplied writes the RAM 100 times using 5 different cogs (believe me - it may matter on which cog the program runs - I could get this run at 20Mhz on some cogs but not on others), verifies the results using the SPIN driver (NOT SUPPLIED, YOU HAVE TO COPY IT FROM THE CD) and displays the memory read and time taken for the whole operation (in clock ticks).
Mike Green's comboKeyboard.spin driver is included with the code. (as it is used by my console code)
Post Edited (Jasper_M) : 6/13/2007 4:52:38 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Realize that I am really a mad scientist··· and
Don't forget it!
http://raydillon.com/Images/Illustration/GameArt/WildIsle/WildIsle-Ink-ScientistClose.jpg
·
And bob, the whole idea of the HX512 is to use it as a video buffer, in straight simple read/write mode it acts as fast as global memory, so you can do full bitmapped graphics. With what jasper did (which is outlined in the book on advanced stuff I think), the trick is to use the counter as a control to the card rather than the prop, so for fills, etc. you can very quickly do things to the memory.
Anyway, I am glad someone did it since I had a hard enough time writing all the drivers and 80-90 pages of docs explaining it.
Also, if you build your own programmer then you can of course change the firmware in the CPLD and try different modes like full access modes where you can get to all 512K within 8 bytes very fast then use the auto increment to get to the right byte, etc. Right now the CPLD is programmed for max speed on the lower 64K direct addressing.
Have fun. I am already on the next card ......
Andre'
I'll work tommarrow on my project again, also: Jasper do you mind that I use your video buffer with my program?
note: I think I might just use the glass efect along with the 400 colors for some cool sphere efects on planets!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Realize that I am really a mad scientist··· and
Don't forget it!
http://raydillon.com/Images/Illustration/GameArt/WildIsle/WildIsle-Ink-ScientistClose.jpg
·
I tried it at 20MHz, it worked on some cogs, but not on others (propagation delay differences and the fact that CTRA triggers the video peripheral almost exactly, causing data and clock to be on the bus almost at the same time... maybe.), so that's all I got : P ... Now I'm working on code to read fast (well' not this fast, but prolly fast enough ^__^
Of course you can use this, but of course you'll need the SRAM 512K expansion card. And it'll be hard to get a video driver work with this. (as there's no fast reading code YET)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Realize that I am really a mad scientist··· and
Don't forget it!
http://raydillon.com/Images/Illustration/GameArt/WildIsle/WildIsle-Ink-ScientistClose.jpg
·