Hi. Question about sram timing for ice40-based fpga board.
Clock is 100Mhz (10ns)
Here is a piece of verilog code, which reads every word from sram and do some tests on it:
https://github.com/gproskurin/learning/blob/c1235d21a55309f51fe143deb23f783f5546f175/embedded/fpga_test/src/sram_test.v#L89-L129It spends 3 cycles (10ns each) to read and process one value from SRAM:
- write sram address to some fpga register, optionally check previous data in "data copy register"
- wait one 10ns cycle
- latch data from SRAM data lines to fpga "data copy register", goto 1
Timing diagram for sram chip says, that data lines contain valid data 10ns after address is set on address lines.
I'm wondering is it possible to spend 2 cycles for each address:
- use data from sram data lines, update fpga address register with the next address at the same time
- wait 1 cycle, goto 1
I tested it and it works without any errors, but I suspect that I'm just lucky enough that my code timings fit, it seems it is not guaranteed.
For example, if I change address register and use data from data lines at the same time, I rely on data hold time (tOH) which is 3ns, but 3ns can be insufficient to process old data or latch it.
This is 2-cycles code, which works, but I'm not sure about it:
https://github.com/gproskurin/learning/blob/2fa53b832005f817e942e5689e60af3b52bd38db/embedded/fpga_test/src/sram_test.v#L92-L121Any thughts?
I have the same question about writing, but we can talk about reading for now.
SRAM chip datashit:
https://www.olimex.com/Products/_resources/ds_k6r4016v1d_rev40.pdf