-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update docs * small fix
- Loading branch information
Showing
1 changed file
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# Data Gen | ||
|
||
Data Gen is a tool that can generate a memory json from a Calyx file. It reads | ||
the Calyx file and generates an entry in the json for each cell marked with the | ||
`@external` attribute. Currently, there are two types of number representation formats that can be generated as the data for the memory json: 1) unsigned 32 bit bitnums all equal to 0 and 2) signed, 32 bit fixed point numbers with `frac_width` = 16, and the data is randomly generated. | ||
Data Gen is a tool that can automatically generate a memory .json file from a Calyx file. | ||
It reads the Calyx file and generates an entry in the json for each cell marked with the | ||
`@external` attribute. | ||
|
||
Currently, there are two parameters you can specify: 1) whether the data should be fixed point (integer is default) and 2) whether data should be randomly generated (0 is the default). | ||
This tool can only generate fixed point values that have 16 bits for the fraction. | ||
|
||
## How to Run | ||
The following command can be run to generate unsigned, 32-bit zeroes: | ||
The following command can be run to generate unsigned integer zeroes: | ||
`cargo run -p data_gen -- <calyx file>` | ||
|
||
To generate random fixed point numbers, run: | ||
`cargo run -p data_gen -- <calyx file> -f true` | ||
`cargo run -p data_gen -- <calyx file> -f true -r true` | ||
|
||
It will print the json in the command line | ||
It will print the json in the command line. | ||
|
||
## Current Limitations | ||
As you can see, the tool is right now pretty limited, because it only supports 2 different representations of numbers. What if you want to generate random, 8 bit, unsigned ints in your memory? Data Gen currently wouldn't support that. Ideally, we would want each Calyx memory cell to have its own attribute(s) which can hold information about what type of number representation format the memory wants. This [github issue](https://github.com/calyxir/calyx/issues/1163) goes into more detail about future improvements for the tool. | ||
As you can see, the tool is right now pretty limited. | ||
For example, the fixed point values must be 16 bit, and the json generated only supports one memory type (for example, if you wanted some of the memories to be fixed point and others to be integers, this tool does not support that). | ||
Ideally, we would want each Calyx memory cell to have its own attribute(s) which can hold information about what type of number representation format the memory wants. This [github issue](https://github.com/calyxir/calyx/issues/1163) goes into more detail about future improvements for the tool. |