Skip to content

Commit

Permalink
Updating DataGen Docs (#2005)
Browse files Browse the repository at this point in the history
* update docs

* small fix
  • Loading branch information
calebmkim authored Apr 17, 2024
1 parent 21c2f7b commit 98f5d5e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docs/tools/data-gen.md
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.

0 comments on commit 98f5d5e

Please sign in to comment.