Closed zwabbit closed 8 years ago
IPI is interprocessor interrupts. Completely unused for Sodor.
The HTIF is the Host/Target Interface, which has the front-end server (riscv-fesvr, running on your host computer) communicating with the target design (Sodor). The riscv-fesvr loads the binary into the Sodor memory via the HTIF mem ports, and then uses the Control/Status Registers to bring the core out of reset. Once the program is finished, Sodor tells the riscv-fesvr it is finished via the tohost CSR and simulation ends.
HTIF is a non-standard tool for Berkeley processors, so there's no documentation on it. It is going to disappear soon, as the RISC-V platform spec is released and the cores are updated to be self-hosting.
Alright, so for those of us whom are trying to use sodor in its current state, could we get some pointers on how the instruction loading is performed, or where in the riscv-fesvr code said loading is happening so that we can reverse engineering the operations ourselves?
All of the instruction loading is performed magically in C++.
You can look at the HTIF C++ code in emulator/common/htif*, which describes the connection between the fesvr and the Sodor core itself.
As for the fesvr code, I'm not familiar with it myself, but it's not very big, and adding printfs everywhere should help you follow the logic.
Hi, continuing this thread, could I get a hint about the latest official host/target interface? In Rocket, I haven't found it and couldn't find any documentation about that.
Rocket has completely removed HTIF (it is now self-hosting and does not need a tether) and uses the External Debug Specification for interfacing between two systems.
OK. Thanks for your reply! Nice work of boom and sodor!
Making this thread alive, I am working on Chipyard and using the TSI to load the program in the memory. However, I am not sure where does the program gets stored if I use the "MbusScratchpadRocketConfig" config to generate the RTL. Does it get stored in the Scratchpad memory TLSRAM? I can see the SerialAdapter's Tilelink ports sending data in the VCD, but cannot see where they are being read and stored.
The program always gets stored in the physical memory mapped to 0x8000_0000. In that config, I believe it gets loaded into the scratchpad defined here:
https://github.com/ucb-bar/testchipip/blob/master/src/main/scala/Scratchpad.scala
Well it is not being stored there @jerryz123. Maybe, I am looking somewhere wrong. I have attached a screenshot of the signals I am visualizing.
The Serial Adapter correctly gets the first instruction of the program from TSI and converts it into a TileLink PUT request. However, I don't know where this address and data is being received. It certainly is not received by the TileLink node attached with the Scratchpad as shown above. This is confusing me at the moment.
The L2 sits in front of the scratchpad RAM, so requests from the SerialAdapter go through the L2 first. Perhaps this waveform akes it clearer.
You can see here that after the SerialAdapter requests 0x8000_0000, the L2 immediately sees that request. However, the L2 is not ready to receive requests until many cycles later, as it spends time resetting itself. After L2 is reset, it handles the request, sees 0x8000_0000 is not cached, and then requests the line from Scratchpad.
@jerryz123 sorry I am not clear. Initially, somebody has to fill the Scratchpad itself right? I am talking about that step. Who fills the Scratchpad? It would be the Serial Adapter right if we use the TSI protocol? The waveform I showed above displayed the Serial Adapter doing a PUT (Write request) with the first instruction of the program "rv64ui-p-add" but I was not able to see where the program is being "written" into the memory.
Yes you are correct the Serial Adapter performs the initial PUTs to load the program into memory. However, since the Scratchpad is cacheable memory, PUTs will allocate a line in the L2, which is write-allocate. Thus, the sequence of events is:
The waveform I posted above depicts the PUT from the SerialAdapter, the PUT received by the L2, and the GET sent from the L2 to the Scratchpad.
Oh, I see. I guess my unfamiliarity with the TL-C protocol is confusing things for me. Thanks @jerryz123, I will look into it and see how the caching mechanism works together between the L2 and the Scratchpad memories.
Is there any documentation on what the HTIF ports actually are and how to use them? For example the CSR ports seem to be command ports, mem ports memory ports, which would imply the ipi ports are instruction ports. But if the ipi ports are instruction ports, how are we supposed to load instructions for it when all of its ports are only one bit wide? And so on.