Closed secworks closed 1 month ago
This PR is a test implementation of a solution for https://github.com/tillitis/tillitis-key1/issues/234
The linter shows a warning:
%Warning-UNUSEDSIGNAL: /__w/tillitis-key1/tillitis-key1/hw/application_fpga/core/tk1/rtl/tk1.v:161:16: Signal is not used: 'spi_access_ok'
: ... In instance application_fpga.tk1_inst
161 | reg spi_access_ok;
| ^~~~~~~~~~~~~
... For warning description see https://verilator.org/warn/UNUSEDSIGNAL?v=5.012
... Use "/* verilator lint_off UNUSEDSIGNAL */" and lint_on around source to disable this message.
%Error: Exiting due to 1 warning(s)
make: *** [Makefile:196: lint] Error 1
Testing: works in general, blocks SPI access. However spi_ready is still available, which I would argue should not. Since it is a nice API to see if one have an SPI master available.
Noticed that the frequency is down to 23.00 MHz on this branch.
Now the ready_spi is blocked.
It seems the condition to set spi_access_ok signal is too hard, which blocks SPI access from both FW and app address space.
The condition is
if ((cpu_valid & cpu_instr) & (cpu_addr[31 : 30] == ROM_PREFIX))
If the CPU is in fact waiting for a load or store to happen, we may not be in a cpu_instr. And then spi_access_ok is not set when it should be. The last commit removes the complete condition to see that SPI access is possible from SPI and APP_MODE.
As long as an access comes from the ROM prefix we should be good. Possibly that it also is a valid (i.e active) access. Since the actual access is performed by a R/W access against API registers, we now that it is a valid access. So the condition should not need to also check that it is an instruction, nor if it is a valid access. A simple prefix check should be sufficient.
Max Frequency Info: 23.36 MHz (PASS at 18.00 MHz)
Max Frequency Info:
Max Frequency Info: 21.85 MHz (PASS at 18.00 MHz)
Max Frequency Info: 21.85 MHz (PASS at 18.00 MHz)
Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz)
Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz)
FPGA (SPI): Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz)