-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DFCxx simulation #49
DFCxx simulation #49
Changes from 18 commits
ddd2366
4505cce
80a8097
5aabc77
4ebe450
8a0fe36
29dac55
6e0e750
58b7a0d
ddac5f9
38d04cf
bd65dbb
596a936
df531b0
9673380
424f328
6c48c88
031d2d7
252e0c4
fd31d82
2a829bf
8eb9020
97d413d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,9 +211,9 @@ The compiled Utopia HLS executable has a CLI to accept a number of parameters af | |
|
||
For the executable there are three general arguments: `-h,--help`, `-H,--help-all` and `-v,--version` for printing simple and extended help-messages, and printing current executable's version respectively. | ||
|
||
Unless neither of the three arguments is used, first argument is the mode which the executable has to function in. Currently there is only one available mode `hls`. | ||
Unless neither of the three arguments is used, first argument is the mode which the executable has to function in. Currently there are only two available modes: `hls` and `sim`. | ||
|
||
The list of arguments for `hls`-mode is presented below: | ||
`hls` mode is used to translate the provided DFCxx kernel to different output formats. The list of arguments for `hls`-mode is presented below: | ||
|
||
* `-h,--help`: *optional* flag; used to print the help-message about other arguments. | ||
* `--config <PATH>`: *required* filesystem-path option; used to specify the file for a JSON latency configuration file. Its format is presented in *JSON Configuration* section. | ||
|
@@ -232,6 +232,12 @@ Here is an example of an Utopia HLS CLI call: | |
umain hls --config ~/utopia-user/config.json --out-sv ~/outFile.sv --out-dfcir ~/outFile2.mlir -a | ||
``` | ||
|
||
`sim` mode is used to simulate the provided DFCxx kernel. The list of arguments for `sim`-mode is presented below: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "provided DFCxx kernel" -> "input DFCxx kernel" |
||
|
||
* `-h,--help`: *optional* flag; used to print the help-message about other arguments. | ||
* `--in <PATH>`: *optional* filesystem-path option; used to specify the input file for simulation data (default: `sim.txt`). Its format is presented in *DFCxx Simulation Input Format* section. | ||
* `--out <PATH>`: *optional* filesystem-path option; used to specify the output VCD file (default: `sim_out.txt`). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks strange that the output VCD file has |
||
|
||
### JSON Configuration | ||
|
||
Latency configuration for each computational operation (number of pipeline stages) used in a DFCxx kernel is provided via a JSON file. | ||
|
@@ -268,6 +274,33 @@ Here is an example of a JSON configuration file, containing latencies for multip | |
} | ||
``` | ||
|
||
### DFCxx Simulation Input Format | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO, it would be better to have a concise README and describe auxiliary information in separate Markdown files. Let's move this chapter there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing whitespace is detected here also. |
||
|
||
DFCxx kernels can be simulated to check that they describe computations as expected. The simulation doesn't include scheduling-related characteristics, thus DFCxx concepts like *offsets* are not supported, every computational node has to use **and** accept some value. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First sentence is ok. The second one is hardly understandable; could be better to have the specific section called "Supported DFCxx constructions" (or something like that) in this document. |
||
The format to provide simulation input data is the following: | ||
|
||
* input data is divided into blocks separated with a newline character (`\n`) - one block for each clock period | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "for each clock period" -> "at a simulation step" |
||
* every block has a number of lines, each of which has the name of some **input** stream/scalar value and its hex-value (these values do not have a type - it is assumed from the corresponding computational nodes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "these values do not have a type - it is assumed from the corresponding computational nodes" -> "these values do not have an explicit type - they will be casted to the types of related computational nodes" |
||
* stream/scalar value name and the value are separated with a single space character (` `) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "the value" -> "the hex-value" |
||
* the provided value must be a valid hex-value: with or without `0x`, with either lower- or uppercase letters | ||
* if some stream/scalar value is present twice or more in the same block - its latest described value is used | ||
* after the last block **no newline character can be present** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can -> must ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By the way, this requirement looks like a work-in-progress limitation, it would be better to remove it. |
||
|
||
Here is an example of an input simulation file for `MuxMul` kernel, which has two input streams `x` and `ctrl`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be more informative to specify types for input streams here -- it'll make the typecasting logic more transparent. |
||
|
||
```txt | ||
x 0x32 | ||
ctrl 0x1 | ||
|
||
x 0x45 | ||
ctrl 0x0 | ||
|
||
x 0x56 | ||
ctrl 0x1 | ||
``` | ||
|
||
In this example, `x` accepts values `50` (`0x32`), `69` (`0x45`) and `86` (`0x56`), while `ctrl` accepts `1`, `0` and `1`. This means that 3 clock periods will be simulated for the provided kernel. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "clock periods will be simulated" -> "simulation ticks will be performed" |
||
|
||
## Examples | ||
|
||
Root subdirectory `examples` contains different examples of DFCxx kernels, `start`-function definitions and JSON configuration files. | ||
|
@@ -282,7 +315,15 @@ build/src/umain hls --config examples/polynomial2/add_int_2_mul_int3.json -a --o | |
|
||
The execution command is going to pass a JSON configuration file (with 2 and 3 pipeline stages for integer addition | ||
and multiplication respectively) to Utopia HLS, resulting in the creation of the file `output`, containing a SystemVerilog | ||
module for Polynomial2 kernel with a greedy ASAP-scheduling. | ||
module for `Polynomial2` kernel with a greedy ASAP-scheduling. | ||
|
||
The same kernel can be simulated with: | ||
|
||
```bash | ||
build/src/umain sim --in examples/polynomial2/sim.txt --out output.vcd | ||
``` | ||
|
||
This command uses the simulation data from `sim.txt` file to output a VCD-file `output.vcd`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "to output a VCD-file" -> "and stores the simulation trace to the output file called" |
||
|
||
## DFCxx Documentation | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,9 @@ | |
"out_dfcir" : "", | ||
"out_firrtl" : "", | ||
"out_dot" : "" | ||
}, | ||
"sim": { | ||
"in" : "sim.txt", | ||
"out" : "sim_out.txt" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
x 0x32 | ||
|
||
x 0x45 | ||
|
||
x 0x56 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
x0 0x0 | ||
x1 0x1 | ||
x2 0x2 | ||
x3 0x3 | ||
x4 0x4 | ||
x5 0x5 | ||
x6 0x6 | ||
x7 0x7 | ||
x8 0x8 | ||
x9 0x9 | ||
x10 0xA | ||
x11 0xB | ||
x12 0xC | ||
x13 0xD | ||
x14 0xE | ||
x15 0xF | ||
x16 0x10 | ||
x17 0x11 | ||
x18 0x12 | ||
x19 0x13 | ||
x20 0x14 | ||
x21 0x15 | ||
x22 0x16 | ||
x23 0x17 | ||
x24 0x18 | ||
x25 0x19 | ||
x26 0x1A | ||
x27 0x1B | ||
x28 0x1C | ||
x29 0x1D | ||
x30 0x1E | ||
x31 0x1F | ||
x32 0x20 | ||
x33 0x21 | ||
x34 0x22 | ||
x35 0x23 | ||
x36 0x24 | ||
x37 0x25 | ||
x38 0x26 | ||
x39 0x27 | ||
x40 0x28 | ||
x41 0x29 | ||
x42 0x2A | ||
x43 0x2B | ||
x44 0x2C | ||
x45 0x2D | ||
x46 0x2E | ||
x47 0x2F | ||
x48 0x30 | ||
x49 0x31 | ||
x50 0x32 | ||
x51 0x33 | ||
x52 0x34 | ||
x53 0x35 | ||
x54 0x36 | ||
x55 0x37 | ||
x56 0x38 | ||
x57 0x39 | ||
x58 0x3A | ||
x59 0x3B | ||
x60 0x3C | ||
x61 0x3D | ||
x62 0x3E | ||
x63 0x3F |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
x11 0x32 | ||
x12 0x64 | ||
x21 0x48 | ||
x22 0x99 | ||
y11 0x1 | ||
y12 0x0 | ||
y21 0x0 | ||
y22 0x1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
x 0x32 | ||
ctrl 0x1 | ||
|
||
x 0x45 | ||
ctrl 0x0 | ||
|
||
x 0x56 | ||
ctrl 0x1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
x 0x32 | ||
|
||
x 0x45 | ||
|
||
x 0x56 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
x1 0x2 | ||
y1 0x32 | ||
x2 0x3 | ||
y2 0x32 | ||
x3 0x4 | ||
y3 0x32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hls
mode is used to perform a High-Level Synthesis of digital hardware description from the input DFCxx kernel