0
votes

i'm working on designing a mips processor using verilog in modelsim student version and we developed a c++ tool that converts assembly operations to machine code and save the result in .txt file so is there a way to make modelsim runs this tool when simulation starts ?

2

2 Answers

0
votes

I think you meant you want to simulate an application running on your processor. To do that, you need to have a testbench that models memory with all the necessary connections to your processor. Then get your .txt file in a form that can be read by the $readmemh() system task. Then you load the contents of file into your memory.

0
votes

You can use $system("foo"); to run any system call from system verilog, including invoking your external C++ program, like ("echo hi"); or :

$system("path/to/my/cpp_binary.exe arg1 arg2 arg3");

If you wrap it in an initial block, you can run it at the beginning of simulation. See this answer.