Closed leonardt closed 5 years ago
Going to rebase on https://github.com/leonardt/fault/pull/110 so we I can make Var
support expressions, also I think @Kuree needs that branch too, so I'm going to pull into that branch and bring that all into master
Adds support for reading in formatted data from files using the
fscanf
interface from C. Relies on a new featureVar(name, type_)
that allows the declaration of variables. Right now onlyBitVector[32]
type_ works for verilator (need to generalize mapping from arbitrary fixed witdth vectors to C code, probably best to leverage Dillon's bit vector library used for the coreir simulator). The system verilog backend supports arbitrary width bit vector types (but not other types) (it generates areg [{BV.size -1}:0]
).Otherwise, it adds a new action
file_scan_format
which accepts a file, a format string, a variable number of variables (basically the C interface).@THofstee you may be interested in using the Var feature.
Here's the example usage (copied from the test that was checked in)