Hi,
First time poster here. I'm using Xilinx's cheap Spartan 3 Starter Kit Board to create a simple VGA "controller" (framebuffer output) that I want to interface to 8051 and Z80 systems I've constructed myself (breadboard projects.)
I'm having serious trouble implementing writes to the on-board SRAM because there appears to be some sort of conflict with the display refresh which causes data to occasionally be misplaced in the frame buffer (several dozen pixels per frame.)
After a couple weeks (!!) of debugging and experimentation (too much stuff to list in this first post), I believe I've narrowed the problem down to one of the following issues:
- Writes are supposed to pre-empt reads in my VHDL state machine. Perhaps there is some sort of conflict. If there is, it is not obvious. My state machine is pretty tight and unless the toolchain is synthesizing glitchy logic, there should be no problem.
- Data is input from the external CPU (Z80 or 8051) via a simple 5-bit port: 3 bits of color data, an address pointer reset bit, and a clock bit. The Z80 will write a 0 and then a 1 to the clock bit and on the rising edge of this pin, the FPGA is to latch the data and initiate a write. It appears that the transition from low-to-high may be problematic for the FPGA or once a write is complete, the internal signal is not deasserted quickly enough (but this really shouldn't cause any problems -- it would just write over and over again to the same spot.)
I've tried to sync the input pin clock to the FPGA's 50MHz clock (which my state machines run off of) but no luck there.
- My 2-cycle write sequence to SRAM might be wrong. But I doubt it because I've verified it against working code and I've synthesized simpler circuits which prove that RAM is being read and written correctly.
I've tried a number of things including adding a pin to disable the display (thus stopping all reads) which the Z80 can control. Even when the display is off and I write to the FPGA, these bad pixels appear. It's not physical noise, that's almost for sure. The pixels are always colored the same as in the image -- in fact, they're often missing from the image and moved somewhere else.
Here's some of the relevant VHDL (I hope the formatting is preserved, I'm using Google Groups):
(Please note how I am clearing the sram_do_write signal -- I think this may be part of the problem but there's no easy way to rectify it.)
process(input) begin if input(4)'event and input(4) = '1' then if input(3) = '1' then -- reset address write_addr