Running Chiseltests =================== This is a brief guide on how to run Chiseltests found on some Chisel projects. Structure --------- - Chiseltests are located in a fixed location: ``src/test/scala``. - The file name ends with ``Spec.scala`` and test class name with ``Spec`` Running the test ---------------- Chiseltests are run with ``sbt``. For example, to run ``DataCacheSpec`` under ``acorechip``, you should navigate to ``Entities/acorechip/chisel`` and run: .. code-block:: bash sbt 'testOnly acorechip.DataCacheSpec' Debugging --------- In a Chiseltest, you can print with ``println``. However, this is not very helpful for debugging. Best way to debug is to check waveforms. They don't get generated by default. You need to add ``.withAnnotations(Seq(WriteVcdAnnotation))`` after the ``test`` wrapper. For example: .. code-block:: scala test(new DataCache(memory_map, config)).withAnnotations(Seq(WriteVcdAnnotation)) { c => ... After running the test, it will generate a ``.vcd`` file under ``test_run_dir/test_name/``. You can open it with GTKWave: .. code-block:: bash gtkwave test_run_dir/test_name/className.vcd You can add traces to the waveform window from the panel on the left.