-
Notifications
You must be signed in to change notification settings - Fork 17
MMIO Project Task
MMIO stands for memory-mapped input output, so the name explains the concept – it’s a digital subsystem that takes it’s eventual inputs from locations in the memory of the host digital system, such as a processor, and writes its outputs (one at least is mandatory) again to locations in the memory of the host. MMIO peripheral, digital subsystem, circuit and widget are all synonyms within this document, whereas we will be mostly using the word widget, as that seems to be the most common term in the RISCV/Chisel/Rocket-chip/UC Berkeley vocabulary.
To add a new MMIO peripheral we need to deal with three files:
- the file we are going to actually work on ==> for this example let’s call it
JustRead.scala
. DigitalTop.scala
RocketConfig.scala
The latter two files serve to plug what we create in the former file to the rest of the Rocket-chip, namely, in the two latter files we’ll just copy/paste and edit a few lines, whereas this write-up focuses on the first file = that’s where this whole project actually lives.
Testing consists of two phases:
- First, we need to create a simulator. Managing to do that, we have confirmed that
- our Chisel is syntactically correct,
- the circuit makes sense (it’s feasible as a digital system),
- the peripheral is correctly interconnected with the rest of the SoC
- the whole SoC is successfully translated to Verilog and Verilog again to C++
- next, we need a program, a piece of software that we will write in either C or RISCV assembly and compile and run bare metal, i.e. directly on the simulator we created
Our task is to design a circuit that enters value 230 (unsigned integer) to a location in the memory of the main processor (rocket in SoC) and we select to do it in the form of an MMIO. Since the widget puts a value into the host memory, the operation that the host (involuntarily) performs is reading – hence the name of the widget: JustRead.