3
votes

How to use the C++ files generated by the Chisel compiler? the documentations are not clear on this, is there any other source to point me to it? I am really clueless on this, specially that I don't know C++.

Say for example for a simple adder circuit Adder.scala I will get the following files related to the emulator: Adder.cpp, Adder.h, Adder-emulator.cpp, emul_api.h, emulator.h and sim_api.h. For which I can compile by running

g++ Adder.cpp Adder-emulator.cpp 

This generates the output a.out running this in the terminal generates three more files that I have no clue what they are. 00003710.cmd, 00003710.in and 00003710.out.

1

1 Answers

1
votes

The C++ code is used to build an emulation of your design. You need to also define a tester that will drive the emulation, using poke() to set signal values, and peek() or expect() to read them.

You should not be compiling the C++ yourself. If you pass the --genHarness and --test options to Chisel, it will compile the C++ code, build the emulation and run your tester to drive it.

Have a look at the chisel-tutorial code for examples of this process.