-
Hi, Wasn't sure whether it's more appropriate to put this question in Rocket Chip's or Firesim's repo, but I figured Rocket Chip is more appropriate. For context, I'm working on a RoCC module which aims to add message-driven computation to the Chipyard ecosystem. It's based on ucb-bar/chipyard#1380. It works fine in Verilator, but I am now attempting to run it on a Firesim FPGA simulation running Fedora. #include <stdio.h>
#include "sage.h"
int main(void) {
printf("Hello world!\n");
qPut(1, 200); // This line runs fine (program prints "Done!" and exits if the following lines are commented out
int i = qPollAll(); // Program halts here
printf("qpoll result=%d\n", i);
printf("Done!\n");
} These are the function definitions of qPut and qPollAll. Note that qPut does not wait for a return value. static inline void qPut(unsigned long destination, unsigned long data) {
ROCC_INSTRUCTION_SS(CUSTOM_INSTR, destination, data, FUNCT_QPUT);
}
static inline unsigned int qPollAll() {
unsigned long result; // 0 or 1
ROCC_INSTRUCTION_D(CUSTOM_INSTR, result, FUNCT_QPOLL);
return result;
} For some reason, it runs fine when calling After a while, it outputs some call traces.
Is there something special I need to do in order for RoCC instructions to work properly? Again, these instructions/functions all work perfectly fine in Verilator. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I suspect your system has entered some deadlock condition. Are your custom instructions non-blocking? Are there scenarios you imagine where some custom instruction may become starved for a necessary resource for completion? |
Beta Was this translation helpful? Give feedback.
I looked through the code... the qPoll instruction responds immediately, so you have a data hazard on the rd field that you aren't handling, since you read and write reg_rd on the same cycle in this case.