From 2a829bf91c9d498f796b12e0f876bcaae5133710 Mon Sep 17 00:00:00 2001 From: Muxianesty Date: Tue, 3 Sep 2024 18:09:14 +0300 Subject: [PATCH] Fixes regarding Pull Request comments. --- README.md | 4 ++-- docs/latency_config.md | 8 ++++---- docs/simulation.md | 4 ++-- src/model/dfcxx/include/dfcxx/vars/var.h | 2 +- src/model/dfcxx/lib/dfcxx/graph.cpp | 6 ++---- src/model/dfcxx/lib/dfcxx/simulator.cpp | 12 ++++++------ 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 9ab2b78..c6a09d5 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ For the executable there are three general arguments: `-h,--help`, `-H,--help-al 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`. -`hls` mode is used to translate the provided DFCxx kernel to different output formats. The list of arguments for `hls`-mode is presented below: +`hls` mode is used to perform the high-level synthesis of digital hardware description from the input DFCxx kernel. The list of arguments for `hls`-mode is presented below: * `-h,--help`: *optional* flag; used to print the help-message about other arguments. * `--config `: *required* filesystem-path option; used to specify the file for a JSON latency configuration file. Its format is presented in `docs/latency_config.md`. @@ -232,7 +232,7 @@ 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: +`sim` mode is used to simulate the input DFCxx kernel. The list of arguments for `sim`-mode is presented below: * `-h,--help`: *optional* flag; used to print the help-message about other arguments. * `--in `: *optional* filesystem-path option; used to specify the input file for simulation data (default: `sim.txt`). Its format is presented in `docs/simulation.md`. diff --git a/docs/latency_config.md b/docs/latency_config.md index 8f8595e..f9fc7ca 100644 --- a/docs/latency_config.md +++ b/docs/latency_config.md @@ -1,10 +1,10 @@ ## JSON Configuration -Latency configuration for each computational operation (number of pipeline stages) used in a DFCxx kernel is provided via a JSON file. +Latency configuration (in terms of pipeline stages) for each computational operation used in a DFCxx kernel is provided via a JSON file. -Currently each operation has two specifications: for integer values (`INT`) and floating point (`FLOAT`) values. +Currently each operation has two specifications based on the types of its arguments: for integer values (`INT`) and floating point (`FLOAT`) values respectively. -The list of all computational operations is provided below: +All the supported computational operations are listed below: * `ADD` - Addition * `SUB` - Subtraction @@ -22,7 +22,7 @@ The list of all computational operations is provided below: * `EQ` - "equal" comparison * `NEQ` - "not equal" comparison -JSON configuration structure states that for every operation with a specific configuration (each pair is represented as a separate JSON-field with `_` between pair's elements) present in the kernel, operation's latency will be provided. +JSON configuration structure states that for every operation with a specific configuration (each pair is represented as a separate JSON-field with `_` between pair's elements) present in the kernel, operation's latency has to be provided. Here is an example of a JSON configuration file, containing latencies for multiplication, addition and subtraction of integer numbers: diff --git a/docs/simulation.md b/docs/simulation.md index ceeaca2..d4cdc56 100644 --- a/docs/simulation.md +++ b/docs/simulation.md @@ -7,12 +7,12 @@ DFCxx kernels can be simulated to check that they describe computations as expec 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 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 an explicit type - they will be casted to the types of related computational nodes) +* every block has a number of lines, each of which has the case-sensitive name of some **input** stream/scalar variable and its hex-value (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 hex-value are separated with a single space character (` `) * the provided value must be a valid hex-value: with or without `0x`, with either lower- or uppercase letters * if some stream/scalar hex-value is present twice or more in the same block - its latest described value is used -Here is an example of an input simulation file for `MuxMul` kernel, which has two input streams `x` (unsigned 32-bit integer values) and `ctrl` (unsigned 1-bit integer values -> boolean values). +Here is an example of an input simulation file for `MuxMul` kernel, which has two input streams: `x` (unsigned 32-bit integer values) and `ctrl` (unsigned 1-bit integer values). ```txt x 0x32 diff --git a/src/model/dfcxx/include/dfcxx/vars/var.h b/src/model/dfcxx/include/dfcxx/vars/var.h index 0bbffd3..6ab7533 100644 --- a/src/model/dfcxx/include/dfcxx/vars/var.h +++ b/src/model/dfcxx/include/dfcxx/vars/var.h @@ -23,7 +23,7 @@ class DFVariableImpl { friend VarBuilder; public: - enum IODirection{ + enum IODirection { NONE = 0, INPUT, OUTPUT diff --git a/src/model/dfcxx/lib/dfcxx/graph.cpp b/src/model/dfcxx/lib/dfcxx/graph.cpp index 44d4c4f..447a5e7 100644 --- a/src/model/dfcxx/lib/dfcxx/graph.cpp +++ b/src/model/dfcxx/lib/dfcxx/graph.cpp @@ -20,13 +20,11 @@ const std::unordered_set &Graph::getStartNodes() const { return startNodes; } -const std::unordered_map> &Graph::getInputs() const { +const std::unordered_map> &Graph::getInputs() const { return inputs; } -const std::unordered_map> &Graph::getOutputs() const { +const std::unordered_map> &Graph::getOutputs() const { return outputs; } diff --git a/src/model/dfcxx/lib/dfcxx/simulator.cpp b/src/model/dfcxx/lib/dfcxx/simulator.cpp index ed98f60..477169b 100644 --- a/src/model/dfcxx/lib/dfcxx/simulator.cpp +++ b/src/model/dfcxx/lib/dfcxx/simulator.cpp @@ -261,12 +261,12 @@ static inline std::string valueToBinary(SimValue value, uint64_t width) { return stream.str(); } -void DFCXXSimulator::writeOutput(ctemplate::TemplateDictionary *dict, - const RecordedValues &vals, - uint64_t startInd, - uint64_t iter, - const std::unordered_map &idMap) { +void +DFCXXSimulator::writeOutput(ctemplate::TemplateDictionary *dict, + const RecordedValues &vals, + uint64_t startInd, + uint64_t iter, + const std::unordered_map &idMap) { ctemplate::TemplateDictionary *tick = dict->AddSectionDictionary("TICKS"); tick->SetValue("TICK", std::to_string(startInd + iter));