Close

Cache and new codec

A project log for FPGA Doom

Porting the classic Doom engine to an FPGA-based system

matt-stockMatt Stock 01/03/2016 at 20:570 Comments

I picked up the Adafruit Codec module recently, and I'm working to integrate it into the system design. It's SPI based and understands how to process both MIDI and WAV, and so I'm hopeful that I'll be able set this thing up to play sound effects and music from Doom without a lot of pain.

I decided to ditch the joystick for a PS/2 keyboard interface. I've added a second interface for mouse input for good measure. More details on those if there's interest, but there are a lot of examples of how to do this on the net. There is a status register that tells the program how many events are in the queue, and reading the output register reduces the queue by one. I'm passing a slightly modified version of the standard scan codes to the application at this point, since there's no device drivers or OS at the moment.

I'm also working on a cache interface for the SDRAM. I've actually added a new parent module for the cache and SDRAM, and by setting a control signal, I can enable or disable the cache. While this isn't something I would do randomly, it does allow me to test behavior and performance very easily.

The cache design is very simple right now. There are 256 cache slots, each with can hold 4 words. Cache fill is done 4 words at a time, and if a flush is needed, there are separate dirty bits for each word so that only the changed values need to be written out. Right now this will likely be a slight reduction in performance, but when I get the bugs worked out I intend to enable pipelined SDRAM reads, which coincidentally will allow 4 words to be clocked out in one shot. When that's done things should be a lot faster.


Discussions