Altera_Forum
Honored Contributor
10 years agoBest way to implement a bank of memory mapped registers?
Hi,
I'm relatively new to FPGA design but have been at it for a couple years now in my spare time, and I've spent a long time trying to figure out how to even ask this question... I've done a lot of searching and it could be that I've got all the wrong terminology. A "clean" solution is not obvious to me. I'm pretty comfortable with the basics of the avalon bus now having created some modules that work on it, working with hard memory controllers and various other widgets, debugging via jtag and the system console. I'm working on a cyclone V design where I'm at the point where I want to build in some reconfigurable options and settings. I would be great if I could drop a bank of registers on the avalon bus so that I could get to them by jtag (and probably eventually by a not-yet-implemented SPI slave interface). I think of the example of various off the shelf SPI/I2C configurable chips, I want similar functionality. I don't plan on having tons of settings changing, but I would like a clean way to implement registers that I can then connect those signals to the various blocks in the FPGA design to change modes, constants, settings. If I want to add a dozen more registers for coefficients for something, it would be nice if it was a straightforward code change (i.e. something that scales well). The ways I could think of doing it as a qsys module: -if it is only a few bits the PIO core might be OK. Beyond 32 bits I don't see how to do it without adding more than one. The individual signals could be exported as conduits for the rest of the design, and this would all exist at one 32 bit address on the avalon bus. -roll my own avalon-MM slave with an address range and simply create an appropriately sized array of registers. I would then interconnect these signals to the rest of the system using conduits where appropriate. This is pretty much the same as the PIO core but without the limitation of being at a single address. Actually writing to the registers would be done by jtag or anything else translated to the avalon-mm bus, that part I'm not so worried about. Hopefully someone can understand the question. I think the answer must be so simple that most people already know how to do this and that maybe there are some common approaches that work well. thanks for your time! Lance