Quick changes to test harnesses
When I first set up the test framework, I just had iverilog running the CPU directly, as everything happened inside that and there was no reason to add another layer of complexity. Once I needed to test interrupts however, I had to add something “outside the CPU” to poke at the interrupt lines and test that functionality, so I built a very simple “test harness” that instantiated the CPU and poked at an interrupt line at an appropriate time. The test code running on the CPU could then get into a state where it was just waiting for an interrupt, and the test harness would trigger that.
That was fine when there was just one kind of “external poking” that I wanted to do, but with DMA (hopefully) coming soon there’s going to be different kinds. I considered just having the one harness poke interrupts at 400uS after boot, DMA at 600uS after boot, etc. but that seemed messy and likely to cause problems moving forward.
To get around that, I’ve split off the interrupt testing bits into a separate test harness, and added a bit of code to runtests.rb that looks for something like this:
// harnesstype: interrupt
If it sees that at the top of the test file, it will run the test using that test harness rather than the default one. The main Makefile also compiles separate versions of eclair.vvp for each harness for that to use, which is slightly hackish but works well enough for now.
Next up, DMA!