FifoTracker constructor

FifoTracker(
  1. Fifo fifo, {
  2. String? name,
  3. bool dumpJson = true,
  4. bool dumpTable = true,
  5. String? outputFolder,
  6. String spacer = ' | ',
  7. String separator = '-',
  8. String overflow = '*',
})

Constructs a new tracker for fifo.

If no name is provided, will be named based on the fifo's name.

Implementation

FifoTracker(
  Fifo fifo, {
  String? name,
  super.dumpJson,
  super.dumpTable,
  super.outputFolder,
  super.spacer,
  super.separator,
  super.overflow,
}) : super(name ?? fifo.name, [
        const TrackerField('Time', columnWidth: 8),
        const TrackerField('Command', columnWidth: 2),
        TrackerField('Data',
            columnWidth: fifo.dataWidth ~/ 4 + log2Ceil(fifo.dataWidth) + 1),
        TrackerField('Occupancy', columnWidth: fifo.depth ~/ 10 + 1),
      ]) {
  fifo._clk.posedge.listen((event) {
    if (fifo._writeEnable.previousValue!.toBool()) {
      record(_FifoEvent(
        _FifoCmd.wr,
        fifo._writeData.previousValue!,
        ++_occupancy,
      ));
    }

    if (fifo._readEnable.previousValue!.toBool()) {
      record(_FifoEvent(
        _FifoCmd.rd,
        fifo.readData.previousValue!,
        --_occupancy,
      ));
    }
  });
}