I have a 2MB Papilio Duo (Kickstarter edition), with the Classic Computing shield, that I'm using for my first serious FPGA project. I'm using it as a simple FPGA board, so not using the Arduino side, and doing everything myself in VHDL.
I've run into a problem writing data to the SRAM. My design uses 4 cycles of a global clock for each memory access. Writes go like this:
/OE <= 0, /WE <= 1, set address, tristate data
/OE <= 0, /WE <= 0, assert data to write
/WE <= 1
My test configuration follows this with a read:
/OE <= 1, set address, tristate data
Unless I've made a mistake (spoiler: I have almost certainly made a mistake), with a 160MHz global clock this should fit comfortably in the SRAM's timing requirements. At 80MHz it works fine. At 128MHz it's OK most of the time, with occasional errors. At 160MHz it's failing very frequently.
I'm fairly sure that it's the writes that are failing: when it's connected to a larger design that copies a ROM into RAM and then displays the contents of RAM on VGA, I get a stable image with missing pixels here and there. But I can't see what I'm doing wrong. Can anyone help?
I'll attach my stripped-down SRAM testbed. I'm very new to VHDL, so comments on style are welcome too. I'm probably doing everything wrong. LED1 blinks briefly when the data read back from SRAM doesn't match the data that was written.