Close

October 2025 Update - Data Cache and Audio

A project log for Tridora-CPU

a homebrew FPGA CPU with a native Pascal compiler and a simple development environment

sledererslederer 10/14/2025 at 21:070 Comments

The October 2025 Update is here!

With this update of the logic design, the Tridora-CPU now has a data cache. It is very similar to the instruction cache that was added with the April 2025 update: It caches the 16 bytes that the DRAM controller delivers anyway.

For decent performance, it had to be implemented as a write-back cache. So when a write to the cached area happens, the cache is not invalidated (as in the simpler write-through cache). Instead, the write is going to RAM and will update the cache. This is because with the stack machine architecture and especially in the code generated by the Pascal compiler, it is very common to read, write and read again the same variable. So a write-through cache would be invalidated quite often and would have a much worse performance.

Fortunately, the write-back cache was easier to implement than I thought, and the result is really noticable.

Building the "hello,world" program now takes about 15 seconds instead of 20.

There were also some minor tweaks for the SD-Card controller so it has a slightly higher transfer rate, and that brings down the build time to about 14 seconds.

Updated benchmark results are here:

https://gitlab.com/slederer/Tridora-CPU/-/blob/main/examples/benchmarks.results.text

In comparison to the version without instruction and data cache, the new version has a three times better performance in the empty loop benchmark. In comparison to the last version with instruction cache, the improvement is factor 1.6.

The other important thing in the October 2025 is the audio controller. The Tridora-CPU can now make sounds, using a Digilent AMP2 PMOD. At first, I implemented four channels of rectangle waves and a noise generator. Then I scrapped that and went for interrupt-driven sample playback. So now you can play a sample file in the background from your Pascal programs.

Here is a video of the Tridora-CPU making some noises and playing music: 

Discussions